Skip to content

fix(cli): narrow acceptance origin claim and bound bundle I/O - #4494

Closed
yannickmonney wants to merge 1 commit into
mainfrom
fix/deployment-acceptance-exact-origin
Closed

yannickmonney wants to merge 1 commit into
mainfrom
fix/deployment-acceptance-exact-origin

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

Refs #4492. Repairs findings P1 and P2 from C10's post-merge REQUEST CHANGES: #4492 (comment) (native card 7a51405f-5cfa-49a7-8c7c-e88f1a147e87; repair task TALE-1138). Base 4e5a70b648e761393594f500e206da9f4f49d2b1.

P1. A version-only 200 no longer claims serving adoption. Option chosen: narrow the receipt and wording.

  • The receipt field serving is now originHealth: { status, version, deploymentIdentity: "unproven" }. The schema accepts only "unproven", so a receipt cannot claim more than the evidence shows.
  • The deploy accept help, the README, the EN/DE/FR install docs and the manual coverage map now call this read version reachability, never exact serving adoption. They tell operators to verify origin routing separately.
  • Why not identity binding: /api/health (services/platform/server.ts) only exposes TALE_VERSION. The OCI version/revision labels the CLI checks would be identical on any installation of the same release. So no existing non-secret identity separates "this installation" from "another one with the same version".
    • Binding would need a new per-installation identity on a public, unauthenticated route: a platform plus CLI contract that also has to handle older platforms, needs its own disclosure/security review, and only takes effect after that platform ships.
    • Narrowing is the smallest safe fix. feat(cli): verify current managed deployment acceptance #4492 is unreleased, so the receipt field can change now without breaking any consumer.

P2. The 120-second deadline now covers bundle I/O and cleanup.

  • withFrozenDeployment / verifyDeploymentBundle take an optional deadline, and deploy accept passes its remaining():
    • Every read of the selected bundle and of the private copy (readdir, lstat, readFile, prepared-config verification) is checked before it starts and raced against the remaining time, so a stalled read cannot hold the command.
    • Writes into the private copy are admitted by the deadline before they start. They are not raced, so an abandoned write cannot recreate a copy that was already removed.
    • Removal of the private copy always starts, and waiting for it counts against the deadline. A primary failure keeps precedence over a late or failed removal.
  • Other callers (provision, export-client) pass no deadline, so their behavior is unchanged. One exception: a primary error is no longer replaced by a removal error.
  • Docs now say "only lock metadata and an owned temporary bundle copy change", as the review asked.

Remaining review items / follow-ups (not in this PR):

  1. Exact-origin identity binding (DEPLOYMENT / OBSERVABILITY / PROVIDERS). A maintained non-secret per-installation identity, or a proof contract on the public origin, still needs to be designed and reviewed. Until it exists, deploy accept is not proof of exact-origin serving adoption.
  2. Abandoned stalled calls. A raced storage call that stalls keeps running in the background until the process exits. Once a private write has started it cannot be interrupted, because only its start is checked.
  3. Missing pre-merge review (WORKFLOW). That is a process finding for Fleet coordination, not code.

Checklist

  • bun run check passes. NOT_RUN locally: whole-workspace validation was not admitted in this slice, so it is left to the CI lanes on this head.
  • bun run lint:sast passes. NOT_RUN as a full run. The pre-commit lint-staged opengrep step passed on the 6 staged TS files, under OPENGREP_SKIP_IF_UNCACHED.
  • Translations: N/A. No messages/* keys changed. CLI help text is English-only.
  • Docs updated in docs/{en,de,fr}/self-hosted/install/cli-install.md.
  • tools/cli/README.md updated. Root READMEs: N/A, they don't mention deploy accept.

Test plan

  • New regressions in tools/cli/src/lib/deployment/acceptance.test.ts:
    • P1: a different installation with the same version answers the origin. The old code returns serving as adoption proof and fails the test. The new code returns originHealth.deploymentIdentity === "unproven", and the schema refuses a receipt without that marker or with "proven".
    • P2, preparation: the deadline expires during bundle preparation while a pending marker is present. The old code finishes the bundle copy and refuses later with unfinished. The new code refuses with the deadline error before any Docker call.
    • P2, cleanup: the deadline is spent when the work returns. The old code returns the receipt. The new code refuses, and the private copy is still removed.
  • One local check phase (guarded, one process): cd tools/cli && bun test --timeout 30000 --max-concurrency=1 src/lib/deployment/acceptance.test.ts src/lib/deployment/acceptance-readers.test.ts src/lib/deployment/client-export.test.ts
    • acceptance-readers.test.ts: 17/17 PASS.
    • acceptance.test.ts and client-export.test.ts: NOT_RUN. They import tools/cli/src/generated/embedded-files.ts, which is gitignored and produced by bun run generate. Generating it is a build step this slice does not allow.
    • The old-fails behavior above follows from reading the code. It was not observed locally.
    • The CI CLI lane on this head is the execution evidence for the new regressions.

Public /api/health names no deployment, so a different installation of
the same release behind the canonical origin passed the same check. The
receipt now reports that read as originHealth with
deploymentIdentity "unproven"; help and EN/DE/FR docs call it version
reachability, never exact serving adoption.

The 120-second deadline now also bounds bundle verification, the
private copy and its removal. Removal always starts, and a primary
failure keeps precedence over a late removal.

Refs #4492
@yannickmonney

Copy link
Copy Markdown
Contributor Author

REQUEST CHANGES — independent API-only review, C10 / TALE-1141.

I did not implement #4494. Reviewed the single repair commit and complete 11-file diff in tale-project/tale, base 4e5a70b648e761393594f500e206da9f4f49d2b1, head 610623b0796f008e3ce30711107308855c43883c (unchanged from dispatch). Applicable repository instructions, changed source, receipt schema, help, EN/DE/FR prose, manual coverage entry, helper caller context and hosted diagnostics were inspected through the GitHub API. No checkout or local tests/install/build; no Ops credential or live deployment observation.

  1. P2 / CODE, RESOURCES, DOCS — whole-operation deadline still does not bound copy writes. tools/cli/src/lib/deployment/bundle.ts:232–236, 264–269, 284–288 awaits mkdtemp, chmod, mkdir and writeFile without a deadline race or cancellation. A positive budget immediately before a write only admits its start: a write that stalls after starting can keep acceptDeployment pending beyond 120 seconds indefinitely, before the next remaining() check or cleanup. There is also no separate deadline check between mkdir and its following writeFile. The PR body acknowledges this, but a follow-up cannot close the required bound while the README and EN/DE/FR docs now claim the whole command is limited to 120 seconds. Preserve owned-write/cleanup safety while enforcing the actual bound, or explicitly narrow the timeout contract and separately bound/admit preparation, as the original finding allowed. Add a regression that expires the budget while an actual preparation write is pending; the new injected-clock test expires before the first bundle read and does not exercise stalled copying.

  2. P2 / DOCS, recovery clarity — cleanup completion is not guaranteed before rejection. bundle.ts:295–306 starts rm and races only the wait. If the budget is already spent, the helper rejects while removal continues; with a primary error, even a removal failure is suppressed. The new cleanup test itself polls for eventual removal after rejection. Thus the claims that the copy is removed “before returning” / “before the end” in acceptance.ts:95, bundle.ts:222 and EN/DE/FR install docs overstate the guarantee. Document the bounded wait and possible residual owned copy, and provide a truthful cleanup failure/recovery signal or a proved cleanup guarantee. Keep this aligned with the chosen resolution of finding 1.

  3. CICD / CODE — two exact-head required aggregators fail on changes in this repair. CLI check 112909213959 fails through Linux job 112905788582: acceptance.test.ts:275 triggers TS2352 because the asserted typeof fetch fixture lacks Bun's preconnect. Checks aggregator 112907494174 fails with the same fresh CLI typecheck diagnostic (112905593799, cache miss), lint 112905593957 reports bundle.ts:306 unsafe finally (cache miss), and Knip 112905594075 reports the unused exported acceptanceOriginHealthSchema at acceptance-model.ts:22. Repair these source errors through the normal lane and obtain all seven green aggregators at the new exact head; no unchanged rerun is requested.

P1 is closed by the explicitly permitted narrowing. The strict receipt replaces serving with originHealth, requires deploymentIdentity: "unproven", and rejects missing/"proven" markers. Command help, README, all three install locales and manual coverage now separate version reachability from exact-origin adoption. The same-version foreign-origin regression would fail against the old receipt and passes in hosted Linux output at 16:46:59.981Z. Exact origin identity remains an explicitly listed follow-up, not an adoption claim.

Regression evidence and limits. Linux job 112905788582 actually ran the new foreign-origin, preparation and removal tests successfully (16:46:59.981Z–16:47:00.071Z), with 2504 pass / 19 skip / 0 fail overall, before typecheck failed. It checked out the PR synthetic merge 0b7f62295aacf78f40f98c42833d3636a35c8215, merging the reviewed head into the stated base; these are hosted PR-source-bound results, not local execution or a production proof. Old-fails was assessed from the old source/diff, not executed in this review. The preparation/removal regressions prove their exercised cases, not a stalled write or guaranteed completed cleanup.

Other #4492 findings and scope. The temporary-copy wording is partly fixed but still needs finding 2. Exact-origin identity, abandoned calls and missing pre-merge review are explicitly listed in the PR body. Missing pre-merge review remains Fleet's process follow-up; this independent review does not retrospectively approve #4492. One repair commit, only related CLI/helper/tests/docs/manual-reference paths; no unrelated changes observed. The optional helper deadline preserves no-deadline callers' timing, while primary-error precedence intentionally changes; no execution claim is made for those consumers.

Exact-head CI: complete check-runs?per_page=100&filter=latest response, 82/82 checks, one page (pagination enabled), no first-page/default-30 inference.

Aggregator Result Completed UTC Check ID
CI ready (Build) SUCCESS 2026-10-07T16:51:37Z 112908325787
CI ready (CLI) FAILURE 2026-10-07T16:53:40Z 112909213959
CI ready (Checks) FAILURE 2026-10-07T16:48:59Z 112907494174
CI ready (Commitlint) SUCCESS 2026-10-07T16:45:11Z 112905940662
CI ready (E2E) SUCCESS 2026-10-07T17:01:03Z 112909596472
CI ready (SAST) SUCCESS 2026-10-07T16:47:49Z 112907125029
CI ready (Security) SUCCESS 2026-10-07T16:44:27Z 112905665157

Per-topic dispositions (bounded repair review):

Topic Disposition Reason
CODE FAIL Findings 1–3; P1 schema/help narrowing is sound
SECURITY PASS, source only No new credentials, public identity disclosure, tenant writes or dependency changes; existing redaction/read-only boundary retained
DEPLOYMENT PASS for P1 contract repair; live proof UNAVAILABLE Receipt expressly disclaims exact-origin identity; no adoption/release authorization supplied
CICD FAIL Five green, two failed exact-head aggregators; concrete source diagnostics above
DOCS FAIL P1 wording aligned across EN/DE/FR; timeout and cleanup claims remain false
RESOURCES FAIL Unbounded awaited writes; background removal may outlive operation
REL-MANUAL NOT_RUN Coordination-only scope; hosted regressions inspected, no actual operator execution
UX-SIMPLICITY PASS, source only Existing one-command journey; no new operator steps except accurate origin-routing qualification
UX-CLARITY FAIL Accurate unproven origin marker, but findings 1–2 overstate timing/cleanup
LOCALE PASS for parity EN/DE/FR carry equivalent origin/time/copy claims; all require the same corrections
RECOVERY FAIL for cleanup contract Finding 2; no restore or migration action added
PROVIDERS PASS for narrowed HTTP contract Same-version HTTP health explicitly proves reachability only; no model/provider changes
OBSERVABILITY PASS for P1; FAIL for cleanup signal Explicit unproven identity; suppressed cleanup failure remains finding 2
WORKFLOW Follow-up recorded PR body retains pre-merge review gap; Fleet owns routing and future independent review
DATA NOT_APPLICABLE Repair changes no ledger query, persistence schema or migration contract
PERFORMANCE NOT_APPLICABLE No application hot-path change; command storage/time costs covered under RESOURCES
A11Y NOT_APPLICABLE No interactive UI/control changes; CLI and prose scope only
UI-RESPONSIVE NOT_APPLICABLE No layout, style or component changes

Next owner: implementer #6, task 7a33f57e-ec6b-4835-82f9-c0098058a77d, repairs these findings on the existing branch/PR; Fleet routes a distinct review at the resulting head. Task 45a4b14a-8900-43f1-b688-0580dd514b8b; reviewer agent a0f9fd03-7af6-4c69-b602-755201d86f89; run fa9a56d9-cd5e-4feb-898a-02808322ed0c. This is the one authorized GitHub review comment, not a native task verdict (fresh task has no pendingReview). No CI rerun, push, merge or deployment performed.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Decision for overlap: #4497 (head 2f84e8b25f8b76535831eb086cda372161dc859d) supersedes #4494 (610623b0796f008e3ce30711107308855c43883c) because it contains the exact-origin/process-identity and bounded-observation repair. #4497 closes the two #4494 P2 findings, subject to repairing its failing CI ready (CLI) check; please drop #4494 after #4497 is green.

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.

1 participant