Skip to content

fix(deploy): an anonymous deploy's content-scan refusal exits 4 with its envelope, and prints the claim link when claiming lifts it - #2771

Merged
reliant-labs[bot] merged 5 commits into
mainfrom
fix/claimable-credential-preflight
Nov 25, 2026
Merged

reliant-labs[bot] merged 5 commits into
mainfrom
fix/claimable-credential-preflight

Conversation

@reliant-01

@reliant-01 reliant-01 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes new.txt §1 #3b and F19: an evaluator's first-run report on v1.10.0. Pairs with reliant-labs/control-plane#3642.

Problem

When the platform refused an anonymous deploy's upload until the deploy was claimed, the user was stuck:

  • the refusal said "claim the deploy with its claim link" but never printed the link;
  • env status --claimable then said "do not give the claim link to your user yet".

Owner decision (2026-11-25)

The platform no longer refuses unclaimed sites with sign-in pages (control-plane#3642), so the default full-stack app with native auth deploys anonymously. This PR's first revision added a local pre-build refusal of credential fields. That refusal is removed: it would refuse what the platform now admits. What remains is the claim-link fix for the refusals that claiming still lifts (today, content the scan is uncertain about).

Change

  • Claim link on a claim-required refusal.

    • control-plane#3642 adds the x-forge-claim-required response header to such refusals (reason still claimable_content_refused). forge reads it (cloud.ClaimRequiredOf) and never matches on message text.
    • The deploy error prints Claim: <link>, "Claim to unlock: the platform publishes this content only for a claimed deploy.", and a fix: line.
    • The --json document carries claim, with a new additive field claim.claim_required.
    • The attempt is stored as last_attempt_claim_required, a new omitempty field in the credentials file entry.
  • Every content-scan refusal exits 4, with a --json envelope. An anonymous deploy of forge's examples/express-postgres was refused by the scan, but forge exited 1 and its --json printed no document. The refusal comes from RecordBundle during the build, before the deploy's report exists, and forge mapped neither reason. Now:

    • claimable_content_refused (with or without a claim link) and claimable_scan_unavailable become claimable refusals with exit 4, as contentscan's contract says, and a --json envelope carrying error_reason and next_actions;
    • the text names the platform's message, the evidence id and a fix: line;
    • a refusal that claiming would not lift does not offer the claim link.

    Why that app was refused, and the control-plane fix, is in control-plane#3642: node:22-slim's own changelog overflowed the URL lookup budget.

  • A refusal at publish, after the promotion is written, is in the one document. The content scan also runs inside Promote and the publish RPCs. Previously the deploy's own document was emitted with the raw error (exit_code 1, no claim). A new promoteOptions.Refusal hook translates such a refusal before the document is stamped, so stdout still carries one document, its exit_code is the process's (4), and claim carries claim_url and claim_required for MCP's deploy_claimable. claimableRefusal now unwraps to the platform error, so its reason and headers stay readable.

  • env status --claimable and MCP deploy_status. After a claim-required refusal they no longer say to hold the link back. They say claiming is the way forward and give the link out.

  • Additive only (semver 1): new JSON and credential fields, and no flag or field changes. The exit code for these refusals moves from 1 (an unmapped error) to 4, which is what contentscan's contract and forge's exit-code table already promise for a platform refusal.

Not touched: forge explain (internal/cli/explain_error.go, another agent's file) has no entries yet for claimable_content_refused or claimable_scan_unavailable. It is worth adding them there.

Ordering and compatibility

This PR works against an old control plane: without the header, ClaimRequiredOf reports false and the refusal is handled exactly as before. Either PR can merge first.

Tests

  • internal/cli/claimable_claim_required_test.go:
    • the refusal prints the link and keeps its exit code;
    • ClaimRequiredOf reads the header, not the message, and an old control plane without the header is unaffected;
    • the claim document, the text output and MCP next_steps give the link out after a claim-required refusal;
    • a whole-CLI test (testkit.Slow): the fake control plane refuses RecordBundle as claim-required, the deploy prints the link, and env status --claimable gives it out;
    • a whole-CLI test (testkit.Slow): a claim-required refusal at publish (RecordBundle on its second call, and Promote) yields exactly one JSON document with exit_code 4, the claim URL and claim_required, and MCP's fillClaim relays them;
    • a whole-CLI test (testkit.Slow): a plain content refusal and an unavailable scan each exit 4 with an envelope naming the reason, the evidence id and next_actions, and offer no claim link.
  • go test -run 'TestClaim|TestPrintClaimBlock|TestMCP|TestClaimableDeploy_' ./internal/cli/ passes in full mode, and task test:short passes for internal/cli, internal/cloud and pkg/credentials.
  • scripts/ci-golangci-changed.sh reports 0 issues. The earlier nestif finding went with the removed preview code.

Post-merge check

None in production for forge itself: this is CLI behaviour, released with the next forge release. Once it is released and control-plane#3642 is live, run an anonymous deploy whose upload the scan is uncertain about (e.g. a page titled "Sign in to your Google account" with an email field). It must print Claim: https://…/claim#rcl_…, and forge env status prod --claimable must give the link out.

Rollback

Revert this PR. The credentials-file and JSON fields are additive, and an older forge ignores them.

@reliant-01

Copy link
Copy Markdown
Contributor Author

Pairs with reliant-labs/control-plane#3642 (adds the x-forge-claim-required header and the specific message). Either can merge first.

@reliant-labs reliant-labs Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review:changes

Lane: HIGH (no model review: the rollout pre-check stopped it before the first pass; deterministic checks ran).

HIGH: auth (pkg/credentials/credentials.go); secrets (pkg/credentials/credentials.go)

No model reviewed this head: the PR body has no Post-merge check and no Rollback section, which every HIGH-risk PR needs, so the review stopped before its first pass. The deterministic checks ran; everything they found is below.

  • blocker [B1] internal/cli/deploy_claimable.go:531 — nestif: if !doc.Eligible has complex nested blocks (complexity: 8) (golangci-lint 2.14.0 over the changed packages, as the merge queue runs it: a head with this finding is ejected from the queue) Fix: Fix it at the head; reproduce with scripts/ci-golangci-changed.sh $(git merge-base origin/main HEAD).
  • blocker [B2] :0 — The PR body has no Post-merge check and no Rollback section. A HIGH-risk PR names, for every effect only production or a write shows, how it is checked after the deploy (Post-merge check) and how it is undone if that check fails (Rollback); the review blocks on any effect without them, so no model reviewed this head (rollout-sections) Fix: Add a "## Post-merge check" and a "## Rollback" section to the PR body ("none: " is an answer when nothing is live-only), then push, or reply citing this blocker's id to have this same head reviewed.

Fix the blockers and push: the push is reviewed again. (pr-fix takes over if nobody does.)

Reviewed 2bcebb2e6da49743cb47efdaca76b53d678ae9b5.

Posted by Reliant for PR pipeline · pr-review · opened, an automation of @reliant-01.

@reliant-labs reliant-labs Bot added review:changes Blocking review findings; workflow repairs or fix, push, re-label merge:queue fix:needed and removed review:pending labels Nov 25, 2026
…build and prints its claim link

forge env deploy --claimable (and --plan-only) now scans the hosted frontends'
source for credential input fields (type=password, credential autocomplete
tokens), the subset of the platform's content scan that a sign-in form always
trips, and refuses in a second instead of after a two-minute build. When the
platform refuses an upload until the deploy is claimed (the new
x-forge-claim-required header), the refusal prints the claim link and what
claiming unlocks, and env status gives the link out instead of holding it back.
An older control plane without the header keeps today's behaviour.
@reliant-01
reliant-01 force-pushed the fix/claimable-credential-preflight branch from 2bcebb2 to 5a330e4 Compare November 25, 2026 05:49
@reliant-01 reliant-01 changed the title fix(deploy): an anonymous deploy with sign-in pages fails before the build and prints its claim link fix(deploy): a claim-required refusal of an anonymous deploy prints its claim link Nov 25, 2026
@reliant-labs reliant-labs Bot added review:pending and removed review:changes Blocking review findings; workflow repairs or fix, push, re-label merge:queue labels Nov 25, 2026

@reliant-labs reliant-labs Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review:changes

Lane: HIGH (Sol pass + second pass in this run).

HIGH: auth (pkg/credentials/credentials.go); secrets (pkg/credentials/credentials.go)

Reviewed all eight files' changed hunks and completed the HIGH-risk second pass. No blocking defect found. Header-based detection preserves old-server behavior; credential and JSON changes are additive, with no scope, authorization, tenant, billing or migration changes. Tests cover claim-link rendering, absent-header fallback, persisted status and a whole-CLI refusal. RC-01/04/05/09/10/11 found no violation. Both earlier blockers are resolved.

Second pass: Read all eight changed files' hunks and traced credential persistence, MCP decoding and promotion reporting. Authorization and credential-storage boundaries remain unchanged; older servers retain the existing refusal behavior. Found a missing claim object on the inner reporter's error path. Both earlier pre-check blockers are resolved. No code or tests were executed.

Tests covering the risk:

  • Auth: distinguish claim-required denials from old-server and message-only errors without changing admission.: internal/cli/claimable_claim_required_test.go:TestClaimRequiredOf_ReadsTheHeaderNotTheMessage
  • Secrets: expose the existing claim capability only through the intended refusal/status output and persist the new attempt metadata.: internal/cli/claimable_claim_required_test.go:TestClaimableDeploy_PlatformClaimRequiredPrintsTheClaimLink; TestClaimDocument_ClaimRequiredGivesTheLinkOut

Migration safety: not_applicable

  • blocker [B1] internal/cli/deploy_claimable.go:378 — [second pass] When the inner promotion reporter already emitted JSON, this branch suppresses the outer document without adding claim metadata to the emitted one. internal/cli/deploy_promote.go:463-470 attaches opts.Claim only when writeErr is nil, then emits even on follow-through failures. A claim-required refusal during deployment admission therefore returns JSON without claim.claim_url or claim.claim_required; MCP reads only that document and cannot offer the claim link. The new whole-CLI test exercises RecordBundle, before this reporter, so misses this path. Fix: Populate claim metadata in the inner promotion error document before emission for claim-required failures, preserving the failed attempt rather than invoking the success-only Claim callback. Add a promotion/follow-through refusal regression asserting exactly one JSON document with the claim link, cause, nonzero exit and MCP next steps.

Earlier blockers, at this head:

  • R1.B1 fixed — internal/cli/deploy_claimable.go:509@5a330e4: the earlier preview nesting is gone; the remaining eligibility branch is simplified.
  • R1.B2 fixed — PR #2771 now includes Post-merge check and Rollback sections covering the released CLI with the server header enabled.
  • R1.B1 fixed — The preview branch at internal/cli/deploy_claimable.go:509-527 no longer contains the removed nested preview checks that caused the earlier finding. Lint was not rerun.
  • R1.B2 fixed — Current PR body contains Post-merge check and Rollback sections with a released-CLI refusal/status check and a revert plan.

Not verified (non-blocking):

  • high_risk: Did not trace the inner promotion reporter's already-emitted error path; whether that path includes claim metadata remains unverified. The new whole-CLI test covers the earlier RecordBundle refusal path.

Post-merge verification (only a live environment shows these; not review blockers, each verified by the plan named):

  • Released CLI behavior against the production claim-required response. — After release and server rollout, deploy an uncertain-content anonymous site; verify the refusal prints its claim link and env status --claimable gives the link out.; rollback: Revert this PR; older forge ignores the additive credential and JSON fields.
  • Released CLI receives a claim-required response from the deployed platform and presents the recovery link. — After forge release and control-plane#3642 rollout, anonymously deploy the PR body's uncertain-content fixture; verify deploy prints the claim link and env status prod --claimable gives it out.; rollback: Revert this PR and release the revert; older forge ignores the additive credentials and JSON fields.

Not verified by the second pass (non-blocking):

  • Sibling tests are not applicable coverage through the open control-plane release/v1.32.2-rc.1 candidate, which does not contain control-plane#3642's merge. This review instead uses this repository's tests; absence of the new header preserves old behavior.

Fix the blockers and push: the push is reviewed again. (pr-fix takes over if nobody does.)

Reviewed 5a330e47e6d5c4f07f9da07704e7493565151353.

Posted by Reliant for PR pipeline · pr-review · pushed, an automation of @reliant-01.

@reliant-labs reliant-labs Bot added review:changes Blocking review findings; workflow repairs or fix, push, re-label merge:queue and removed review:pending labels Nov 25, 2026
@reliant-01 reliant-01 changed the title fix(deploy): a claim-required refusal of an anonymous deploy prints its claim link fix(deploy): an anonymous deploy's content-scan refusal exits 4 with its envelope, and prints the claim link when claiming lifts it Nov 25, 2026
@reliant-labs reliant-labs Bot added review:pending and removed review:changes Blocking review findings; workflow repairs or fix, push, re-label merge:queue labels Nov 25, 2026

@reliant-labs reliant-labs Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review:changes

Lane: HIGH (Sol pass + second pass in this run).

HIGH: auth (pkg/credentials/credentials.go); secrets (pkg/credentials/credentials.go)

Read all eight files' changed hunks and reviewed the HIGH-risk paths. The latest push adds scan-refusal handling but leaves the prior promotion-path claim-metadata defect unchanged. No additional blocking security, tenant-isolation or compatibility defect found. Header absence remains supported; credential fields are additive. Tests use fixed times or slow-test gates appropriately.

  • blocker [B1] internal/cli/deploy_claimable.go:378 — (again: R2.B1) The previous blocker remains: when promotion follow-through emits its JSON document before returning a claim-required refusal, this branch suppresses the outer document, but the emitted document lacks claim metadata. internal/cli/deploy_promote.go:463 attaches opts.Claim only on success and then emits on follow-through failures. MCP reads that document and therefore cannot provide claim.claim_url or claim.claim_required. The new tests still refuse RecordBundle before promotion, so do not cover this path. Fix: Attach refusal claim metadata before the inner promotion document is emitted, preserving exactly one JSON document and avoiding success-only attempt recording. Add a promotion follow-through refusal test asserting the claim URL and cause in CLI JSON and MCP output.

Earlier blockers, at this head:

  • R1.B1 fixed — internal/cli/deploy_claimable.go:513-530: the former preview implementation was removed; the previously reported nested block is no longer present.
  • R1.B2 fixed — The current PR body includes Post-merge check and Rollback sections describing a claim-required deploy/status check and reverting this additive change.
  • R2.B1 not_fixed — internal/cli/deploy_claimable.go:378-389 still skips claim attachment after inner JSON emission; internal/cli/deploy_promote.go:463-470 still attaches claims only on success.

Post-merge verification (only a live environment shows these; not review blockers, each verified by the plan named):

  • Released CLI behavior against the production claim-required response. — After release and the paired server rollout, deploy content producing an uncertain scan refusal; verify the claim link appears and env status --claimable gives it out.; rollback: Revert this PR; older forge ignores the additive credential and JSON fields.

Fix the blockers and push: the push is reviewed again. (pr-fix takes over if nobody does.)

Reviewed 5fd529ecaaa3013e62cfc3daa140a81afbb617e6.

Posted by Reliant for PR pipeline · pr-review · pushed, an automation of @reliant-01.

@reliant-labs reliant-labs Bot added review:changes Blocking review findings; workflow repairs or fix, push, re-label merge:queue and removed review:pending labels Nov 25, 2026
…d exit code in the deploy's one --json document
@reliant-labs

reliant-labs Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

[R2.B1] is fixed at 94c1b15. A claim-required refusal from the follow-through (Promote or a publish RecordBundle) is now translated before runPromote stamps and emits its document, through the new promoteOptions.Refusal hook. That one document carries exit_code 4, error_reason claimable_content_refused, and claim with claim_url and claim_required. No second document is written. Covered by TestClaimableDeploy_ClaimRequiredAtPublishIsInTheOneDocument, which runs both the second RecordBundle and the Promote case and asserts the claim through MCP's fillClaim.

@reliant-labs reliant-labs Bot added review:pending and removed review:changes Blocking review findings; workflow repairs or fix, push, re-label merge:queue labels Nov 25, 2026

@reliant-labs reliant-labs Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review:passed

Lane: HIGH (Sol pass + second pass in this run).

HIGH: auth (pkg/credentials/credentials.go); secrets (pkg/credentials/credentials.go)

Reviewed every changed hunk and the publish-refusal fix at 94c1b15. All earlier blockers are fixed. The refusal hook attaches claim metadata before stamping the single JSON document; TestClaimableDeploy_ClaimRequiredAtPublishIsInTheOneDocument covers both publish refusal paths and MCP projection. Second pass found no new authorization, tenant-isolation, secret-storage or compatibility defect. No scopes, dependency pins, billing, migrations or production configuration changed. RC-04/05 tests use fixed times or deterministic request counts; RC-10/11 retain header-absent compatibility. No code or tests executed.

Second pass: Read all 11 changed files' hunks and traced refusal translation, JSON emission, MCP consumption and credential persistence at HEAD. The publish-stage refusal is now translated before document stamping; the regression test covers both Promote and the second RecordBundle call. Auth and secrets changes are additive metadata only: no scope, authorization or tenant-key changes, and credential-file writes retain 0600 permissions. Header-less servers remain supported. RC-01/04/05/09/10/11 show no applicable violation. No code or tests executed; merge/release gates own execution.

Tests covering the risk:

  • Auth: distinguish claim-required refusals using structured server metadata without admitting refused content or inferring permission from message text.: internal/cli/claimable_claim_required_test.go:TestClaimRequiredOf_ReadsTheHeaderNotTheMessage; TestClaimableDeploy_ScanRefusalExits4WithItsEnvelope
  • Secrets: give the existing sensitive claim link to its owning CLI/MCP caller only for a claim-required refusal, including persisted status and publish-stage JSON.: internal/cli/claimable_claim_required_test.go:TestClaimDocument_ClaimRequiredGivesTheLinkOut; TestClaimableDeploy_PlatformClaimRequiredPrintsTheClaimLink; TestClaimableDeploy_ClaimRequiredAtPublishIsInTheOneDocument

Migration safety: not_applicable

Earlier blockers, at this head:

  • R1.B1 fixed — internal/cli/deploy_claimable.go:536: the previously flagged preview implementation was removed; the surviving eligibility branch is the baseline path.
  • R1.B2 fixed — PR body now includes Post-merge check and Rollback sections describing a released-CLI anonymous-deploy check and reverting this additive change.
  • R2.B1 fixed — internal/cli/deploy_promote.go:475 translates refusals and attaches claim metadata before stamping/emission; claimable_claim_required_test.go:186 covers publish-time refusals.
  • R3.B1 fixed — internal/cli/deploy_claimable.go:377 supplies the refusal hook; deploy_promote.go:475 invokes it before emission. The publish test covers second RecordBundle and Promote refusals.
  • R1.B1 fixed — The credential-preview refusal that introduced the reported nesting was removed; current preview handling inspected at internal/cli/deploy_claimable.go:520-565@94c1b15. Lint execution remains the merge gate's responsibility.
  • R1.B2 fixed — Current PR body supplies Post-merge check and Rollback sections covering the released CLI's claim-required behavior.
  • R2.B1 fixed — internal/cli/deploy_promote.go:475@94c1b15 translates the refusal and attaches claim metadata before stamping/emission; TestClaimableDeploy_ClaimRequiredAtPublishIsInTheOneDocument covers both publish refusal locations.
  • R3.B1 fixed — internal/cli/deploy_claimable.go:377@94c1b15 supplies the translation hook through deploy_all.go; deploy_promote.go applies it before emission. The new regression test checks one document, exit 4, claim metadata and MCP fillClaim.

Post-merge verification (only a live environment shows these; not review blockers, each verified by the plan named):

  • Released CLI interoperability with the production claim-required response. — After release and the paired server rollout, deploy content producing an uncertain scan verdict; verify the refusal prints the claim link and env status --claimable gives it out.; rollback: Revert this PR and release the revert; older forge ignores the additive credential and JSON fields.
  • Released CLI behavior against the deployed control plane's claim-required refusal. — After forge release and control-plane#3642 deployment, deploy an uncertain branded email-input page anonymously; verify the error prints the claim link and env status --claimable gives it out.; rollback: Revert this PR and release the correction; older forge ignores the additive credential and JSON fields.

Passed: entering the native merge queue at this exact head.

Reviewed 94c1b1508dc12867620507c777452ad6ff104290.

Posted by Reliant for PR pipeline · pr-review · pushed, an automation of @reliant-01.

@reliant-labs reliant-labs Bot added the merge:queue Ready: the merge steward batches, gates and lands it label Nov 25, 2026
@reliant-labs reliant-labs Bot added review:passed Automated review passed; exact-head merge-review SUCCESS also required and removed review:pending labels Nov 25, 2026
@reliant-labs
reliant-labs Bot enabled auto-merge November 25, 2026 07:10
@reliant-labs
reliant-labs Bot added this pull request to the merge queue Nov 25, 2026
reliant-01 added a commit that referenced this pull request Nov 25, 2026
forge #2771 moves these refusals to exit 4. The answer is the reason's
whatever code comes with it, so the test asks with none, checks exits 1
and 4 give the same answer, and compares forge explain --json with
explain_error.
@reliant-labs reliant-labs Bot added the fixing label Nov 25, 2026
@reliant-labs

reliant-labs Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

pr-fix: taking over (attempt 1 of 3)

it is stuck. The PR names the chat that opened it (ead0f85d-b872-515f-a9f2-8f5aef5679a2); pr-fix fixes it directly, and that chat holds no lease (it would, had its marker opted in with fix:self). An implementer holds the fix lease (label fixing, run 1f6c2fcc-d4f9-5517-8207-89f183dcf5ea) and will push with --force-with-lease after re-checking the head.

Posted by Reliant for PR pipeline · pr-fix · review-changes, an automation of @reliant-01.

@reliant-labs

reliant-labs Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

pr-fix: nothing to change, re-queued

[B1] (R2.B1) is already fixed by PR head 94c1b15, after the reviewed head 5fd529e. The claimable refusal callback now attaches claim metadata and translates the error before promotion JSON is stamped and emitted. No further code changes needed.
Verified: go test ./internal/cli -run '^TestClaimableDeploy_ClaimRequiredAtPublishIsInTheOneDocument$' -timeout 5m passed (23.776s), covering publication-time refusals, exactly one JSON document, matching exit code, claim URL and claim-required metadata. Initial compilation attempt exceeded the command timeout; the completed run passed. No Go changes or linter run.

Gate: not run. Push: not pushed. Re-added review:pending at the same head, which passed review: not counted as an attempt.

Posted by Reliant for PR pipeline · pr-fix · review-changes, an automation of @reliant-01.

Merged via the queue into main with commit d9083c0 Nov 25, 2026
56 of 59 checks passed
@reliant-labs

reliant-labs Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

sync-checkouts: pipeline machine maintenance failed

This pipeline machine is not fully synced. Follow the remedy for each path:

  • /home/workspace/projects/reliant-labs/forge on ns1023237: on a detached HEAD, not main; left alone

For a checkout left alone, commit or move the work and git switch main; never reset or stash someone else's checkout. After fixing the reported problem, fire PR pipeline · sync-checkouts · by hand (or wait for the next merge).

MACHINE=ns1023237 root=/home/workspace/projects/reliant-labs
SYNC=forge not_on_main branch=detached
NOTICE=/home/workspace/projects/reliant-labs/forge on ns1023237: on a detached HEAD, not main; left alone


Posted by Reliant for PR pipeline · sync-checkouts · merged (ovh-build-1), an automation of @reliant-01.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge:queue Ready: the merge steward batches, gates and lands it review:passed Automated review passed; exact-head merge-review SUCCESS also required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant