Skip to content

feat(replicated): clarify file/env injection contract with explicit errors#364

Merged
marccampbell merged 3 commits into
mainfrom
feat/replicated-provider-contract
Jun 7, 2026
Merged

feat(replicated): clarify file/env injection contract with explicit errors#364
marccampbell merged 3 commits into
mainfrom
feat/replicated-provider-contract

Conversation

@elasticclaw-factory

Copy link
Copy Markdown
Contributor

Fixes #300

The Replicated CMX provider cannot inject TemplateFiles or Env at creation time because the VM must be running before SSH is available. The hub's bootstrapReplicated path already handles file injection separately after the VM is running.

This change makes the contract explicit rather than silently ignoring data:

  • Create() now returns an error if TemplateFiles or Env are provided
  • ProvisionClaw() now returns an error if templateFiles are provided
  • Added provider-level tests for the error behavior
  • Added documentation comments explaining the limitation and pointing to the bootstrap path

@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. pkg/provider/replicated/replicated.go, line 241-263 (link)

    P1 env silently dropped despite docstring claiming it is passed through

    The doc comment says "env is passed through to the bootstrap script", but the implementation never touches env — it calls p.CreateVM(ctx, req) and returns immediately without forwarding the map anywhere. A caller that passes env vars here will get neither an error nor any effect, which is exactly the silent data loss the PR is designed to eliminate.

    Either the guard should mirror the Create() pattern and reject a non-nil env with an error, or the docstring must be corrected to state that env is ignored (and the hub's bootstrap path is solely responsible for environment injection). As written, the misleading comment makes it easy for future callers to assume the values are applied.

Reviews (1): Last reviewed commit: "feat(replicated): clarify file/env injec..." | Re-trigger Greptile

elasticclaw-factory Bot pushed a commit that referenced this pull request Jun 6, 2026
Greptile review caught that ProvisionClaw's docstring claimed env was
'passed through to the bootstrap script' but the implementation silently
dropped it. Now both templateFiles and env are explicitly rejected with
clear errors, matching the Create() pattern.

- Added env rejection guard in ProvisionClaw()
- Rewrote docstring to accurately describe the contract
- Added tests for env rejection and combined rejection

Addresses #364 (comment)
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "fix(replicated): reject env in Provision..." | Re-trigger Greptile

Claw and others added 3 commits June 6, 2026 13:06
…rrors

The Replicated CMX provider cannot inject TemplateFiles or Env at creation
time because the VM must be running before SSH is available. The hub's
bootstrapReplicated path already handles file injection separately after the
VM is running.

This change makes the contract explicit:
- Create() now returns an error if TemplateFiles or Env are provided
- ProvisionClaw() now returns an error if templateFiles are provided
- Added provider-level tests for the error behavior
- Added documentation comments explaining the limitation

Fixes #300
Greptile review caught that ProvisionClaw's docstring claimed env was
'passed through to the bootstrap script' but the implementation silently
dropped it. Now both templateFiles and env are explicitly rejected with
clear errors, matching the Create() pattern.

- Added env rejection guard in ProvisionClaw()
- Rewrote docstring to accurately describe the contract
- Added tests for env rejection and combined rejection

Addresses #364 (comment)
@marccampbell marccampbell force-pushed the feat/replicated-provider-contract branch from dbd6df6 to 007639f Compare June 6, 2026 18:23
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Reviews (3): Last reviewed commit: "Defer replicated env injection during pr..." | Re-trigger Greptile

@marccampbell marccampbell merged commit 03259f6 into main Jun 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify or implement Replicated provider file/env injection contract

1 participant