diff --git a/.traceweaver/intent-contract.yml b/.traceweaver/intent-contract.yml index 6f2a40d..1a3d23e 100644 --- a/.traceweaver/intent-contract.yml +++ b/.traceweaver/intent-contract.yml @@ -57,6 +57,40 @@ "trace_id": "TRACE-PAIR-006", "verification_id": "VER-PAIR-006", "validation_id": "VAL-PAIR-006" + }, + { + "id": "REQ-UPDATER-001", + "statement": "Bounded stop-only acknowledgement headroom; preserve existing stop grace (13s default), other socket timeouts and readiness deadlines.", + "authority_status": "owner_approved_scope", + "trace_id": "TRACE-UPDATER-001", + "verification_id": "VER-UPDATER-001", + "validation_id": "VAL-UPDATER-001" + }, + { + "id": "REQ-UPDATER-002", + "statement": "Fixed allowlisted phase/category diagnostics, safe known wrapped-cause classification, separate primary/recovery failure; no exception text/payload/credentials/traceback serialization; diagnostics cannot interrupt recovery. Preserve rollback, identity, selection and native guards.", + "authority_status": "owner_approved_scope", + "trace_id": "TRACE-UPDATER-002", + "verification_id": "VER-UPDATER-002", + "validation_id": "VAL-UPDATER-002" + }, + { + "id": "REQ-UPDATER-003", + "statement": "Recognize one explicitly named released-standard1.5.4 source via complete ordered structural equality and immutable eight-template historical closure; preserve current candidate rendering, auth/module identity, selection/source drift denial, declaration and recovery guards. Verify matching official wheel/container and disposable staging adoption before bounded separate official hostvenv provisioning, fixed native Proxy adoption and the already-approved single LTX IPMI retry.", + "authority_status": "owner_approved_scope", + "trace_id": "TRACE-UPDATER-003", + "verification_id": "VER-UPDATER-003", + "validation_id": "VAL-UPDATER-003" } - ] + ], + "updater_stop_scope": { + "authority": ".traceweaver/updater-stop-20261104/authority.json", + "profile": ".traceweaver/updater-stop-20261104/workflow-profile.json", + "status": "owner_approved_scope; implementation verification pending; runtime held" + }, + "updater_compatibility_scope": { + "authority": ".traceweaver/updater-stop-20261104/compatibility/authority.json", + "profile_revision": 3, + "status": "owner-approvedscope; REDdefinitionphase; runtimeheld" + } } diff --git a/.traceweaver/updater-stop-20261104/approved-plan-review.html b/.traceweaver/updater-stop-20261104/approved-plan-review.html new file mode 100644 index 0000000..a6e1155 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/approved-plan-review.html @@ -0,0 +1,15 @@ +LTX updater repair plan review +

LTX updater repair: approval-ready amendments

+

2026-11-04. Read-only source review; requested Astra high identity is unattested. No implementation, Git mutation, remote operation, release or retry performed. Review scope: frozen installed migration.py and updates.py, incident diagnosis, existing test_updates.py test inventory.

+

CHANGED

Only this review and its evidence manifest were created. Proposed scope is appropriate with the amendments below; implementation and production execution remain subject to owner approval for the Proxy component.

+

VERIFIED

Frozen DockerEngine uses a 15-second transport timeout and computes stop grace as timeout minus two (13 seconds). Raising the global timeout would also raise grace, preserving the inadequate two-second allowance. The request wrapper converts OSError into MigrationError with the original exception as its cause. replace_container discards all non-UpdateError details. It marks started_stop before calling stop, so stop failures already enter automatic recovery. Disconnect happens immediately after stop, before rename. Result dictionaries are persisted by the worker.

Diagnosis records SIGTERM to stop event duration 15.110771697 seconds, forced kill after approximately 13 seconds, no candidate rename/create/start, and original restart. These are retained incident evidence, not a new independent observation of live health or data counts.

+

CLAIMED

A stop socket timeout is strongly supported, not established: the exception was lost, and a following disconnect failure remains possible. The repair addresses a demonstrably inadequate timeout relationship but cannot claim to have proved the historical exception or eliminated every cause.

    +
  1. Keep the production stop grace at 13 seconds; introduce a stop-specific transport budget with explicit bounded acknowledgement headroom, e.g. 13 + 15 = 28 seconds. Pass this only to that request. Preserve other request timeouts and readiness deadlines. Do not mutate a shared engine timeout or extend grace when adding response headroom. Define behavior for existing nondefault timeout callers before coding.
  2. +
  3. Record an allowlisted operation phase set immediately before each fallible mutation (including stop and disconnect), and a bounded allowlisted exception category. Merely recording type(error).__name__ yields MigrationError for socket failures; classify its known cause, such as TimeoutError, without serializing text, paths, payloads, arguments or tracebacks. Unknown classes map to a fixed generic category.
  4. +
  5. Freeze the primary failure phase/category before recovery starts. If recovery fails, preserve those primary diagnostics and separately record a recovery phase/category; retain current failed/rolled_back/recovery_required semantics. Diagnostic construction must not throw or interrupt recovery. Keep identity, policy and native recovery guards intact.
  6. +
  7. Reuse existing replacement and recovery tests. Add the smallest cases proving stop timeout classification through MigrationError.__cause__, distinction from disconnect failure, secret-bearing exception text exclusion, and retention of primary failure when recovery fails. Verify added fields survive actual worker job persistence.
  8. +
  9. Use a real local Unix-socket HTTP boundary for representative delayed acknowledgement: original default request times out before a response at more than 15 seconds; revised stop succeeds with the same 13-second grace; a request exceeding the new bounded budget still fails and enters recovery. A shortened timing version may serve regression CI, but preserve one representative full-scale proof. Include a disposable Docker staging update/recovery against the frozen repair image to exercise daemon behavior, image identity and health recovery. No production retry to obtain missing diagnostics.
  10. +
+

BLOCKED

No fix or tests have been implemented or run in this review. A mocked successful stop cannot prove the socket deadline repair. Representative delayed-ack proof and staging recovery evidence are needed before any production retry. This review does not authorize a new Proxy release or assert that a fixed route currently supports that release.

+

PROMOTE

Recommend approval of the bounded Proxy repair plan with these amendments: isolated feature worktree, minimal production edits in migration.py and updates.py plus existing relevant tests; feature PR into dev and protected patch release into main, required checks retained, no CI/pool changes. Promote only the independently reviewed immutable release via an already authorized fixed update route. After Proxy update health and installed updater identity are verified, permit at most the separately approved single scoped LTX IPMI retry, retaining the prior backup waiver only within its original scope. Report release, deployment and retry acceptance separately.

+ diff --git a/.traceweaver/updater-stop-20261104/approved-plan.html b/.traceweaver/updater-stop-20261104/approved-plan.html new file mode 100644 index 0000000..7089d7f --- /dev/null +++ b/.traceweaver/updater-stop-20261104/approved-plan.html @@ -0,0 +1 @@ +Proposed LTX updater stop repair

Proposed updater repair and LTX retry

Status: owner approval pending. This adds the CryptoLabs Proxy updater to the approved IPMI deployment scope. No repair code or new deployment has been executed.

Incident658b5cc178cf40989335b6f51b5eb876: original IPMI stop took15.1108s against15s socket timeout and13s stop grace. The original was restored;802eventrows and6alert-history rows are unchanged. No candidate create/start occurred. Timeout is strongly supported, but exact exception was discarded and a following disconnect failure is not excluded.

  1. In an isolated hotfix worktree, update src/cryptolabs_proxy/migration.py with bounded stop-only acknowledgement headroom while preserving existing stop grace (13s default), other socket timeouts and readiness deadlines. Update src/cryptolabs_proxy/updates.py with fixed allowlisted phase/category diagnostics, safe known wrapped-cause classification, and separate primary/recovery failures. Never serialize exception text, payloads, credentials or tracebacks; diagnostics cannot interrupt recovery. Preserve rollback, identity, selection and native guards.
  2. Reuse tests/test_updates.py and tests/test_proxy_lifecycle_review_repairs.py, extending only meaningful missing cases: real Unix-socket delayed stop acknowledgement beyond the old deadline, bounded timeout failure, safe diagnostics through MigrationError cause, and original failure preservation on rollback failure. Retain original readiness/recovery/security tests. Run representative full-duration stop/ack and disposable Docker staging update/recovery proof before production; no production retry to collect lost logs. No dependency, CI, runner, pool or unrelated service changes.
  3. Use protected review/CI and a patch release based on the released main baseline, carrying only this reviewed repair and its release metadata (pyproject.toml and package __init__.py). Current Proxy main8e2b421 is1.6.0; dev2f868959 contains substantial unreleased Fleet owner changes. Preserve those changes and exclude them from this hotfix release; use a scoped source-to-dev handoff plus a main-based bounded release PR as required, rather than promoting the whole dev tree. Source and release authority/trace receipts accompany the patch. Owner approval covers this bounded hotfix route, not the separate unpublished Fleet proof or its budgets.
  4. After independent validation and immutable image publication, use the approved installed fixed host route to update only LTX Proxy. Verify its health, auth, unrelated pins and installed updater identity. Then permit one scoped IPMI1.4.0 retry, validate exact digest, saved history, collection and warning UI. No duplicate or blind retry, no manual container replacement or guard bypass. Charlotte remains untouched. Existing LTX backup waiver and explicit SSH-key instruction remain in force; BMC mutation policies stay off/unqualified.

Risk/trade-off: a stop call receives a larger but bounded response budget; no longer grace period or global deadline expansion. Proxy itself must be upgraded before IPMI retry, so this changes a second product component. Any unexpected failure holds rollout with verified original recovery. Astra review: findings/astra-ltx-updater-plan.html. User AGENTS.md requires explicit approval when implementation scope changes.

\ No newline at end of file diff --git a/.traceweaver/updater-stop-20261104/authority.json b/.traceweaver/updater-stop-20261104/authority.json new file mode 100644 index 0000000..e1a49b4 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/authority.json @@ -0,0 +1,42 @@ +{ + "schema": "updater-stop-authority/1", + "work_item_id": "UPDATER-STOP-20261104", + "source_revision": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d", + "owner_approval": ".traceweaver/updater-stop-20261104/owner-approval.json", + "approved_plan_sha256": "5c48796eff976c9e614887931087494687d3626f5780d4db0acf28b7f2299342", + "plan_review": ".traceweaver/updater-stop-20261104/approved-plan-review.html", + "meaning": "Existing owner approval is authority; local IDs only label its unchanged two implementation control groups. Root pairing authority remains untouched.", + "implementation_scope": [ + "src/cryptolabs_proxy/migration.py", + "src/cryptolabs_proxy/updates.py", + "tests/test_updates.py", + "tests/test_proxy_lifecycle_review_repairs.py" + ], + "current_phase": "Implementation allowed for original two production files under owner approval and root precode review; compatibility addendum excluded pending owner approval.", + "excluded": [ + "CI/dependency/runner changes", + "BMC qualification or mutation", + "Charlotte", + "unreleased Fleet dev", + "publication or remote mutation by this worker" + ], + "controls": [ + { + "id": "REQ-UPDATER-001", + "trace_id": "TRACE-UPDATER-001", + "ver_id": "VER-UPDATER-001", + "val_id": "VAL-UPDATER-001", + "source": "approved-plan.html clause 1; approved-plan-review.html amendment 1/5", + "text": "Bounded stop-only acknowledgement headroom; preserve existing stop grace (13s default), other socket timeouts and readiness deadlines." + }, + { + "id": "REQ-UPDATER-002", + "trace_id": "TRACE-UPDATER-002", + "ver_id": "VER-UPDATER-002", + "val_id": "VAL-UPDATER-002", + "source": "approved-plan.html clause 1; approved-plan-review.html amendments 2/3/4", + "text": "Fixed allowlisted phase/category diagnostics, safe known wrapped-cause classification, separate primary/recovery failure; no exception text/payload/credentials/traceback serialization; diagnostics cannot interrupt recovery. Preserve rollback, identity, selection and native guards." + } + ], + "id_status": "Scoped indexing of approved clauses; orchestrator must verify mapping, not a new requirement approval." +} diff --git a/.traceweaver/updater-stop-20261104/baseline.log b/.traceweaver/updater-stop-20261104/baseline.log new file mode 100644 index 0000000..f041524 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/baseline.log @@ -0,0 +1,13 @@ +.............................................. [100%] +=============================== warnings summary =============================== +tests/test_proxy_lifecycle_review_repairs.py: 21 warnings + /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/../src/cryptolabs_proxy/auth.py:374: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). + 'created_at': datetime.utcnow().isoformat(), + +tests/test_proxy_lifecycle_review_repairs.py::test_adoption_real_initializer_preserves_current_customer_password +tests/test_proxy_lifecycle_review_repairs.py::test_initializer_fresh_install_bootstraps_and_restart_preserves + /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/../src/cryptolabs_proxy/auth.py:471: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). + users[username]['last_login'] = datetime.utcnow().isoformat() + +-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html +46 passed, 23 warnings in 4.10s diff --git a/.traceweaver/updater-stop-20261104/builder-result.json b/.traceweaver/updater-stop-20261104/builder-result.json new file mode 100644 index 0000000..402920b --- /dev/null +++ b/.traceweaver/updater-stop-20261104/builder-result.json @@ -0,0 +1,20 @@ +{ + "phase": "implementation and local verification returned for review", + "frozen_manifest": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-builder/frozen-manifest.json", + "production_source_hashes": { + "src/cryptolabs_proxy/migration.py": "60ab6493757352c135cbb8b389dd198eab66b9b996398430bfa668b8599d9cc3", + "src/cryptolabs_proxy/updates.py": "1b176672c2a55499ca70a9eeb445550849975463846abb068443715e14bf1b56" + }, + "requirements": [ + "REQ-UPDATER-001", + "REQ-UPDATER-002" + ], + "verifications": [ + "VER-UPDATER-001", + "VER-UPDATER-002" + ], + "validation_status": "held pending independent Docker/Linux and intended environment proof", + "source_anchor_helper": "8 successful paired source/matrix transactions; scoped scanner0findings", + "profile_hash": "sha256:aaa66c2aad99a1e23e58e7112872f82b918eb1534edd68b102022a0c7f05d2eb", + "publication": "not performed" +} diff --git a/.traceweaver/updater-stop-20261104/capsule-reviewed.log b/.traceweaver/updater-stop-20261104/capsule-reviewed.log new file mode 100644 index 0000000..9aaf935 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/capsule-reviewed.log @@ -0,0 +1,5 @@ +vv_capsule_status=blocked +vv_capsule_capsule=.traceweaver/updater-stop-20261104/vv-capsule.json +vv_capsule_findings=2 +vv_capsule_finding=VV-CAPSULE-REVIEW-NOT-PASSED req_id=REQ-UPDATER-001 evidence=req_id="REQ-UPDATER-001" index=0 +vv_capsule_finding=VV-CAPSULE-REVIEW-NOT-PASSED req_id=REQ-UPDATER-002 evidence=req_id="REQ-UPDATER-002" index=1 diff --git a/.traceweaver/updater-stop-20261104/capsule-structure.log b/.traceweaver/updater-stop-20261104/capsule-structure.log new file mode 100644 index 0000000..1697012 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/capsule-structure.log @@ -0,0 +1,3 @@ +vv_capsule_status=pass +vv_capsule_capsule=.traceweaver/updater-stop-20261104/vv-capsule.json +vv_capsule_findings=0 diff --git a/.traceweaver/updater-stop-20261104/compatibility/approved-addendum.html b/.traceweaver/updater-stop-20261104/compatibility/approved-addendum.html new file mode 100644 index 0000000..e5869e9 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/approved-addendum.html @@ -0,0 +1 @@ +Updater deployment compatibility addendum

Proposed bounded compatibility addition

Status: approval pending. Revision2 clarifies the host-package installation mechanism after installed-command discovery. Original stop-response/diagnostics repair remains approved. One LTX IPMI retry remains authorized only after repaired Proxy acceptance; it has not been consumed.

Verified blocker: the installed1.5.4 host owner rejects the1.6 candidate auth module. The official1.6 host wheel matches candidateauth but rejects LTX current1.5.4 Nginx configuration. Exact historical render equals live configuration SHAaaaad066a3bb3ac324824dd532fdf33859551217abd104c9c5664c75e0103aad; actual published wheel rejection reproduced offline. No host change was attempted.

  1. Add one named released-standard-1.5.4 full-tree profile in src/cryptolabs_proxy/standard_adoption.py. Package its immutable root template and seven includes plus provenance under templates/released-standard-1.5.4/. Render historical includes only within that closure and verify hashes. Recognize only the exact declared complete structural profile; preserve current candidate rendering and all auth, drift, image, selection and recovery guards.
  2. Extend existing tests/test_standard_adoption.py with historical RED/GREEN, current candidate unchanged/account-link route retained, and focused historical variants of existing unknown-directive/upstream/auth/extra-route/order denial cases. Verify auth mismatch and source/selection drift still refuse before stop. Reuse existing recovery tests. Frozen synthetic historical fixture/declaration only if needed. No dependencies, CI or infrastructure changes.
  3. Include this compatibility addition with the approved stop repair in the same independently reviewed protected patch release; exclude all unrelated unreleased Fleet dev work. Verify official wheel/container source identities and packaged historical resources. Prove actual adoption, auth/state preservation and compensated recovery with disposable staging before production.
  4. Provision a new, separate versioned host CLI virtual environment using installed Python/venv/pip and the exact official wheel verified against published SHA256SUMS. The host has no fixed application wheel-installer; this is an explicit bounded provisioning exception requested for this operation. Do not upload or execute checked-out installers/scripts, change global CLI symlinks or alter the existing environment. Freeze exact package URLs/hashes and dependency inputs before installation; retain the old environment and original declaration/recovery snapshots. Run the official new package entrypoint for the native plan/adopt operation. Use a fresh native plan and installed fixed configuration adopt operation for LTX Proxy only. Verify browser auth, health, repaired updater bytes, unrelated pins and services, then execute the already approved ONE scoped IPMI1.4 retry. No second site, bypass or direct host source patch.

Risk/trade-off: adds one formerly rejected historical source profile, so strict negative configuration cases and immutable template closure are mandatory. Adds one production module and historical resources beyond the two files in the original approval. Existing backup waiver and scoped SSH-key authority continue. BMC policies remain off/unqualified.

Astra review: reviewed prerequisite. Raw discovery: verified host route. AGENTS.md requires explicit approval when implementation scope changes.

\ No newline at end of file diff --git a/.traceweaver/updater-stop-20261104/compatibility/astra-plan-review.html b/.traceweaver/updater-stop-20261104/compatibility/astra-plan-review.html new file mode 100644 index 0000000..ba784b9 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/astra-plan-review.html @@ -0,0 +1,15 @@ +Updater host route prerequisite review +

Updater host route prerequisite: conditional plan review

+

2026-11-04. Requested Astra high identity is unattested. Read-only source and retained-evidence review; no source edits, host installation, deployment, credentials, publication or subagents.

+

CHANGED

Created this review and artifacts/updater-plan-review/route-prerequisite-source-comparison.json only. Existing test preparation in the owner worktree was left intact.

+

VERIFIED

Main worktree is 8e2b421b65f6d8d47f780e5681d0f3d690686a6d. Local v1.5.4 tag resolves to b09195b6c08725fbe4867b4b3ab3642e8aff483d. Independently compared retained released 1.5.4 and 1.6 source: standard_adoption.py, config.py, services.py and custom_config.py are byte-identical. Of retained templates, only nginx.conf.j2 differs: 1.6 adds the account-link route plus a comment. The seven included routing templates are identical.

StandardAdoption._coverage compares the full ordered parsed tree, with limited existing domain normalization. It renders only the current standard profile before checking separate older bootstrap profiles. plan uses the recorded source declaration where available and renders the candidate from the proposed declaration. The candidate auth module equality check against the host package precedes stop. Existing tests cover unsupported route/directive/declaration rejection and drift denial without mutations. Package-data already includes templates and nested templates.

Retained checks prove 1.5.4 rendering under the original declaration produces aaaad066a3bb3ac324824dd532fdf33859551217abd104c9c5664c75e0103aad and passes its own coverage; released 1.6 coverage rejects those bytes. The sibling discovery report records the matching live digest and differing host/candidate auth hashes; these were not freshly measured by this review.

+

CLAIMED

If discovery finds no already-published compatible route, approve only this prerequisite:

    +
  1. Modify src/cryptolabs_proxy/standard_adoption.py to recognize one explicitly named released-standard-1.5.4 source profile through the same full-tree normalization/equality rule. Keep current-profile precedence, current candidate rendering, existing declaration validation, overlay/auth identity checks, immutable image selection, drift binding and compensation unchanged. Never remove nodes from the observed source or treat a subset of routes as sufficient.
  2. +
  3. Add an immutable packaged historical template closure under src/cryptolabs_proxy/templates/released-standard-1.5.4/: nginx.conf.j2 and its seven includes: acme-challenge.conf.j2, fleet-api-routes.conf.j2, exporter-auth-routes.conf.j2, host-forwarding.conf.j2, standard-service-routes.conf.j2, vast-price-manager-auth-blocks.conf.j2 and vast-price-manager.conf.j2. Add provenance.json recording release commit and hashes. Root template SHA256 is f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de. Resolve historical includes only inside that closure. Reuse declaration inputs and rendering validation; no general profile registry or new dependency is needed. A root-only copy using mutable current includes would not remain an immutable historical profile.
  4. +
  5. Extend tests/test_standard_adoption.py; add one independent historical rendered fixture and its synthetic declaration if needed under tests/fixtures/. First show RED: original released historical bytes fail current coverage. Then prove historical admission, distinct historical source_profile, candidate bytes still equal the current render and contain the account-link route. Reuse existing denial tests with historical input for changed directive/upstream, missing auth check, extra server/route and relevant route order change; all must fail without mutations. Do not normalize away these differences.
  6. +
  7. Extend existing plan/adopt guards only as necessary to demonstrate source/selection drift still refuses before stop, candidate auth mismatch still refuses, and preserved recovery tests pass from a historical source. A plan-time profile success alone does not prove adoption. Preserve original declaration and existing private recovery data.
  8. +
  9. Build the official host wheel and container from the same reviewed patch release. Verify historical resources exist in the installed wheel, both artifacts contain matching auth/updater bytes, and the packaged owner accepts the frozen historical source without contacting production. Retain representative delayed-stop proof from the approved repair. Use disposable staging for actual adoption, negative auth, state preservation and compensated recovery before installed-host mutation.
  10. +

This adds standard_adoption.py, historical package resources and focused adoption fixtures/tests beyond the approved migration.py + updates.py production scope. It also makes an official host-wheel installation a concrete deployment prerequisite. Root should obtain renewed scope approval before these production edits or that installation. Approved updater test preparation can continue independently.

+

BLOCKED

Standing reject: naive installation of released 1.6 followed by adoption; bypassing auth hash comparison; accepting arbitrary configurations because they have a 1.5.4 label; deleting account-link or other nodes from the observed source to force equality; copying the future dev Fleet owner; merging all of dev; direct host source patching; or production adoption used as a compatibility experiment. No such action is supported by this review.

Published-route discovery remains external to this review. A compatible already-published route would remove the need for new compatibility code. No green compatibility result, actual packaged-artifact acceptance or complete deployment route is claimed here. Adding the historical profile admits behavior that was formerly refused, so the full-tree negative cases and packaging closure are meaningful acceptance requirements.

+

PROMOTE

Conditional approval recommendation for this explicit bounded scope, not production GO. After owner approval, RED/GREEN proof, independent code review and required checks, route the reviewed small change through feature/dev/protected patch release without importing unrelated dev changes. Refresh the exact original declaration, source identities and scoped manifest; use the compatible official host owner with a fresh native plan ID. Retain all eight non-Proxy component selections, native recovery guards and separate browser authentication acceptance. Only after actual repaired Proxy health and installed updater identity are verified may the already-approved single scoped LTX IPMI retry proceed. Any failed or ambiguous adoption is a hold, not permission to replay.

+ diff --git a/.traceweaver/updater-stop-20261104/compatibility/authority.json b/.traceweaver/updater-stop-20261104/compatibility/authority.json new file mode 100644 index 0000000..494bc82 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/authority.json @@ -0,0 +1,28 @@ +{ + "work_item_id": "UPDATER-COMPATIBILITY-20261104", + "source_authority": "owner-approval.json", + "approved_plan_sha256": "f4c398629d4767a76a0ec45d7036997bb80b432ccec5d61d7bb3bec27b62980b", + "id": "REQ-UPDATER-003", + "trace_id": "TRACE-UPDATER-003", + "ver_id": "VER-UPDATER-003", + "val_id": "VAL-UPDATER-003", + "statement": "Recognize one explicitly named released-standard1.5.4 source via complete ordered structural equality and immutable eight-template historical closure; preserve current candidate rendering, auth/module identity, selection/source drift denial, declaration and recovery guards. Verify matching official wheel/container and disposable staging adoption before bounded separate official hostvenv provisioning, fixed native Proxy adoption and the already-approved single LTX IPMI retry.", + "status": "owner-approved unchanged addendum controls; IDs only index approved scope", + "phase": "root-precode-review passed; exact approved compatibility source implementation permitted; runtime gates remainheld", + "implementation_scope": [ + "src/cryptolabs_proxy/standard_adoption.py", + "src/cryptolabs_proxy/templates/released-standard-1.5.4/", + "tests/test_standard_adoption.py", + "tests/fixtures/ optional historical fixture/declaration only" + ], + "must_not_change": [ + "originaltwofile frozenhashes", + "currentcandidate rendering", + "allauth/drift/rollbackguards", + "unreleaseddevFleet", + "globalhostCLI", + "CI/deps/pool", + "Charlotte", + "BMCpolicies" + ] +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/builder-result.json b/.traceweaver/updater-stop-20261104/compatibility/builder-result.json new file mode 100644 index 0000000..99fc7c3 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/builder-result.json @@ -0,0 +1,13 @@ +{ + "phase": "implementation and local/package verification returned for independent review", + "manifest": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-builder/frozen-manifest.json", + "production_source_sha256": "ae9215e461f8c3b7b10fd9b814ebae90ecaeb15efc25d9d62c4ac26496f2c060", + "original4files_unchanged": true, + "focused": "66passed4.92s", + "affected": "189passed41.39s", + "regression": "1002passed2existing-skipped672warnings103.03s", + "resource_red": "3failed63deselected0.34s beforecompatibilityproduction", + "validation_status": "actual native staging/operational acceptance held", + "staging_harness": "raw artifact definition only; not executed", + "future_dev_handoff": "Main literalreleased-standard-1.5.4 profile assertion intentional. Review historical-profile label/precedence compatibility during later scoped dev handoff; do not import unreleased Fleet source." +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/capsule-reviewed.log b/.traceweaver/updater-stop-20261104/compatibility/capsule-reviewed.log new file mode 100644 index 0000000..2a49cbb --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/capsule-reviewed.log @@ -0,0 +1,4 @@ +vv_capsule_status=blocked +vv_capsule_capsule=.traceweaver/updater-stop-20261104/compatibility/vv-capsule.json +vv_capsule_findings=1 +vv_capsule_finding=VV-CAPSULE-REVIEW-NOT-PASSED req_id=REQ-UPDATER-003 evidence=req_id="REQ-UPDATER-003" index=0 diff --git a/.traceweaver/updater-stop-20261104/compatibility/capsule-structure.log b/.traceweaver/updater-stop-20261104/compatibility/capsule-structure.log new file mode 100644 index 0000000..ff0f68c --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/capsule-structure.log @@ -0,0 +1,3 @@ +vv_capsule_status=pass +vv_capsule_capsule=.traceweaver/updater-stop-20261104/compatibility/vv-capsule.json +vv_capsule_findings=0 diff --git a/.traceweaver/updater-stop-20261104/compatibility/dispatch-precondition.json b/.traceweaver/updater-stop-20261104/compatibility/dispatch-precondition.json new file mode 100644 index 0000000..cfeee94 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/dispatch-precondition.json @@ -0,0 +1,6 @@ +{ + "monotonic": 1308631.140655791, + "recorded_at": "2026-11-04T07:34:18.044928+00:00", + "profile_hash": "sha256:38bbffb104e856adfcecfd785449f2b156cb5762e4d7e316d8de5ec09e96aa53", + "scope": "test/fixture RED only; no compatibility production yet" +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/historical-fixture-proof.json b/.traceweaver/updater-stop-20261104/compatibility/historical-fixture-proof.json new file mode 100644 index 0000000..6ee7467 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/historical-fixture-proof.json @@ -0,0 +1,30 @@ +{ + "schema": "released-render-fixture/1", + "release": "v1.5.4", + "commit": "b09195b6c08725fbe4867b4b3ab3642e8aff483d", + "templates": { + "nginx.conf.j2": "f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de", + "acme-challenge.conf.j2": "7e594162700825757c9d402971094448aa1834d1f7121ac1c02f152f345e149a", + "fleet-api-routes.conf.j2": "6991ca6bf1dd4b258e8ee7851fc69ef50b19dfe2353570e4911a0ebadc68ed1b", + "exporter-auth-routes.conf.j2": "450f4c418c09474ac45b6dd314c47cc090fe7d230a0206b30e48c7975023133b", + "host-forwarding.conf.j2": "35c4a1fe1d3001865a77d7653350b7a61968953b94172dc7063bc31a42c0f9f7", + "standard-service-routes.conf.j2": "ef0f55aae48e35127d288781e68281a371505ba27384c8fd04dff9200dce3963", + "vast-price-manager-auth-blocks.conf.j2": "b9d7013434557492887b0600bc2afc92227ee17f9efebe55b0cccc4b16bd3f81", + "vast-price-manager.conf.j2": "32483d169a09c42653396e66c5c7efe1995bd599f44f11ee64fa2f0731a0a2f8" + }, + "fixture_sha256": "f1aa7a0ed767e7432dd21123fc0086e0cc98e0b26ad3c95eff5fe233095e3e72", + "declaration": "released-standard-1.5.4-declaration.json", + "declaration_sha256": "c4f4f3e80ff3920522502f47335120e133bca6d8e8245133d0112b550f382274", + "render_options": { + "autoescape": [ + "html", + "xml" + ], + "trim_blocks": true, + "lstrip_blocks": true + }, + "renderer": "Jinja2 Environment with DictLoader containing exactly8git-tag blobs; no production render_standard/historical compatibility helper used", + "source_compare": "All8tag blobs equal independently archived released154 source; services.py byte-identical to tag; references finite and all resolve within8blob closure", + "safety": "Synthetic domain/declaration only; no exported live configuration", + "raw_reproduction_script": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/render-fixture.py" +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/owner-approval.json b/.traceweaver/updater-stop-20261104/compatibility/owner-approval.json new file mode 100644 index 0000000..4710897 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/owner-approval.json @@ -0,0 +1,17 @@ +{ + "schema": "owner-approval/1", + "recorded_at": "2026-11-04T07:32:53.018771+00:00", + "literal_user_response": "Approve compatibility addition and continue deployment", + "approved_question": "Review strict historical1.5.4 profile, staging, official matchinghostpackage before alreadyapprovedONEIPMIretry", + "plan": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/updater-compatibility-addendum.html", + "plan_revision": 2, + "plan_sha256": "f4c398629d4767a76a0ec45d7036997bb80b432ccec5d61d7bb3bec27b62980b", + "provisioning_clarification": "Separate versionedhostvenv using installedPython/venv/pip and exactofficialverifiedwheel; no existingfixedwheelinstaller. Explicitboundedprovisioningexception; no checked-outinstaller/script and no globalsymlink/currentenv modification. Clarified in commentary before approval.", + "exclusions": [ + "Charlotte", + "BMCmutation/qualification", + "unreleasedFleetdev", + "guardbypass", + "blindsecondadoptionorretry" + ] +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/pre-mutation-proof.json b/.traceweaver/updater-stop-20261104/compatibility/pre-mutation-proof.json new file mode 100644 index 0000000..d7bfdea --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/pre-mutation-proof.json @@ -0,0 +1,25 @@ +{ + "recorded_at": "2026-11-04T07:38:34.714947+00:00", + "original4filesunchanged": { + "src/cryptolabs_proxy/migration.py": true, + "src/cryptolabs_proxy/updates.py": true, + "tests/test_updates.py": true, + "tests/test_proxy_lifecycle_review_repairs.py": true + }, + "compatibility_source_sha256": "e7603ba67a29d42e0d6e6c83eaa50cee7acef1cbff246e1230a99629d2397514", + "production_historical_directory_exists": false, + "profile_revision": 3, + "profile_hash": "sha256:38bbffb104e856adfcecfd785449f2b156cb5762e4d7e316d8de5ec09e96aa53", + "tests_sha256": "3293193e8f01cdea4913c92caee92f7c0536c080260445001169acee05d88e22", + "fixtures": { + "released-standard-1.5.4-declaration.json": "c4f4f3e80ff3920522502f47335120e133bca6d8e8245133d0112b550f382274", + "released-standard-1.5.4-provenance.json": "fe1ddc482fee7a42b5ce9f6df33146b7a17a57169360872bd333add44e273bfc", + "released-standard-1.5.4.nginx.conf": "f1aa7a0ed767e7432dd21123fc0086e0cc98e0b26ad3c95eff5fe233095e3e72" + }, + "test_environment": { + "python": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]", + "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O" + }, + "model_requested": "Solhigh", + "actual_identity": "unattested" +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/red.log b/.traceweaver/updater-stop-20261104/compatibility/red.log new file mode 100644 index 0000000..4d31168 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/red.log @@ -0,0 +1,409 @@ +.....................FF.F.F.............................F...... [100%] +=================================== FAILURES =================================== +____________ test_adopt_preflight_denial_stops_nothing[True-source] ____________ + +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9796/test_adopt_preflight_denial_st11') +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10b932660> +change = 'source', historical = True + + @pytest.mark.parametrize('historical,change', + [(False,c) for c in ['source','config','selection','digest','validation','mount-source','mount-rw','mount-option','mount-add','mount-remove','env-order']] + +[(True,'source'),(True,'selection')]) + def test_adopt_preflight_denial_stops_nothing(tmp_path,monkeypatch,change,historical): + from cryptolabs_proxy.standard_adoption import AdoptionError +> adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) + ^^^^^^^^^^^^^^^^^^^^^^^ + +tests/test_standard_adoption.py:137: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/standard_adoption.py:628: in plan + profile=self._coverage(active,source_declaration) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +active = b'worker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\n\nevents {\n worker_co...ion / {\n root /usr/share/nginx/html;\n try_files $uri $uri/ /index.html;\n }\n }\n\n}' +declaration = {'acme_challenge': None, 'domain': 'fleet.example.test', 'host_forward_groups': [], 'obsolete_overlays': [], ...} + + def _coverage(self,active,declaration): + tree=parse_nginx(active) + # Entire configuration, including every directive and server, must + # match a supported profile. Only explicit server_name is normalized. + def normalize(nodes): + nodes=deepcopy(nodes) + def visit(items): + for words,children in items: + if words[0]=='server_name': + if words[1:]==[declaration['domain']] or words[1:]==['_'] and not declaration.get('hostname_policy'): words[1:]=['DECLARED_DOMAIN'] + elif words[1:] not in [g['hostnames'] for g in declaration.get('host_forward_groups',[])]: raise AdoptionError('source_domain_unmapped') + if children is not None: visit(children) + visit(nodes); return nodes + actual=normalize(tree); expected=normalize(parse_nginx(render_standard(declaration))) + if actual==expected: return 'standard' + legacy=get_jinja_env().loader.get_source(get_jinja_env(),'legacy-bootstrap-nginx.conf')[0].encode() + profiles=[legacy] + for enabled in (False,True): profiles.append(render_managed_vpm_config(legacy,enabled)) + forwarding_tree=parse_nginx(render_host_forward_groups(declaration.get('host_forward_groups',[]),legacy_profile=True)) + profile_trees=[] + for profile in profiles: + profile_tree=parse_nginx(profile) + if declaration.get('acme_challenge'): + http=next(children for words,children in profile_tree if words==['http']) + server=next(children for words,children in http if words==['server']) + index=next(i for i,(words,children) in enumerate(server) if words[0]=='location') + server[index:index]=parse_nginx(render_acme_challenge(declaration['acme_challenge'],legacy_profile=True)) + next(children for words,children in profile_tree if words==['http']).extend(deepcopy(forwarding_tree)) + profile_trees.append(profile_tree) + if not declaration.get('hostname_policy') and any(actual==normalize(p) for p in profile_trees): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter'} + if b'location = /vast-pricing' in active: required.add('vast-price-manager') + if not required<=set(declaration['services']) or declaration['tls']!='self-signed': raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-1.2.0' + if declaration.get('hostname_policy')=='primary-only' and declaration.get('http_policy')=='redirect-primary-https' and declaration['tls']=='self-signed' and not declaration.get('acme_challenge'): + guarded=_guarded_bootstrap_profile(legacy,declaration) + if actual==normalize(guarded): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter','vast-price-manager'} + if not required<=set(declaration['services']): raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-primary-only' + supported=[expected]+([normalize(p) for p in profile_trees] if not declaration.get('hostname_policy') else []) + actual_words=list(_walk(actual)); actual_set={tuple(w) for w in actual_words} + closest=min(supported,key=lambda profile:len(actual_set^{tuple(w) for w in _walk(profile)})) + known={tuple(w) for w in _walk(closest)} + mismatch=next((w for w in actual_words if tuple(w) not in known),['structural-order']) + context=_safe(' '.join(mismatch) if mismatch[0]=='location' else mismatch[0]) +> raise AdoptionError('unsupported_source_behavior: '+context+' requires a supported declarative product profile') +E cryptolabs_proxy.standard_adoption.AdoptionError: unsupported_source_behavior: structural-order requires a supported declarative product profile + +src/cryptolabs_proxy/standard_adoption.py:619: AdoptionError +__________ test_adopt_preflight_denial_stops_nothing[True-selection] ___________ + +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9796/test_adopt_preflight_denial_st12') +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c0f17f0> +change = 'selection', historical = True + + @pytest.mark.parametrize('historical,change', + [(False,c) for c in ['source','config','selection','digest','validation','mount-source','mount-rw','mount-option','mount-add','mount-remove','env-order']] + +[(True,'source'),(True,'selection')]) + def test_adopt_preflight_denial_stops_nothing(tmp_path,monkeypatch,change,historical): + from cryptolabs_proxy.standard_adoption import AdoptionError +> adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) + ^^^^^^^^^^^^^^^^^^^^^^^ + +tests/test_standard_adoption.py:137: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/standard_adoption.py:628: in plan + profile=self._coverage(active,source_declaration) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +active = b'worker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\n\nevents {\n worker_co...ion / {\n root /usr/share/nginx/html;\n try_files $uri $uri/ /index.html;\n }\n }\n\n}' +declaration = {'acme_challenge': None, 'domain': 'fleet.example.test', 'host_forward_groups': [], 'obsolete_overlays': [], ...} + + def _coverage(self,active,declaration): + tree=parse_nginx(active) + # Entire configuration, including every directive and server, must + # match a supported profile. Only explicit server_name is normalized. + def normalize(nodes): + nodes=deepcopy(nodes) + def visit(items): + for words,children in items: + if words[0]=='server_name': + if words[1:]==[declaration['domain']] or words[1:]==['_'] and not declaration.get('hostname_policy'): words[1:]=['DECLARED_DOMAIN'] + elif words[1:] not in [g['hostnames'] for g in declaration.get('host_forward_groups',[])]: raise AdoptionError('source_domain_unmapped') + if children is not None: visit(children) + visit(nodes); return nodes + actual=normalize(tree); expected=normalize(parse_nginx(render_standard(declaration))) + if actual==expected: return 'standard' + legacy=get_jinja_env().loader.get_source(get_jinja_env(),'legacy-bootstrap-nginx.conf')[0].encode() + profiles=[legacy] + for enabled in (False,True): profiles.append(render_managed_vpm_config(legacy,enabled)) + forwarding_tree=parse_nginx(render_host_forward_groups(declaration.get('host_forward_groups',[]),legacy_profile=True)) + profile_trees=[] + for profile in profiles: + profile_tree=parse_nginx(profile) + if declaration.get('acme_challenge'): + http=next(children for words,children in profile_tree if words==['http']) + server=next(children for words,children in http if words==['server']) + index=next(i for i,(words,children) in enumerate(server) if words[0]=='location') + server[index:index]=parse_nginx(render_acme_challenge(declaration['acme_challenge'],legacy_profile=True)) + next(children for words,children in profile_tree if words==['http']).extend(deepcopy(forwarding_tree)) + profile_trees.append(profile_tree) + if not declaration.get('hostname_policy') and any(actual==normalize(p) for p in profile_trees): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter'} + if b'location = /vast-pricing' in active: required.add('vast-price-manager') + if not required<=set(declaration['services']) or declaration['tls']!='self-signed': raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-1.2.0' + if declaration.get('hostname_policy')=='primary-only' and declaration.get('http_policy')=='redirect-primary-https' and declaration['tls']=='self-signed' and not declaration.get('acme_challenge'): + guarded=_guarded_bootstrap_profile(legacy,declaration) + if actual==normalize(guarded): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter','vast-price-manager'} + if not required<=set(declaration['services']): raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-primary-only' + supported=[expected]+([normalize(p) for p in profile_trees] if not declaration.get('hostname_policy') else []) + actual_words=list(_walk(actual)); actual_set={tuple(w) for w in actual_words} + closest=min(supported,key=lambda profile:len(actual_set^{tuple(w) for w in _walk(profile)})) + known={tuple(w) for w in _walk(closest)} + mismatch=next((w for w in actual_words if tuple(w) not in known),['structural-order']) + context=_safe(' '.join(mismatch) if mismatch[0]=='location' else mismatch[0]) +> raise AdoptionError('unsupported_source_behavior: '+context+' requires a supported declarative product profile') +E cryptolabs_proxy.standard_adoption.AdoptionError: unsupported_source_behavior: structural-order requires a supported declarative product profile + +src/cryptolabs_proxy/standard_adoption.py:619: AdoptionError +_____ test_adopt_preserves_private_identity_tls_networks_and_repeat[True] ______ + +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9796/test_adopt_preserves_private_i1') +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c0f2200> +historical = True + + @pytest.mark.parametrize('historical',[False,True]) + def test_adopt_preserves_private_identity_tls_networks_and_repeat(tmp_path,monkeypatch,historical): + from cryptolabs_proxy.standard_adoption import render_standard, _declaration + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical) + inspect=engine.inspect + from itertools import count + inspections=count() + def rotating_mounts(name): + observed=inspect(name) + if observed and observed.get('Mounts'): + mounts=observed['Mounts']; offset=next(inspections)%len(mounts) + observed['Mounts']=mounts[offset:]+mounts[:offset] + return observed + monkeypatch.setattr(engine,'inspect',rotating_mounts) +> plan=adoption.plan(settings) + ^^^^^^^^^^^^^^^^^^^^^^^ + +tests/test_standard_adoption.py:168: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/standard_adoption.py:628: in plan + profile=self._coverage(active,source_declaration) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +active = b'worker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\n\nevents {\n worker_co...ion / {\n root /usr/share/nginx/html;\n try_files $uri $uri/ /index.html;\n }\n }\n\n}' +declaration = {'acme_challenge': None, 'domain': 'fleet.example.test', 'host_forward_groups': [], 'obsolete_overlays': [], ...} + + def _coverage(self,active,declaration): + tree=parse_nginx(active) + # Entire configuration, including every directive and server, must + # match a supported profile. Only explicit server_name is normalized. + def normalize(nodes): + nodes=deepcopy(nodes) + def visit(items): + for words,children in items: + if words[0]=='server_name': + if words[1:]==[declaration['domain']] or words[1:]==['_'] and not declaration.get('hostname_policy'): words[1:]=['DECLARED_DOMAIN'] + elif words[1:] not in [g['hostnames'] for g in declaration.get('host_forward_groups',[])]: raise AdoptionError('source_domain_unmapped') + if children is not None: visit(children) + visit(nodes); return nodes + actual=normalize(tree); expected=normalize(parse_nginx(render_standard(declaration))) + if actual==expected: return 'standard' + legacy=get_jinja_env().loader.get_source(get_jinja_env(),'legacy-bootstrap-nginx.conf')[0].encode() + profiles=[legacy] + for enabled in (False,True): profiles.append(render_managed_vpm_config(legacy,enabled)) + forwarding_tree=parse_nginx(render_host_forward_groups(declaration.get('host_forward_groups',[]),legacy_profile=True)) + profile_trees=[] + for profile in profiles: + profile_tree=parse_nginx(profile) + if declaration.get('acme_challenge'): + http=next(children for words,children in profile_tree if words==['http']) + server=next(children for words,children in http if words==['server']) + index=next(i for i,(words,children) in enumerate(server) if words[0]=='location') + server[index:index]=parse_nginx(render_acme_challenge(declaration['acme_challenge'],legacy_profile=True)) + next(children for words,children in profile_tree if words==['http']).extend(deepcopy(forwarding_tree)) + profile_trees.append(profile_tree) + if not declaration.get('hostname_policy') and any(actual==normalize(p) for p in profile_trees): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter'} + if b'location = /vast-pricing' in active: required.add('vast-price-manager') + if not required<=set(declaration['services']) or declaration['tls']!='self-signed': raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-1.2.0' + if declaration.get('hostname_policy')=='primary-only' and declaration.get('http_policy')=='redirect-primary-https' and declaration['tls']=='self-signed' and not declaration.get('acme_challenge'): + guarded=_guarded_bootstrap_profile(legacy,declaration) + if actual==normalize(guarded): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter','vast-price-manager'} + if not required<=set(declaration['services']): raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-primary-only' + supported=[expected]+([normalize(p) for p in profile_trees] if not declaration.get('hostname_policy') else []) + actual_words=list(_walk(actual)); actual_set={tuple(w) for w in actual_words} + closest=min(supported,key=lambda profile:len(actual_set^{tuple(w) for w in _walk(profile)})) + known={tuple(w) for w in _walk(closest)} + mismatch=next((w for w in actual_words if tuple(w) not in known),['structural-order']) + context=_safe(' '.join(mismatch) if mismatch[0]=='location' else mismatch[0]) +> raise AdoptionError('unsupported_source_behavior: '+context+' requires a supported declarative product profile') +E cryptolabs_proxy.standard_adoption.AdoptionError: unsupported_source_behavior: structural-order requires a supported declarative product profile + +src/cryptolabs_proxy/standard_adoption.py:619: AdoptionError +___ test_late_health_failure_restores_files_and_consistent_source_auth[True] ___ + +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9796/test_late_health_failure_resto1') +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c0f3850> +historical = True + + @pytest.mark.parametrize('historical',[False,True]) + def test_late_health_failure_restores_files_and_consistent_source_auth(tmp_path,monkeypatch,historical): + from cryptolabs_proxy.standard_adoption import AdoptionError +> adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) + ^^^^^^^^^^^^^^^^^^^^^^^ + +tests/test_standard_adoption.py:194: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/standard_adoption.py:628: in plan + profile=self._coverage(active,source_declaration) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +active = b'worker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\n\nevents {\n worker_co...ion / {\n root /usr/share/nginx/html;\n try_files $uri $uri/ /index.html;\n }\n }\n\n}' +declaration = {'acme_challenge': None, 'domain': 'fleet.example.test', 'host_forward_groups': [], 'obsolete_overlays': [], ...} + + def _coverage(self,active,declaration): + tree=parse_nginx(active) + # Entire configuration, including every directive and server, must + # match a supported profile. Only explicit server_name is normalized. + def normalize(nodes): + nodes=deepcopy(nodes) + def visit(items): + for words,children in items: + if words[0]=='server_name': + if words[1:]==[declaration['domain']] or words[1:]==['_'] and not declaration.get('hostname_policy'): words[1:]=['DECLARED_DOMAIN'] + elif words[1:] not in [g['hostnames'] for g in declaration.get('host_forward_groups',[])]: raise AdoptionError('source_domain_unmapped') + if children is not None: visit(children) + visit(nodes); return nodes + actual=normalize(tree); expected=normalize(parse_nginx(render_standard(declaration))) + if actual==expected: return 'standard' + legacy=get_jinja_env().loader.get_source(get_jinja_env(),'legacy-bootstrap-nginx.conf')[0].encode() + profiles=[legacy] + for enabled in (False,True): profiles.append(render_managed_vpm_config(legacy,enabled)) + forwarding_tree=parse_nginx(render_host_forward_groups(declaration.get('host_forward_groups',[]),legacy_profile=True)) + profile_trees=[] + for profile in profiles: + profile_tree=parse_nginx(profile) + if declaration.get('acme_challenge'): + http=next(children for words,children in profile_tree if words==['http']) + server=next(children for words,children in http if words==['server']) + index=next(i for i,(words,children) in enumerate(server) if words[0]=='location') + server[index:index]=parse_nginx(render_acme_challenge(declaration['acme_challenge'],legacy_profile=True)) + next(children for words,children in profile_tree if words==['http']).extend(deepcopy(forwarding_tree)) + profile_trees.append(profile_tree) + if not declaration.get('hostname_policy') and any(actual==normalize(p) for p in profile_trees): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter'} + if b'location = /vast-pricing' in active: required.add('vast-price-manager') + if not required<=set(declaration['services']) or declaration['tls']!='self-signed': raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-1.2.0' + if declaration.get('hostname_policy')=='primary-only' and declaration.get('http_policy')=='redirect-primary-https' and declaration['tls']=='self-signed' and not declaration.get('acme_challenge'): + guarded=_guarded_bootstrap_profile(legacy,declaration) + if actual==normalize(guarded): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter','vast-price-manager'} + if not required<=set(declaration['services']): raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-primary-only' + supported=[expected]+([normalize(p) for p in profile_trees] if not declaration.get('hostname_policy') else []) + actual_words=list(_walk(actual)); actual_set={tuple(w) for w in actual_words} + closest=min(supported,key=lambda profile:len(actual_set^{tuple(w) for w in _walk(profile)})) + known={tuple(w) for w in _walk(closest)} + mismatch=next((w for w in actual_words if tuple(w) not in known),['structural-order']) + context=_safe(' '.join(mismatch) if mismatch[0]=='location' else mismatch[0]) +> raise AdoptionError('unsupported_source_behavior: '+context+' requires a supported declarative product profile') +E cryptolabs_proxy.standard_adoption.AdoptionError: unsupported_source_behavior: structural-order requires a supported declarative product profile + +src/cryptolabs_proxy/standard_adoption.py:619: AdoptionError +_ test_selected_image_must_have_normal_auth_module_even_without_overlay[True] __ + +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9796/test_selected_image_must_have_1') +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c0a35b0> +historical = True + + @pytest.mark.parametrize('historical',[False,True]) + def test_selected_image_must_have_normal_auth_module_even_without_overlay(tmp_path,monkeypatch,historical): + from cryptolabs_proxy.standard_adoption import AdoptionError +> adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) + ^^^^^^^^^^^^^^^^^^^^^^^ + +tests/test_standard_adoption.py:489: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/standard_adoption.py:628: in plan + profile=self._coverage(active,source_declaration) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +active = b'worker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\n\nevents {\n worker_co...ion / {\n root /usr/share/nginx/html;\n try_files $uri $uri/ /index.html;\n }\n }\n\n}' +declaration = {'acme_challenge': None, 'domain': 'fleet.example.test', 'host_forward_groups': [], 'obsolete_overlays': [], ...} + + def _coverage(self,active,declaration): + tree=parse_nginx(active) + # Entire configuration, including every directive and server, must + # match a supported profile. Only explicit server_name is normalized. + def normalize(nodes): + nodes=deepcopy(nodes) + def visit(items): + for words,children in items: + if words[0]=='server_name': + if words[1:]==[declaration['domain']] or words[1:]==['_'] and not declaration.get('hostname_policy'): words[1:]=['DECLARED_DOMAIN'] + elif words[1:] not in [g['hostnames'] for g in declaration.get('host_forward_groups',[])]: raise AdoptionError('source_domain_unmapped') + if children is not None: visit(children) + visit(nodes); return nodes + actual=normalize(tree); expected=normalize(parse_nginx(render_standard(declaration))) + if actual==expected: return 'standard' + legacy=get_jinja_env().loader.get_source(get_jinja_env(),'legacy-bootstrap-nginx.conf')[0].encode() + profiles=[legacy] + for enabled in (False,True): profiles.append(render_managed_vpm_config(legacy,enabled)) + forwarding_tree=parse_nginx(render_host_forward_groups(declaration.get('host_forward_groups',[]),legacy_profile=True)) + profile_trees=[] + for profile in profiles: + profile_tree=parse_nginx(profile) + if declaration.get('acme_challenge'): + http=next(children for words,children in profile_tree if words==['http']) + server=next(children for words,children in http if words==['server']) + index=next(i for i,(words,children) in enumerate(server) if words[0]=='location') + server[index:index]=parse_nginx(render_acme_challenge(declaration['acme_challenge'],legacy_profile=True)) + next(children for words,children in profile_tree if words==['http']).extend(deepcopy(forwarding_tree)) + profile_trees.append(profile_tree) + if not declaration.get('hostname_policy') and any(actual==normalize(p) for p in profile_trees): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter'} + if b'location = /vast-pricing' in active: required.add('vast-price-manager') + if not required<=set(declaration['services']) or declaration['tls']!='self-signed': raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-1.2.0' + if declaration.get('hostname_policy')=='primary-only' and declaration.get('http_policy')=='redirect-primary-https' and declaration['tls']=='self-signed' and not declaration.get('acme_challenge'): + guarded=_guarded_bootstrap_profile(legacy,declaration) + if actual==normalize(guarded): + required={'ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter','vast-price-manager'} + if not required<=set(declaration['services']): raise AdoptionError('legacy_services_or_tls_unmapped') + for name in required: + if any(declaration['services'][name][k]!=DEFAULT_SERVICES[name][k] for k in ('container_name','port','path')): raise AdoptionError('legacy_target_unmapped') + return 'released-bootstrap-primary-only' + supported=[expected]+([normalize(p) for p in profile_trees] if not declaration.get('hostname_policy') else []) + actual_words=list(_walk(actual)); actual_set={tuple(w) for w in actual_words} + closest=min(supported,key=lambda profile:len(actual_set^{tuple(w) for w in _walk(profile)})) + known={tuple(w) for w in _walk(closest)} + mismatch=next((w for w in actual_words if tuple(w) not in known),['structural-order']) + context=_safe(' '.join(mismatch) if mismatch[0]=='location' else mismatch[0]) +> raise AdoptionError('unsupported_source_behavior: '+context+' requires a supported declarative product profile') +E cryptolabs_proxy.standard_adoption.AdoptionError: unsupported_source_behavior: structural-order requires a supported declarative product profile + +src/cryptolabs_proxy/standard_adoption.py:619: AdoptionError +=========================== short test summary info ============================ +FAILED tests/test_standard_adoption.py::test_adopt_preflight_denial_stops_nothing[True-source] +FAILED tests/test_standard_adoption.py::test_adopt_preflight_denial_stops_nothing[True-selection] +FAILED tests/test_standard_adoption.py::test_adopt_preserves_private_identity_tls_networks_and_repeat[True] +FAILED tests/test_standard_adoption.py::test_late_health_failure_restores_files_and_consistent_source_auth[True] +FAILED tests/test_standard_adoption.py::test_selected_image_must_have_normal_auth_module_even_without_overlay[True] +5 failed, 58 passed in 4.24s diff --git a/.traceweaver/updater-stop-20261104/compatibility/root-precode-review.json b/.traceweaver/updater-stop-20261104/compatibility/root-precode-review.json new file mode 100644 index 0000000..3ad6d5c --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/root-precode-review.json @@ -0,0 +1,19 @@ +{ + "id": "ROOT-COMPATIBILITY-PRECODE-20261104", + "recorded_at": "2026-11-04T07:40:29.564716+00:00", + "monotonic": 1309002.604981666, + "reviewer": "root orchestrator; did not author tests or production", + "decision": "definition passed; allow exact approved compatibility implementation; operational acceptance held", + "reviewed": [ + "owner-approvedaddendumrevision2 +explicitprovisioningexception", + "REQ003indexmapsunchangedapprovedcontrol", + "exactnewtestdiff (5 historicalpositive/guard/recovery variants +6strictnegativecases, no removedassertions/skips)", + "independent8blobrenderprovenance; matchingretainedreleasebytes", + "genuine5RED/58pass unsupportedstructuralprofile, original4files/standard_adoption unchanged", + "validationplanrequirespackagedowner/realDockeradoption+negativeauth+rollback beforehostprovision" + ], + "test_sha256": "3293193e8f01cdea4913c92caee92f7c0536c080260445001169acee05d88e22", + "fixture_sha256": "f1aa7a0ed767e7432dd21123fc0086e0cc98e0b26ad3c95eff5fe233095e3e72", + "must_preserve": "strict complete orderedtree,currentcandidate/accounts,authhash/drift/recoveryguards,originalfourreviewedfilehashes", + "generated_resource_anchor_exception": "Historical8templates + fixture are exact immutable released/synthetic rawdata; inlineanchors wouldinvalidatepins. Use external per-file matrix/provenance mapping, no contentannotation. ProductionPython/testcode gets packagedpairedanchors." +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/validation-plan.json b/.traceweaver/updater-stop-20261104/compatibility/validation-plan.json new file mode 100644 index 0000000..4e2cd98 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/validation-plan.json @@ -0,0 +1,60 @@ +{ + "skill_name": "validation-planner", + "decision": "held", + "authority_status": "ownerapprovedaddendumrevision2", + "hold_conditions": [ + "newvalidationdefinitionreview pending", + "actualpackagedowner/Dockeradoption unexecuted", + "hostpackageinputsandnativeplan notfrozen" + ], + "validation_plan": { + "plan_id": "VAL-UPDATER-003", + "need_ids": [ + "approved-addendum.html:live1.5.4compatibilityblocker" + ], + "owner": "root under ownerexplicitapproval; independent verifier judges intendedoperation", + "intended_use": "Upgrade onlyLTXProxy through compatibleofficialhostowner without weakeningauth/fullconfigguard, then alreadyapprovedsingleIPMIretry", + "operating_context": "Independentlyreviewedpatchrelease; separateversionedhostvenv usingexactofficialwheel with frozenURLs/hashes/dependencyinputs; existinghostenvironment/globalCLI untouched", + "success_criteria": [ + "Independent offline installedofficialowner accepts synthetic exacthistoricalfixture and currentcandidate keepsaccount-link/auth. Historicalclosure hash/resource proof matches releasecommit.", + "Disposable Linux Docker adoption observes realold\u2192newcontainer/authmoduleidentity and preservedusers/sessions/keys/mounts/network/TLS/history; negativeauth rejects beforestop; deliberatecandidatehealthfailure demonstratescompensated recovery with retained private evidence.", + "Before production root freezesofficialpackageURLs/checksums/dependencyinputs and freshnativeplan identity, retains oldhostvenv and originaldeclaration/snapshots, then invokesofficialnativeowner only.", + "LTXonly:healthyexactreleasedProxy/updater/auth installed; browserauth and unrelated8componentpins unchanged. Onlythen singleIPMIretry, currenthistorybaseline/collection/warningUI acceptance. Anyambiguityholds, no blind replay." + ] + }, + "stakeholder_or_rater_profile": { + "name_or_role": "Independent verifier plus root owner-delegatedoperator; ownerHannesZietsman acceptanceauthority", + "relationship_to_work": "Verifierfreshcontext, notcompatibility implementer", + "independence_note": "Preparationworker cannot selfaccept operationaloutcomes", + "representative_reason": "Exercises exact officialowner operation in isolateddaemon before fixed LTXroute" + }, + "validation_scenario_matrix": [ + { + "scenario_id": "VAL-UPDATER-003-PACKAGE", + "scenario": "Installedofficialpackage offline exacthistorical source\u2192currentcandidate", + "acceptance_signal": "Exacthistoricalprofile; candidatecurrentrender/accountlink; closure/sourcebyteproof", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/future-packaged-owner-proof.json", + "status": "planned" + }, + { + "scenario_id": "VAL-UPDATER-003-DOCKER", + "scenario": "Actualhistoricaladoption, negativeauth denial, compensatedrecovery, preserveddata", + "acceptance_signal": "Freshverifier observes correctold/newIDs andauth/state; failureholdswithprovenrecovery", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/future-disposable-adoption-proof.json", + "status": "planned" + }, + { + "scenario_id": "VAL-UPDATER-003-LTX", + "scenario": "Boundedofficialhostvenv+freshnativeadopt; onealreadyapprovedretry afteracceptance", + "acceptance_signal": "Exactinstalledsource/auth/updater, browserhealth,pins/history preserved; nosecondattempt", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/future-ltx-acceptance.json", + "status": "planned" + } + ], + "adoption_evidence_record": { + "record_id": "VAL-UPDATER-003-PENDING", + "result": "blocked", + "rater_or_source": "notexecuted", + "deferred_trigger": null + } +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/verification-plan.json b/.traceweaver/updater-stop-20261104/compatibility/verification-plan.json new file mode 100644 index 0000000..392e055 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/verification-plan.json @@ -0,0 +1,61 @@ +{ + "skill_name": "verification-planner", + "authority_status": "REQ-UPDATER-003 existing approved addendum revision2; no new requirements", + "baseline_reference": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d plus reviewed unchanged originalrepair4files", + "decision": "held", + "hold_conditions": [ + "independent newtest/definition review pending", + "compatibility implementation intentionally absent" + ], + "verification_plan": { + "plan_id": "VER-UPDATER-003", + "requirement_ids": [ + "REQ-UPDATER-003" + ], + "method": "test", + "owner": "root; currentworker only test preparation", + "target_environment": "local source Python; later exact official wheel/container and disposable Linux Docker", + "tested_ref_required": true, + "success_criteria": [ + "Historical frozen synthetic1.5.4 bytes accepted as explicitly named released-standard-1.5.4; current source retains standard precedence.", + "Actual plan/adopt through reused existing happy test preserves identity/auth/mounts/TLS/networks and repeat semantics; candidate bytes exactly current normalized render; account-link route retained.", + "Six changed historical fulltree cases denied before mutation: directive, upstream, missingauth, extraserver, extraroute, complete regexrouteblockorder swap.", + "Historical auth mismatch and source/selection drift refuse before stop; historical healthfailure restores registry/auth/files via unchanged recovery assertions.", + "Immutable package closure exactly8tag blobs:rootf12e2b98\u2026 plus7includes; provenance hashes independently checked and references resolve onlyinsideclosure. No fallback to mutable currentincludes. Runtime hash mismatch must failclosed.", + "Wheel/sdist/installed image include all historical resources and exact reviewed auth/updater/compat source; source to package offline historical acceptance matches localtests.", + "Retain all originalstoprepair tests and full15.25sACK proof; fullregression and protectedCI retain existing safety gates." + ] + }, + "verification_cross_reference_matrix": [ + { + "requirement_id": "REQ-UPDATER-003", + "method": "test", + "procedure_ref": "PYTHONPATH=src python3 -m pytest tests/test_standard_adoption.py -q", + "expected_result": "63passed on repaired compatibility source; before implementation5fail/58pass", + "evidence_required": [ + "red.log", + "historical-fixture-proof.json", + "futuregreen.log", + "packaged-resource-hashproof.json", + "disposable-adoption-proof.json" + ], + "harness_equivalence": "Frozen synthetic fixture rendered by separate Jinja Environment/DictLoader from exact8git-tag blobs (all compared archivedreleased154), not candidate renderer or future compatibility helper. Actual production plan/adopt/recovery execute with existing Engine boundary; no daemon/startup equivalence claimed." + } + ], + "execution_record_template": { + "execution_id": "VER-UPDATER-003-GREEN", + "procedure_or_command": "PYTHONPATH=src python3 -m pytest tests/test_standard_adoption.py -q", + "tested_ref": "exact futurecompatibility source/package hash required", + "expected_result": "63passed", + "actual_result": "5failed/58passed4.24s beforeproductionimplementation", + "outcome": "fail", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/red.log" + }, + "baseline": { + "command": "PYTHONPATH=src python3 -m pytest tests/test_standard_adoption.py -q", + "status": 0, + "result": "52passed3.55s", + "log": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/baseline.log" + }, + "lean_test_value": "11addedcases:5historicalreusesofexistinghappy/recovery/auth/source/selection assertions,6fulltreenegatives. Existing52cases retained, no new duplicateintegrationstack or skips. Historicalnegative cases currently pass because alloldconfigisrefused; their positivecounterpartfailsRED, then GREEN must admit onlyexacthistory." +} diff --git a/.traceweaver/updater-stop-20261104/compatibility/vv-capsule.json b/.traceweaver/updater-stop-20261104/compatibility/vv-capsule.json new file mode 100644 index 0000000..c9f4516 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/compatibility/vv-capsule.json @@ -0,0 +1,38 @@ +{ + "schema_version": "tw-vv-capsule/1", + "work_item_id": "UPDATER-COMPATIBILITY-20261104", + "workflow_profile": "L3", + "plan_ref": ".traceweaver/updater-stop-20261104/compatibility/approved-addendum.html", + "authority_ref": ".traceweaver/updater-stop-20261104/compatibility/authority.json", + "profile_ref": ".traceweaver/updater-stop-20261104/workflow-profile.json", + "high_risk_controls": { + "rollback": "Existing recovery/auth/source/selection guards unchanged; prove actual disposable adoption/compensation before hostmutation; retain oldhostvenv and originalsnapshot; ambiguityholdswithoutreplay.", + "owner_decision": "Explicitownerapprovedaddendumrevision2; root independentprecode review now permits exacthistoricalprofile production implementation; no hostmutation until packaged/staged/protectedrelease gates. ONE LTXIPMIretry remainsunconsumed." + }, + "requirements": [ + { + "req_id": "REQ-UPDATER-003", + "trace_id": "TRACE-UPDATER-003", + "ver_id": "VER-UPDATER-003", + "val_id": "VAL-UPDATER-003", + "verification_artifact": "tests/test_standard_adoption.py", + "red_evidence": ".traceweaver/updater-stop-20261104/compatibility/red.log", + "validation_artifact": ".traceweaver/updater-stop-20261104/compatibility/validation-plan.json", + "matrix_row_ref": "traceability-matrix.md:TRACE-UPDATER-003", + "reviews": [ + { + "gate": "tw-code-review", + "id": "ROOT-COMPATIBILITY-PRECODE-20261104", + "status": "passed", + "evidence_path": ".traceweaver/updater-stop-20261104/compatibility/root-precode-review.json" + }, + { + "gate": "tw-doc-review", + "id": "ROOT-COMPATIBILITY-PRECODE-20261104", + "status": "passed", + "evidence_path": ".traceweaver/updater-stop-20261104/compatibility/root-precode-review.json" + } + ] + } + ] +} diff --git a/.traceweaver/updater-stop-20261104/handoff.json b/.traceweaver/updater-stop-20261104/handoff.json new file mode 100644 index 0000000..1c9ee32 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/handoff.json @@ -0,0 +1,48 @@ +{ + "phase": "RED definition only; awaiting independent V&V/mapping review", + "allowed_next_production_files": [ + "src/cryptolabs_proxy/migration.py", + "src/cryptolabs_proxy/updates.py" + ], + "exact_next_behavior": [ + "Introduce STOP_ACK_HEADROOM=15 seconds and request-scoped timeout override for stop only; grace remains max(1,engine.timeout-2), default13; budget grace+headroom default28. Nondefault callers retain preexisting grace formula.", + "Forward override through UpdateEngine._request without losing v1.45 prefix; existing _request callers/test doubles without timeout remain compatible by forwarding timeout only when explicitly supplied. Never mutate engine.timeout.", + "Capture allowlisted failure phase immediately before each mutation; classify only known wrapped cause without text/classname/args/traceback serialization, unknown fixed generic.", + "Freeze failure_phase/failure_category before recovery; recovery_phase/recovery_category distinct only if recovery fails; diagnostics cannot interrupt recovery; preserve existing success/state/message and guard behavior.", + "Rerun authored tests unchanged for GREEN; full-default proof and disposable Docker staging before production; use packaged anchors + matrix helper during production work." + ], + "new_test_api": { + "constant": "migration.STOP_ACK_HEADROOM", + "primary": [ + "failure_phase", + "failure_category" + ], + "recovery": [ + "recovery_phase", + "recovery_category" + ], + "observed_values": [ + "stop", + "disconnect", + "start", + "timeout", + "os_error", + "unknown" + ] + }, + "preserve": [ + "all46 preexisting test scenarios", + "no new skips/dependency changes", + "existing rollback/identity/policy/native guards" + ], + "prerequisites": [ + "verify scoped indexing of approved plan clauses", + "independent review exact tests and validation definition; stamp capsule with actual passed evidence", + "checker --require-review-passed exit0", + "root harness freeze profile and record monotonic role receipts before production builder dispatch" + ], + "commands_ref": ".traceweaver/updater-stop-20261104/verification-plan.json", + "root_authority_files": "unchanged (unrelated account-pairing scope retained)", + "staging_gate": "Historical definition in staging-procedure.json; one-off runner retained under external run artifacts/updater-red-definition. Actual independent proof artifacts/updater-independent-validation/acceptance.json.", + "historical_exception_claim": "Timeout strongly supported by incident timing and local source reproduction; historical discarded exception remains unproven." +} diff --git a/.traceweaver/updater-stop-20261104/intent-scope.json b/.traceweaver/updater-stop-20261104/intent-scope.json new file mode 100644 index 0000000..02cb3c1 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/intent-scope.json @@ -0,0 +1,18 @@ +{ + "intent_contract_id": "UPDATER-STOP-20261104", + "traceweaver_mode": "advisory", + "scope_authority": ".traceweaver/updater-stop-20261104/authority.json", + "root_intent_preserved": ".traceweaver/intent-contract.yml", + "must_not_change": [ + "13s default Docker grace", + "non-stop socket timeouts", + "readiness deadlines", + "identity/selection/controller guards", + "unreleased Fleet branch", + "CI/dependencies", + "BMC policy", + "Charlotte" + ], + "publication": "not authorized for this worker", + "runtime_acceptance": "held" +} diff --git a/.traceweaver/updater-stop-20261104/matrix-proposal.md b/.traceweaver/updater-stop-20261104/matrix-proposal.md new file mode 100644 index 0000000..5a03fef --- /dev/null +++ b/.traceweaver/updater-stop-20261104/matrix-proposal.md @@ -0,0 +1,19 @@ +# Scoped updater matrix proposal (not applied to unrelated pairing authority) + +These IDs label unchanged owner-approved plan clauses; they do not introduce new requirements. Root must verify the mapping before production builder dispatch. + +| Trace | Approved source/control | Implementation | Verification | Validation | State | +| --- | --- | --- | --- | --- | --- | +| TRACE-UPDATER-001 | REQ-UPDATER-001, approved plan clause 1 + reviewed amendments 1/5 | migration.py DockerEngine._request/stop; updates.py UpdateEngine._request timeout forwarding | VER-UPDATER-001, real socket regression + full default proof | VAL-UPDATER-001, disposable Docker and installed updater identity before retry | Actual pre-fix RED; no production edit | +| TRACE-UPDATER-002 | REQ-UPDATER-002, approved plan clause 1 + reviewed amendments 2/3/4 | updates.py replace_container safe phase/category capture | VER-UPDATER-002, actual run_job persistence and recovery cases | VAL-UPDATER-002, retained safe failure/recovery evidence in staging and intended workflow | Actual pre-fix RED; no production edit | + +## Proposed Code Anchor Evidence + +| Artifact Path | Requirement | Trace | Verification | Anchor Type | Role | +| --- | --- | --- | --- | --- | --- | +| src/cryptolabs_proxy/migration.py | REQ-UPDATER-001 | TRACE-UPDATER-001 | VER-UPDATER-001 | file-role | bounded-docker-stop-transport | +| src/cryptolabs_proxy/updates.py | REQ-UPDATER-002 | TRACE-UPDATER-002 | VER-UPDATER-002 | file-role | safe-update-recovery-diagnostics | +| tests/test_updates.py | REQ-UPDATER-002 | TRACE-UPDATER-002 | VER-UPDATER-002 | verifies | persisted-updater-failure-contract | +| tests/test_proxy_lifecycle_review_repairs.py | REQ-UPDATER-001 | TRACE-UPDATER-001 | VER-UPDATER-001 | verifies | real-stop-socket-deadline | + +No source anchors authored during RED definition. tw-work must use the packaged anchor helper with these unambiguous approved-clause mappings, write source + matching matrix evidence together, then rerun its scoped scanner. Existing root authority is preserved; orchestrator chooses scoped merge before builder. diff --git a/.traceweaver/updater-stop-20261104/owner-approval.json b/.traceweaver/updater-stop-20261104/owner-approval.json new file mode 100644 index 0000000..7e46c04 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/owner-approval.json @@ -0,0 +1,14 @@ +{ + "schema": "owner-approval/1", + "approved_at_recorded": "2026-11-04T07:08:42.723662+00:00", + "literal_user_approval": "Approve the [reviewed updater repair plan](/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/updater-repair-plan.html) and one LTX retry", + "plan_sha256": "5c48796eff976c9e614887931087494687d3626f5780d4db0acf28b7f2299342", + "scope": "bounded Proxy repair, reviewed patch publication, fixed host-route Proxy update and one scoped LTX IPMI retry", + "backup_waiver_continues": true, + "ssh_route_continues": true, + "excluded": [ + "Charlotte deployment", + "BMC mutation or qualification", + "unreleased Fleet dev changes" + ] +} diff --git a/.traceweaver/updater-stop-20261104/pre-mutation-identity.json b/.traceweaver/updater-stop-20261104/pre-mutation-identity.json new file mode 100644 index 0000000..fe54c1d --- /dev/null +++ b/.traceweaver/updater-stop-20261104/pre-mutation-identity.json @@ -0,0 +1,11 @@ +{ + "recorded_utc": "2026-11-04T07:11:20.992301+00:00", + "production_files": { + "src/cryptolabs_proxy/migration.py": "649c431bbab334d4f5f4f53a4282e484d8c1f40f45c4c32ef57b1c34fbe34a62", + "src/cryptolabs_proxy/updates.py": "093eefd1a6727ea05050aef46a8332fba269dbb77bf061dc5172cb4515184389" + }, + "approval_hash_verified": true, + "profile_hash": "sha256:4e9f51a20e27e6d5e2c6654b2ee7564289377b29bb20ecc6e49c28942d79dc84", + "authority_hash": "478054d960a0aa6d25a8e2f8af43d067f91128e6513c95142411df049e543af4", + "meaning": "Recorded before RED test edits and before any production edit; no production mutation authorized in preparation phase." +} diff --git a/.traceweaver/updater-stop-20261104/production-dispatch-precondition.json b/.traceweaver/updater-stop-20261104/production-dispatch-precondition.json new file mode 100644 index 0000000..c4c11f9 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/production-dispatch-precondition.json @@ -0,0 +1,14 @@ +{ + "recorded_at": "2026-11-04T07:20:00.497212+00:00", + "monotonic": 1307773.580649791, + "owner_approval": ".traceweaver/updater-stop-20261104/owner-approval.json", + "root_review": ".traceweaver/updater-stop-20261104/root-precode-review.json", + "profile_revision": 2, + "profile_hash": "sha256:aaa66c2aad99a1e23e58e7112872f82b918eb1534edd68b102022a0c7f05d2eb", + "production_files": [ + "src/cryptolabs_proxy/migration.py", + "src/cryptolabs_proxy/updates.py" + ], + "compatibility_scope": "held pending new owner approval", + "prior_preparation_monotonic_receipts": "not captured by root; walltime/raw test duration retained, no invented monotonic proof" +} diff --git a/.traceweaver/updater-stop-20261104/red-full-duration.json b/.traceweaver/updater-stop-20261104/red-full-duration.json new file mode 100644 index 0000000..ebbe257 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/red-full-duration.json @@ -0,0 +1,18 @@ +{ + "command": [ + "/opt/homebrew/opt/python@3.14/bin/python3.14", + "-m", + "pytest", + "tests/test_proxy_lifecycle_review_repairs.py::test_stop_delayed_ack_uses_headroom_without_changing_grace", + "-q" + ], + "cwd": "/Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104", + "PYTHONPATH": "src", + "UPDATER_FULL_DURATION": "1", + "status": 1, + "elapsed_seconds": 15.533983041997999, + "python": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]", + "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "revision": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d", + "log": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-red-definition/red-full-duration.log" +} diff --git a/.traceweaver/updater-stop-20261104/red-full-duration.log b/.traceweaver/updater-stop-20261104/red-full-duration.log new file mode 100644 index 0000000..5e61395 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/red-full-duration.log @@ -0,0 +1,95 @@ +F [100%] +=================================== FAILURES =================================== +__________ test_stop_delayed_ack_uses_headroom_without_changing_grace __________ + +self = +method = 'POST', path = '/v1.45/containers/service%2Fname/stop?t=13' +payload = None, allowed = (204, 304) + + def _request(self, method: str, path: str, payload: dict | None = None, allowed=(200, 201, 204)): + connection = _UnixHTTPConnection(self.socket_path, self.timeout) + body = json.dumps(payload).encode() if payload is not None else None + headers = {"Content-Type": "application/json"} if body else {} + try: + connection.request(method, path, body=body, headers=headers) +> response = connection.getresponse() + ^^^^^^^^^^^^^^^^^^^^^^^^ + +src/cryptolabs_proxy/migration.py:304: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/http/client.py:1459: in getresponse + response.begin() +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/http/client.py:336: in begin + version, status, reason = self._read_status() + ^^^^^^^^^^^^^^^^^^^ +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/http/client.py:297: in _read_status + line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = , b = + + def readinto(self, b): + """Read up to len(b) bytes into the writable buffer *b* and return + the number of bytes read. If the socket is non-blocking and no bytes + are available, None is returned. + + If *b* is non-empty, a 0 return value indicates that the connection + was shutdown at the other end. + """ + self._checkClosed() + self._checkReadable() + if self._timeout_occurred: + raise OSError("cannot read from timed out object") + try: +> return self._sock.recv_into(b) + ^^^^^^^^^^^^^^^^^^^^^^^ +E TimeoutError: timed out + +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/socket.py:729: TimeoutError + +The above exception was the direct cause of the following exception: + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10cf8c2b0> + + def test_stop_delayed_ack_uses_headroom_without_changing_grace(monkeypatch): + """Short regression; opt in to the same default-15s path for release proof.""" + from cryptolabs_proxy import migration + full_duration = os.environ.get('UPDATER_FULL_DURATION') == '1' + transport = 15 if full_duration else .2 + delay = 15.25 if full_duration else .6 + if not full_duration: + monkeypatch.setattr(migration, 'STOP_ACK_HEADROOM', .35, raising=False) + with delayed_stop_socket(delay) as (socket_path, requests): + engine = updates.UpdateEngine(socket_path=socket_path, timeout=transport) +> engine.stop('service/name') + +tests/test_proxy_lifecycle_review_repairs.py:75: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/migration.py:324: in stop + self._request("POST", f"/containers/{quote(container, safe='')}/stop?t={grace}", allowed=allowed) +src/cryptolabs_proxy/updates.py:107: in _request + return super()._request(method, path, payload, allowed) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +method = 'POST', path = '/v1.45/containers/service%2Fname/stop?t=13' +payload = None, allowed = (204, 304) + + def _request(self, method: str, path: str, payload: dict | None = None, allowed=(200, 201, 204)): + connection = _UnixHTTPConnection(self.socket_path, self.timeout) + body = json.dumps(payload).encode() if payload is not None else None + headers = {"Content-Type": "application/json"} if body else {} + try: + connection.request(method, path, body=body, headers=headers) + response = connection.getresponse() + content = response.read() + except OSError as error: +> raise MigrationError(f"Docker Engine request failed: {error}") from error +E cryptolabs_proxy.migration.MigrationError: Docker Engine request failed: timed out + +src/cryptolabs_proxy/migration.py:307: MigrationError +=========================== short test summary info ============================ +FAILED tests/test_proxy_lifecycle_review_repairs.py::test_stop_delayed_ack_uses_headroom_without_changing_grace +1 failed in 15.12s diff --git a/.traceweaver/updater-stop-20261104/red-unsandboxed.json b/.traceweaver/updater-stop-20261104/red-unsandboxed.json new file mode 100644 index 0000000..cdbceef --- /dev/null +++ b/.traceweaver/updater-stop-20261104/red-unsandboxed.json @@ -0,0 +1,19 @@ +{ + "command": [ + "/opt/homebrew/opt/python@3.14/bin/python3.14", + "-m", + "pytest", + "tests/test_updates.py", + "tests/test_proxy_lifecycle_review_repairs.py", + "-q" + ], + "cwd": "/Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104", + "PYTHONPATH": "src", + "UPDATER_FULL_DURATION": null, + "status": 1, + "elapsed_seconds": 5.165588374948129, + "python": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]", + "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "revision": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d", + "log": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-red-definition/red-unsandboxed.log" +} diff --git a/.traceweaver/updater-stop-20261104/red-unsandboxed.log b/.traceweaver/updater-stop-20261104/red-unsandboxed.log new file mode 100644 index 0000000..518df99 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/red-unsandboxed.log @@ -0,0 +1,387 @@ +..........FFFF.................FF.................... [100%] +=================================== FAILURES =================================== +_ test_worker_persists_safe_primary_and_recovery_diagnostics[stop-timeout-False] _ + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x1098373f0> +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9766/test_worker_persists_safe_prim0') +phase = 'stop', category = 'timeout', recovery_fails = False + + @pytest.mark.parametrize('phase,category,recovery_fails', [ + ('stop', 'timeout', False), + ('disconnect', 'os_error', False), + ('stop', 'unknown', False), + ('stop', 'timeout', True), + ]) + def test_worker_persists_safe_primary_and_recovery_diagnostics( + monkeypatch, tmp_path, phase, category, recovery_fails): + """An ambiguous failed stop needs safe phase/cause evidence after recovery. + + Reuse the worker's actual persistence path, rather than serializing a + hand-built result. The source may already be stopped when its ACK fails. + """ + secret = 'synthetic-credential-must-never-be-recorded' + + class PrivateFailure(RuntimeError): + def __str__(self): + raise AssertionError('diagnostics must not format unknown exceptions') + + class FailingEngine(Engine): + def fail(self): + if category == 'unknown': + raise PrivateFailure(secret) + cause = TimeoutError(secret) if category == 'timeout' else OSError(secret) + raise updates.MigrationError(secret) from cause + + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + if phase == 'stop': + self.fail() + + def disconnect(self, name, network): + super().disconnect(name, network) + if phase == 'disconnect': + self.fail() + + def start(self, name): + if recovery_fails: + raise OSError(secret) + super().start(name) + + engine = FailingEngine() + monkeypatch.setattr(updates, 'pull_target', lambda target: True) + job = {'id': 'e' * 32, 'service': 'prometheus', 'branch': 'main', 'action': 'update'} + updates.write_job(tmp_path, job) + returned = updates.run_job(tmp_path, job['id'], engine=engine) + stored = updates.read_job(tmp_path, job['id']) + assert stored == returned + result = stored['results']['prometheus'] + assert result['state'] == ('recovery_required' if recovery_fails else 'rolled_back') + assert result['success'] is False +> assert result['failure_phase'] == phase + ^^^^^^^^^^^^^^^^^^^^^^^ +E KeyError: 'failure_phase' + +tests/test_updates.py:202: KeyError +_ test_worker_persists_safe_primary_and_recovery_diagnostics[disconnect-os_error-False] _ + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x109777d40> +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9766/test_worker_persists_safe_prim1') +phase = 'disconnect', category = 'os_error', recovery_fails = False + + @pytest.mark.parametrize('phase,category,recovery_fails', [ + ('stop', 'timeout', False), + ('disconnect', 'os_error', False), + ('stop', 'unknown', False), + ('stop', 'timeout', True), + ]) + def test_worker_persists_safe_primary_and_recovery_diagnostics( + monkeypatch, tmp_path, phase, category, recovery_fails): + """An ambiguous failed stop needs safe phase/cause evidence after recovery. + + Reuse the worker's actual persistence path, rather than serializing a + hand-built result. The source may already be stopped when its ACK fails. + """ + secret = 'synthetic-credential-must-never-be-recorded' + + class PrivateFailure(RuntimeError): + def __str__(self): + raise AssertionError('diagnostics must not format unknown exceptions') + + class FailingEngine(Engine): + def fail(self): + if category == 'unknown': + raise PrivateFailure(secret) + cause = TimeoutError(secret) if category == 'timeout' else OSError(secret) + raise updates.MigrationError(secret) from cause + + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + if phase == 'stop': + self.fail() + + def disconnect(self, name, network): + super().disconnect(name, network) + if phase == 'disconnect': + self.fail() + + def start(self, name): + if recovery_fails: + raise OSError(secret) + super().start(name) + + engine = FailingEngine() + monkeypatch.setattr(updates, 'pull_target', lambda target: True) + job = {'id': 'e' * 32, 'service': 'prometheus', 'branch': 'main', 'action': 'update'} + updates.write_job(tmp_path, job) + returned = updates.run_job(tmp_path, job['id'], engine=engine) + stored = updates.read_job(tmp_path, job['id']) + assert stored == returned + result = stored['results']['prometheus'] + assert result['state'] == ('recovery_required' if recovery_fails else 'rolled_back') + assert result['success'] is False +> assert result['failure_phase'] == phase + ^^^^^^^^^^^^^^^^^^^^^^^ +E KeyError: 'failure_phase' + +tests/test_updates.py:202: KeyError +_ test_worker_persists_safe_primary_and_recovery_diagnostics[stop-unknown-False] _ + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x1098a4590> +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9766/test_worker_persists_safe_prim2') +phase = 'stop', category = 'unknown', recovery_fails = False + + @pytest.mark.parametrize('phase,category,recovery_fails', [ + ('stop', 'timeout', False), + ('disconnect', 'os_error', False), + ('stop', 'unknown', False), + ('stop', 'timeout', True), + ]) + def test_worker_persists_safe_primary_and_recovery_diagnostics( + monkeypatch, tmp_path, phase, category, recovery_fails): + """An ambiguous failed stop needs safe phase/cause evidence after recovery. + + Reuse the worker's actual persistence path, rather than serializing a + hand-built result. The source may already be stopped when its ACK fails. + """ + secret = 'synthetic-credential-must-never-be-recorded' + + class PrivateFailure(RuntimeError): + def __str__(self): + raise AssertionError('diagnostics must not format unknown exceptions') + + class FailingEngine(Engine): + def fail(self): + if category == 'unknown': + raise PrivateFailure(secret) + cause = TimeoutError(secret) if category == 'timeout' else OSError(secret) + raise updates.MigrationError(secret) from cause + + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + if phase == 'stop': + self.fail() + + def disconnect(self, name, network): + super().disconnect(name, network) + if phase == 'disconnect': + self.fail() + + def start(self, name): + if recovery_fails: + raise OSError(secret) + super().start(name) + + engine = FailingEngine() + monkeypatch.setattr(updates, 'pull_target', lambda target: True) + job = {'id': 'e' * 32, 'service': 'prometheus', 'branch': 'main', 'action': 'update'} + updates.write_job(tmp_path, job) + returned = updates.run_job(tmp_path, job['id'], engine=engine) + stored = updates.read_job(tmp_path, job['id']) + assert stored == returned + result = stored['results']['prometheus'] + assert result['state'] == ('recovery_required' if recovery_fails else 'rolled_back') + assert result['success'] is False +> assert result['failure_phase'] == phase + ^^^^^^^^^^^^^^^^^^^^^^^ +E KeyError: 'failure_phase' + +tests/test_updates.py:202: KeyError +_ test_worker_persists_safe_primary_and_recovery_diagnostics[stop-timeout-True] _ + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x109805790> +tmp_path = PosixPath('/private/var/folders/2f/ntb_0p9558v4wfcwr5_64dg00000gn/T/pytest-of-hanneszietsman/pytest-9766/test_worker_persists_safe_prim3') +phase = 'stop', category = 'timeout', recovery_fails = True + + @pytest.mark.parametrize('phase,category,recovery_fails', [ + ('stop', 'timeout', False), + ('disconnect', 'os_error', False), + ('stop', 'unknown', False), + ('stop', 'timeout', True), + ]) + def test_worker_persists_safe_primary_and_recovery_diagnostics( + monkeypatch, tmp_path, phase, category, recovery_fails): + """An ambiguous failed stop needs safe phase/cause evidence after recovery. + + Reuse the worker's actual persistence path, rather than serializing a + hand-built result. The source may already be stopped when its ACK fails. + """ + secret = 'synthetic-credential-must-never-be-recorded' + + class PrivateFailure(RuntimeError): + def __str__(self): + raise AssertionError('diagnostics must not format unknown exceptions') + + class FailingEngine(Engine): + def fail(self): + if category == 'unknown': + raise PrivateFailure(secret) + cause = TimeoutError(secret) if category == 'timeout' else OSError(secret) + raise updates.MigrationError(secret) from cause + + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + if phase == 'stop': + self.fail() + + def disconnect(self, name, network): + super().disconnect(name, network) + if phase == 'disconnect': + self.fail() + + def start(self, name): + if recovery_fails: + raise OSError(secret) + super().start(name) + + engine = FailingEngine() + monkeypatch.setattr(updates, 'pull_target', lambda target: True) + job = {'id': 'e' * 32, 'service': 'prometheus', 'branch': 'main', 'action': 'update'} + updates.write_job(tmp_path, job) + returned = updates.run_job(tmp_path, job['id'], engine=engine) + stored = updates.read_job(tmp_path, job['id']) + assert stored == returned + result = stored['results']['prometheus'] + assert result['state'] == ('recovery_required' if recovery_fails else 'rolled_back') + assert result['success'] is False +> assert result['failure_phase'] == phase + ^^^^^^^^^^^^^^^^^^^^^^^ +E KeyError: 'failure_phase' + +tests/test_updates.py:202: KeyError +__________ test_stop_delayed_ack_uses_headroom_without_changing_grace __________ + +self = +method = 'POST', path = '/v1.45/containers/service%2Fname/stop?t=1' +payload = None, allowed = (204, 304) + + def _request(self, method: str, path: str, payload: dict | None = None, allowed=(200, 201, 204)): + connection = _UnixHTTPConnection(self.socket_path, self.timeout) + body = json.dumps(payload).encode() if payload is not None else None + headers = {"Content-Type": "application/json"} if body else {} + try: + connection.request(method, path, body=body, headers=headers) +> response = connection.getresponse() + ^^^^^^^^^^^^^^^^^^^^^^^^ + +src/cryptolabs_proxy/migration.py:304: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/http/client.py:1459: in getresponse + response.begin() +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/http/client.py:336: in begin + version, status, reason = self._read_status() + ^^^^^^^^^^^^^^^^^^^ +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/http/client.py:297: in _read_status + line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = , b = + + def readinto(self, b): + """Read up to len(b) bytes into the writable buffer *b* and return + the number of bytes read. If the socket is non-blocking and no bytes + are available, None is returned. + + If *b* is non-empty, a 0 return value indicates that the connection + was shutdown at the other end. + """ + self._checkClosed() + self._checkReadable() + if self._timeout_occurred: + raise OSError("cannot read from timed out object") + try: +> return self._sock.recv_into(b) + ^^^^^^^^^^^^^^^^^^^^^^^ +E TimeoutError: timed out + +/opt/homebrew/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/socket.py:729: TimeoutError + +The above exception was the direct cause of the following exception: + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x1098afe70> + + def test_stop_delayed_ack_uses_headroom_without_changing_grace(monkeypatch): + """Short regression; opt in to the same default-15s path for release proof.""" + from cryptolabs_proxy import migration + full_duration = os.environ.get('UPDATER_FULL_DURATION') == '1' + transport = 15 if full_duration else .2 + delay = 15.25 if full_duration else .6 + if not full_duration: + monkeypatch.setattr(migration, 'STOP_ACK_HEADROOM', .35, raising=False) + with delayed_stop_socket(delay) as (socket_path, requests): + engine = updates.UpdateEngine(socket_path=socket_path, timeout=transport) +> engine.stop('service/name') + +tests/test_proxy_lifecycle_review_repairs.py:75: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +src/cryptolabs_proxy/migration.py:324: in stop + self._request("POST", f"/containers/{quote(container, safe='')}/stop?t={grace}", allowed=allowed) +src/cryptolabs_proxy/updates.py:107: in _request + return super()._request(method, path, payload, allowed) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +method = 'POST', path = '/v1.45/containers/service%2Fname/stop?t=1' +payload = None, allowed = (204, 304) + + def _request(self, method: str, path: str, payload: dict | None = None, allowed=(200, 201, 204)): + connection = _UnixHTTPConnection(self.socket_path, self.timeout) + body = json.dumps(payload).encode() if payload is not None else None + headers = {"Content-Type": "application/json"} if body else {} + try: + connection.request(method, path, body=body, headers=headers) + response = connection.getresponse() + content = response.read() + except OSError as error: +> raise MigrationError(f"Docker Engine request failed: {error}") from error +E cryptolabs_proxy.migration.MigrationError: Docker Engine request failed: timed out + +src/cryptolabs_proxy/migration.py:307: MigrationError +____________ test_stop_ack_exceeding_budget_is_bounded_and_recovers ____________ + +monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x109b62ac0> + + def test_stop_ack_exceeding_budget_is_bounded_and_recovers(monkeypatch): + import time + from cryptolabs_proxy import migration + from tests.test_updates import Engine as UpdateFixtureEngine + + monkeypatch.setattr(migration, 'STOP_ACK_HEADROOM', .35, raising=False) + with delayed_stop_socket(5) as (socket_path, requests): + socket_engine = updates.UpdateEngine(socket_path=socket_path, timeout=.2) + + class SocketStopEngine(UpdateFixtureEngine): + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + socket_engine.stop(name, **kwargs) + + engine = SocketStopEngine() + started = time.monotonic() + result = updates.replace_container(engine, 'prometheus', 'sha256:new', 'job', timeout=0) + elapsed = time.monotonic() - started + # Preserved short-caller grace 1s + .35s ACK headroom, with scheduler tolerance. +> assert 1.2 <= elapsed < 3, elapsed +E AssertionError: 0.20253383298404515 +E assert 1.2 <= 0.20253383298404515 + +tests/test_proxy_lifecycle_review_repairs.py:99: AssertionError +=============================== warnings summary =============================== +tests/test_proxy_lifecycle_review_repairs.py: 21 warnings + /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/../src/cryptolabs_proxy/auth.py:374: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). + 'created_at': datetime.utcnow().isoformat(), + +tests/test_proxy_lifecycle_review_repairs.py::test_adoption_real_initializer_preserves_current_customer_password +tests/test_proxy_lifecycle_review_repairs.py::test_initializer_fresh_install_bootstraps_and_restart_preserves + /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/../src/cryptolabs_proxy/auth.py:471: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). + users[username]['last_login'] = datetime.utcnow().isoformat() + +-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html +=========================== short test summary info ============================ +FAILED tests/test_updates.py::test_worker_persists_safe_primary_and_recovery_diagnostics[stop-timeout-False] +FAILED tests/test_updates.py::test_worker_persists_safe_primary_and_recovery_diagnostics[disconnect-os_error-False] +FAILED tests/test_updates.py::test_worker_persists_safe_primary_and_recovery_diagnostics[stop-unknown-False] +FAILED tests/test_updates.py::test_worker_persists_safe_primary_and_recovery_diagnostics[stop-timeout-True] +FAILED tests/test_proxy_lifecycle_review_repairs.py::test_stop_delayed_ack_uses_headroom_without_changing_grace +FAILED tests/test_proxy_lifecycle_review_repairs.py::test_stop_ack_exceeding_budget_is_bounded_and_recovers +6 failed, 47 passed, 23 warnings in 4.73s diff --git a/.traceweaver/updater-stop-20261104/release/release-provenance-audit.json b/.traceweaver/updater-stop-20261104/release/release-provenance-audit.json new file mode 100644 index 0000000..1e3d7f3 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/release/release-provenance-audit.json @@ -0,0 +1,46 @@ +{ + "tag_object": "b09195b6c08725fbe4867b4b3ab3642e8aff483d", + "tag_object_type": "tag", + "peeled_release_commit": "61565a7228539a0b8b0bfb602e06ea3efcc6b94a", + "peeled_type": "commit", + "classification_commands": [ + "git cat-file -t b09195b6c08725fbe4867b4b3ab3642e8aff483d", + "git rev-parse v1.5.4^{}", + "git cat-file -t 61565a7228539a0b8b0bfb602e06ea3efcc6b94a" + ], + "blobs": { + "nginx.conf.j2": { + "sha256": "f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de", + "tag_and_peeled_commit_bytes_equal": true + }, + "acme-challenge.conf.j2": { + "sha256": "7e594162700825757c9d402971094448aa1834d1f7121ac1c02f152f345e149a", + "tag_and_peeled_commit_bytes_equal": true + }, + "fleet-api-routes.conf.j2": { + "sha256": "6991ca6bf1dd4b258e8ee7851fc69ef50b19dfe2353570e4911a0ebadc68ed1b", + "tag_and_peeled_commit_bytes_equal": true + }, + "exporter-auth-routes.conf.j2": { + "sha256": "450f4c418c09474ac45b6dd314c47cc090fe7d230a0206b30e48c7975023133b", + "tag_and_peeled_commit_bytes_equal": true + }, + "host-forwarding.conf.j2": { + "sha256": "35c4a1fe1d3001865a77d7653350b7a61968953b94172dc7063bc31a42c0f9f7", + "tag_and_peeled_commit_bytes_equal": true + }, + "standard-service-routes.conf.j2": { + "sha256": "ef0f55aae48e35127d288781e68281a371505ba27384c8fd04dff9200dce3963", + "tag_and_peeled_commit_bytes_equal": true + }, + "vast-price-manager-auth-blocks.conf.j2": { + "sha256": "b9d7013434557492887b0600bc2afc92227ee17f9efebe55b0cccc4b16bd3f81", + "tag_and_peeled_commit_bytes_equal": true + }, + "vast-price-manager.conf.j2": { + "sha256": "32483d169a09c42653396e66c5c7efe1995bd599f44f11ee64fa2f0731a0a2f8", + "tag_and_peeled_commit_bytes_equal": true + } + }, + "changes": "Three mechanical identity fields on dev/release; version2files release-only. Older raw receipts/logs remain historical." +} diff --git a/.traceweaver/updater-stop-20261104/release/release-scope.json b/.traceweaver/updater-stop-20261104/release/release-scope.json new file mode 100644 index 0000000..14f2e1c --- /dev/null +++ b/.traceweaver/updater-stop-20261104/release/release-scope.json @@ -0,0 +1,18 @@ +{ + "schema": "updater-release-scope/1", + "recorded_at": "2026-11-04T08:30:57.701148+00:00", + "version": "1.6.1", + "base_main": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d", + "accepted_seed": "ba0d23ca21db5efd4a2e430929aceb615562dcb0", + "source_dev_pr": "https://github.com/cryptolabsza/cryptolabs-proxy/pull/25", + "source_dev_head": "c8c745132dbcdc2681e04b47fd3881ca7ffbf0a2", + "route": "Approved main-based bounded hotfix after scoped dev handoff; exclude unrelated unreleased Fleet dev work. Main merge requires dev PR25 merged.", + "approval": "../compatibility/owner-approval.json and ../owner-approval.json", + "source_hashes": { + "src/cryptolabs_proxy/migration.py": "60ab6493757352c135cbb8b389dd198eab66b9b996398430bfa668b8599d9cc3", + "src/cryptolabs_proxy/updates.py": "1b176672c2a55499ca70a9eeb445550849975463846abb068443715e14bf1b56", + "src/cryptolabs_proxy/standard_adoption.py": "3a1c1d63b6bdc2207b9a6f10e5e423516d85905f23b91d2c8fe07538d7a44c74" + }, + "verification": "1002release regressionPASS2existingSKIP; 1.6.1wheel/sdist/installedCLI/resourcesmatch; independentSource/ABI/reviewPASS", + "runtime": "Officialmatchingwheel/image and three native fresh-guest scenarios before LTX; one approvedIPMIretryunconsumed; BMCwritesOFF/unqualified" +} diff --git a/.traceweaver/updater-stop-20261104/root-mechanical-closure.json b/.traceweaver/updater-stop-20261104/root-mechanical-closure.json new file mode 100644 index 0000000..0e10c85 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/root-mechanical-closure.json @@ -0,0 +1,8 @@ +{ + "recorded_at": "2026-11-04T07:59:41.539020+00:00", + "route": "mechanical_closure", + "reviewer_dispatch": 0, + "change": "Retain one-off originalstagingrunner as external runartifact; refresh pointersonly. No production/test/approvedscopechange. Original4 andcompat14scopedsourcehashes unchanged.", + "evidence": "artifacts/updater-independent-validation/acceptance.json", + "runtime": "matchingofficialnativeadoption/LTXstillheld" +} diff --git a/.traceweaver/updater-stop-20261104/root-precode-review.json b/.traceweaver/updater-stop-20261104/root-precode-review.json new file mode 100644 index 0000000..d255142 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/root-precode-review.json @@ -0,0 +1,31 @@ +{ + "record_id": "ROOT-UPDATER-PRECODE-20261104", + "reviewed_at": "2026-11-04T07:18:19.725770+00:00", + "reviewer": "root orchestrator; did not author tests or implementation", + "decision": "definition_passed; production dispatch waits final capsule stamp and profile freeze", + "authority": "explicit approved updater-repair-plan.html unchanged two implementation controls, local IDs are labels only", + "source_baseline": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d", + "checks": { + "production_hashes_unchanged": true, + "baseline": "46 passed,4.10s", + "red": "6 real failures,47 passes,4.73s; socket failures genuine timeout and bounded-time assertion; no permission errors", + "representative_red": "default15s client timed out before15.25sACK;1 failed15.12s", + "test_value": "7 added cases reuse existing Engine and actual worker persistence; no removed tests/skips/assertion weakening", + "contract": "nondefault grace formula preserved; stop only request override; UpdateEngine API prefix forwarding must remain; safe bounded known-cause fields and separate primary/recovery", + "validation": "real disposable Docker update and rollback + installed immutable Proxy identity before single LTX retry; historical incident exactcause remains unproven", + "held": "compatibility addendum awaiting owner approval; no production deployment until resolved" + }, + "artifact_hashes": { + "authority.json": "478054d960a0aa6d25a8e2f8af43d067f91128e6513c95142411df049e543af4", + "workflow-profile.json": "8629b5d43356b08f60ad134e086173bb5bdfc95f3d44a5f825d9b6ff7bb5b357", + "verification-plan.json": "50b836a205195f63d36e43ba2ec59c1efa2d2725a433ae038f3b26d09c090a95", + "validation-plan.json": "9f3f041537c5b73ff8562bd7ae23e8649890da21f5f38e6cedca42be714b9f45", + "matrix-proposal.md": "d0f6b53c5f4bf4d23e58d22d1445c7d692ea56685f0d7c365289f59f6ec10e2f", + "intent-scope.json": "6a80be2f2fbd6615be4803f9b78fc7063b8711d7855bd4ed4027ad5ce4632739" + }, + "test_hashes": { + "tests/test_updates.py": "4729ca4f9d3601b9f3ebc597260e75e17a9720cb7e19e9c90a6b7742fb1aaf5d", + "tests/test_proxy_lifecycle_review_repairs.py": "8872787e70a13ccbed7c0ee8bb4780fc6bc3f12a83d984139d13f7e0e1e67d03" + }, + "profile_adjustment_before_production": "reduce repair_cycle_cap to1 per current tw-code-review; retain reviewer cap2, all other controls; revision2 with reason and freeze before production builder" +} diff --git a/.traceweaver/updater-stop-20261104/staging-procedure.json b/.traceweaver/updater-stop-20261104/staging-procedure.json new file mode 100644 index 0000000..a644607 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/staging-procedure.json @@ -0,0 +1,22 @@ +{ + "status": "definition only; staging not executed", + "entrypoint": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-red-definition/staging-check.py", + "setup": [ + "Independent verifier provisions a fresh disposable Linux VM/daemon; attest ownership, isolation and exact daemon /info ID. Do not use production daemon, shared socket, unrelated containers or CI pool authority.", + "Preload exact released baseline and reviewed immutable repair images. Run verification entrypoint in repair-image Python runtime, PYTHONPATH=/app/src, exposing only the disposable daemon at /staging/docker.sock; copy this script into that temporary runtime. Record actual code hashes in runtime and compare reviewed migration.py/updates.py hashes.", + "Set UPDATER_STAGING_SOCKET=/staging/docker.sock, UPDATER_STAGING_DISPOSABLE=1, exact UPDATER_STAGING_DAEMON_ID, UPDATER_STAGING_OLD_IMAGE=, UPDATER_STAGING_REPAIR_IMAGE=. These inputs contain no secrets.", + "Execute python3 /proof/staging-check.py. Capture stdout/stderr/exit and repair image digest, source/code hashes and VM destruction receipt. No Docker build/pull/publication is performed by the script." + ], + "executable_command": "PYTHONPATH=/app/src python3 /proof/staging-check.py", + "pass_signal": "exit0 and JSON status pass; two real daemon scenarios completed/rolled_back, exact new/old image IDs, real Docker health and retained synthetic history sentinel; clean teardown of uniquely named test containers/volume; independently verify disposal.", + "fault_injection": "UnhealthyCandidate changes only candidate HEALTHCHECK at real Docker create boundary. This forces actual daemon unhealthy state and production readiness/recovery logic; no mocked successful stop/health. Both source containers ignore TERM and exercise normal13s force-stop grace.", + "relation_to_local_tests": "Real socket default15s/13s grace/15.25s delayed ACK test is separately executable; staging proves daemon/image/data/recovery integration, not artificially delayed daemon ACK.", + "limitations": [ + "Environment flag asserts isolation; independent operator evidence is mandatory and not proved by flag.", + "Script must run using frozen repaired image code, not arbitrary host source.", + "Staging is representative validation only; installed LTX updater identity and one actual retry acceptance remain separate held outcomes." + ], + "owner": "root orchestrator/independent verifier", + "release_impact": "No production retry before full-duration GREEN and disposable Docker proof; no release/production acceptance claim from local tests.", + "artifact_location_note": "One-off validation runner retained outside shipped source; original and independent executed copies/proofs are in run artifacts." +} diff --git a/.traceweaver/updater-stop-20261104/validation-plan.json b/.traceweaver/updater-stop-20261104/validation-plan.json new file mode 100644 index 0000000..65576aa --- /dev/null +++ b/.traceweaver/updater-stop-20261104/validation-plan.json @@ -0,0 +1,70 @@ +{ + "skill_name": "validation-planner", + "skill_version": "0.1", + "source_inputs": [ + ".traceweaver/updater-stop-20261104/approved-plan.html", + ".traceweaver/updater-stop-20261104/owner-approval.json" + ], + "authority_status": "owner approved sequence; outcomes held", + "baseline_reference": "candidate exact digest required", + "decision": "held", + "decision_rationale": "No repaired image, Docker staging or target acceptance exists in RED definition phase.", + "hold_conditions": [ + "independent definition review pending", + "disposable Docker update/recovery not run", + "installed fixed-route Proxy identity not observed", + "single approved LTX IPMI retry not consumed" + ], + "validation_plan": { + "plan_id": "VAL-PLAN-UPDATER-20261104", + "need_ids": [ + "approved-plan.html:incident658b5cc178cf40989335b6f51b5eb876" + ], + "intended_use": "LTX operator can update selected IPMI image without losing saved history and receives safe primary/recovery diagnostics if replacement fails.", + "operating_context": "Exact reviewed released Proxy patch first via approved installed fixed host route; then one scoped LTX IPMI1.4.0 retry. Charlotte and BMC untouched.", + "validation_method": "operational dry run then intended-environment acceptance", + "success_criteria": [ + "Before production: independent verifier observes disposable Docker healthy update and unhealthy-candidate rollback with exact identities and retained data; no live socket mounts or shared host changes.", + "Before IPMI retry: installed repaired Proxy hash/digest, auth/health and unrelated pins verified.", + "One retry only: exact selected IPMI1.4.0 digest running/healthy,802 historical eventrows and6alert-history rows preserved (or current pre-retry verified baselines), collection and warning UI validated.", + "Unexpected failure holds rollout; original recovered/health verified with primary/recovery diagnostics retained. No blind repeat, manual replacement or guard bypass." + ], + "owner": "root orchestrator under owner approval; independent verifier judges evidence", + "status": "planned" + }, + "stakeholder_or_rater_profile": { + "name_or_role": "Fresh independent Sol verifier and owner/operator represented by root; owner Hannes Zietsman retains acceptance authority", + "relationship_to_work": "Verifier did not author repair; root checks raw evidence and controls retry.", + "independence_note": "Current preparation worker cannot self-accept implementation or deployment. Requested model identity unattested unless runtime evidence supplied.", + "representative_reason": "Verifier exercises exact operator update/recovery sequence on disposable daemon before fixed-route intended workflow." + }, + "validation_scenario_matrix": [ + { + "scenario_id": "VAL-UPDATER-001", + "need_id": "approved-plan.html clauses2/4", + "scenario": "Disposable daemon update/recovery, then installed updater identity before retry", + "acceptance_signal": "Healthy candidate uses exact digest; failing candidate restores exact original healthy image and persistent sentinel; installed Proxy matches released repair.", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-red-definition/staging-result.json", + "status": "planned" + }, + { + "scenario_id": "VAL-UPDATER-002", + "need_id": "approved-plan.html clauses1/4", + "scenario": "Safe failures in staging and exactly one LTX IPMI retry after gates", + "acceptance_signal": "Allowlisted diagnostics persist and preserve primary/recovery; retry proves image/history/collection/warning UI without secret/error-body leakage.", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-red-definition/ltx-acceptance.json", + "status": "planned" + } + ], + "adoption_evidence_record": { + "record_id": "VAL-UPDATER-PENDING", + "scenario_id": "VAL-UPDATER-001/002", + "rater_or_source": "not yet executed", + "result": "blocked", + "approval_package_inputs": [ + ".traceweaver/updater-stop-20261104/verification-plan.json", + ".traceweaver/updater-stop-20261104/owner-approval.json" + ], + "deferred_trigger": null + } +} diff --git a/.traceweaver/updater-stop-20261104/verification-plan.json b/.traceweaver/updater-stop-20261104/verification-plan.json new file mode 100644 index 0000000..49aae6f --- /dev/null +++ b/.traceweaver/updater-stop-20261104/verification-plan.json @@ -0,0 +1,87 @@ +{ + "skill_name": "verification-planner", + "skill_version": "0.1", + "source_inputs": [ + ".traceweaver/updater-stop-20261104/authority.json", + ".traceweaver/updater-stop-20261104/approved-plan.html", + ".traceweaver/updater-stop-20261104/approved-plan-review.html" + ], + "authority_status": "existing owner-approved controls; local identifier mapping pending orchestrator verification", + "baseline_reference": "8e2b421b65f6d8d47f780e5681d0f3d690686a6d", + "decision": "held", + "decision_rationale": "RED evidence exists; independent executable/validation definition review and mapping verification required before production mutation.", + "hold_conditions": [ + "new verification/validation artifacts not independently reviewed", + "production implementation intentionally untouched" + ], + "recommended_next_skill": "tw-auto", + "verification_plan": { + "plan_id": "VER-PLAN-UPDATER-20261104", + "requirement_ids": [ + "REQ-UPDATER-001", + "REQ-UPDATER-002" + ], + "verification_scope": "Two approved stop-ack/diagnostic repair control groups; preserve existing tests and guards.", + "method": "test", + "success_criteria": [ + "53 focused cases pass on repaired source, including 6 cases that fail released source", + "Default15s request receives ACK at15.25s without changing13s grace; stop budget remains bounded28s", + "Scaled beyond-budget stop times out near1.35s and old source is restarted; no rename/create", + "TimeoutError wrapped by exact MigrationError maps to fixed timeout category; disconnect OSError maps os_error; unknown class maps unknown without formatting", + "Primary stop/timeout remains fixed when recovery start/os_error fails; safe fields survive actual worker write/read; synthetic secret and exception class names absent", + "Existing identity/selection/native controller recovery/security/readiness tests pass with no weakened assertions" + ], + "target_environment": "Local Python real AF_UNIX/HTTP client; isolated temporary files; later real disposable Linux Docker daemon", + "tested_ref_required": true, + "owner": "root orchestrator; implementation and independent verifier roles", + "status": "RED recorded; review pending" + }, + "verification_cross_reference_matrix": [ + { + "requirement_id": "REQ-UPDATER-001", + "method": "test", + "procedure_ref": "tests/test_proxy_lifecycle_review_repairs.py::test_stop_delayed_ack_uses_headroom_without_changing_grace; ::test_stop_ack_exceeding_budget_is_bounded_and_recovers; ::test_non_stop_socket_request_keeps_its_transport_budget", + "expected_result": "Short/default delayed stop success; bounded timeout/recovery; non-stop retains original bound.", + "evidence_required": [ + "red-unsandboxed.log", + "red-full-duration.log", + "future focused-green.log and full-duration-green.log" + ], + "target_environment": "AF_UNIX standard-library production client, representative timings; Docker staging before release", + "harness_equivalence": "Uses actual UpdateEngine inherited DockerEngine.stop/_request and API-prefix forwarding against a delayed real Unix HTTP peer; does not model daemon scheduling, SIGTERM, force kill, container health or target host." + }, + { + "requirement_id": "REQ-UPDATER-002", + "method": "test", + "procedure_ref": "tests/test_updates.py::test_worker_persists_safe_primary_and_recovery_diagnostics", + "expected_result": "4 parameterized actual-worker cases persist fixed phase/category without sensitive text; automatic recovery preserved or explicitly required.", + "evidence_required": [ + "red-unsandboxed.log", + "future focused-green.log" + ], + "target_environment": "Actual worker, JSON persistence, reused in-memory Engine boundary", + "harness_equivalence": "Real production run_job/replace_container/write_job/read_job; only Engine operations substituted with precise wrapped errors. Not daemon/production acceptance." + } + ], + "execution_record_template": { + "execution_id": "VER-UPDATER-NEXT", + "procedure_or_command": "PYTHONPATH=src python3 -m pytest tests/test_updates.py tests/test_proxy_lifecycle_review_repairs.py -q", + "tested_ref": "record exact source SHA + dirty file hashes", + "expected_result": "53 passed", + "actual_result": "pending implementation", + "outcome": "blocked", + "evidence_path": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-red-definition/focused-green.log", + "deviations": [] + }, + "commands": { + "focused": "PYTHONPATH=src python3 -m pytest tests/test_updates.py tests/test_proxy_lifecycle_review_repairs.py -q", + "full_default": "UPDATER_FULL_DURATION=1 PYTHONPATH=src python3 -m pytest tests/test_proxy_lifecycle_review_repairs.py::test_stop_delayed_ack_uses_headroom_without_changing_grace -q", + "broader_affected": "PYTHONPATH=src python3 -m pytest /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/test_controller_guard_transport.py /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/test_controller_recovery_guard.py /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/test_proxy_lifecycle_review_repairs.py /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/test_release_selection.py /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/test_standard_adoption.py /Users/hanneszietsman/CrypotAI/cryptolabs-proxy-updater-stop-20261104/tests/test_updates.py -q", + "deterministic": "git diff --check; python3 -m compileall -q src/cryptolabs_proxy/migration.py src/cryptolabs_proxy/updates.py tests/test_updates.py tests/test_proxy_lifecycle_review_repairs.py" + }, + "lean_test_value": { + "baseline": "46 passed in4.10s;23 existing deprecation warnings; no coverage metrics collected", + "added": "7 cases (4 diagnostic parameters, 2 timing/regression cases,1 non-stop guard); no deletions/skips/weakened assertions", + "purpose": "Protect real observed deadline relationship and discarded-diagnostic failure modes with reused Engine/source fixtures and real worker persistence. Short scale adds sub2s after repair; full15s representative proof opt-in before release, no per-edit full suite." + } +} diff --git a/.traceweaver/updater-stop-20261104/vv-capsule.json b/.traceweaver/updater-stop-20261104/vv-capsule.json new file mode 100644 index 0000000..8cf8ef2 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/vv-capsule.json @@ -0,0 +1,62 @@ +{ + "schema_version": "tw-vv-capsule/1", + "work_item_id": "UPDATER-STOP-20261104", + "workflow_profile": "L3", + "plan_ref": ".traceweaver/updater-stop-20261104/approved-plan.html", + "authority_ref": ".traceweaver/updater-stop-20261104/authority.json", + "profile_ref": ".traceweaver/updater-stop-20261104/workflow-profile.json", + "high_risk_controls": { + "rollback": "Retain and independently verify original-container recovery; unexpected failure holds rollout. Existing guards unchanged. Disposable Docker proof precedes production.", + "owner_decision": "Explicit owner approval permits original bounded Proxy repair/release and one LTX retry; root precode review permits two-file implementation only now. Runtime remains held for verified compatible fixed route and all staging/release gates. Compatibility addendum not yet approved." + }, + "requirements": [ + { + "req_id": "REQ-UPDATER-001", + "trace_id": "TRACE-UPDATER-001", + "ver_id": "VER-UPDATER-001", + "val_id": "VAL-UPDATER-001", + "verification_artifact": "tests/test_proxy_lifecycle_review_repairs.py", + "red_evidence": ".traceweaver/updater-stop-20261104/red-unsandboxed.log", + "validation_artifact": ".traceweaver/updater-stop-20261104/validation-plan.json", + "matrix_row_ref": "traceability-matrix.md#TRACE-UPDATER-001", + "reviews": [ + { + "gate": "tw-code-review", + "id": "ROOT-UPDATER-PRECODE-20261104", + "status": "passed", + "evidence_path": ".traceweaver/updater-stop-20261104/root-precode-review.json" + }, + { + "gate": "tw-doc-review", + "id": "ROOT-UPDATER-PRECODE-20261104", + "status": "passed", + "evidence_path": ".traceweaver/updater-stop-20261104/root-precode-review.json" + } + ] + }, + { + "req_id": "REQ-UPDATER-002", + "trace_id": "TRACE-UPDATER-002", + "ver_id": "VER-UPDATER-002", + "val_id": "VAL-UPDATER-002", + "verification_artifact": "tests/test_updates.py", + "red_evidence": ".traceweaver/updater-stop-20261104/red-unsandboxed.log", + "validation_artifact": ".traceweaver/updater-stop-20261104/validation-plan.json", + "matrix_row_ref": "traceability-matrix.md#TRACE-UPDATER-002", + "reviews": [ + { + "gate": "tw-code-review", + "id": "ROOT-UPDATER-PRECODE-20261104", + "status": "passed", + "evidence_path": ".traceweaver/updater-stop-20261104/root-precode-review.json" + }, + { + "gate": "tw-doc-review", + "id": "ROOT-UPDATER-PRECODE-20261104", + "status": "passed", + "evidence_path": ".traceweaver/updater-stop-20261104/root-precode-review.json" + } + ] + } + ] +} diff --git a/.traceweaver/updater-stop-20261104/workflow-profile-revision1.json b/.traceweaver/updater-stop-20261104/workflow-profile-revision1.json new file mode 100644 index 0000000..8e9cc46 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/workflow-profile-revision1.json @@ -0,0 +1,102 @@ +{ + "schema_version": "tw-workflow-profile/1", + "task_id": "UPDATER-STOP-20261104", + "profile_revision": 1, + "profile_status": "planned", + "risk": "L3", + "selection_rationale": "Stop/recovery mutates containers and repair is release-facing; destructive/external-effect class even though only two production files. Current task authors tests only.", + "process_budget": { + "target_total_effort_percent": 20, + "hard_ceiling_total_effort_percent": 50, + "target_process_to_delivery_ratio_percent": 25, + "hard_ceiling_process_to_delivery_ratio_percent": 100, + "estimated_delivery_minutes": 80, + "estimated_process_target_minutes": 20, + "estimated_process_ceiling_minutes": 80 + }, + "selected_controls": [ + "owner-approved exact plan/hash", + "isolated released-main baseline", + "minimal real-socket RED before production mutation", + "full reviewed V&V capsule", + "independent final verification", + "Astra adversarial review", + "full-duration socket proof", + "disposable Docker update/recovery proof before production", + "protected source-to-dev handoff and bounded main patch release", + "fixed host route only", + "one LTX IPMI retry after installed updater identity/health proof", + "preserve readiness/grace/identity/policy/native recovery guards", + "safe bounded diagnostics", + "retained rollback and history proof", + "no publication from preparation worker" + ], + "child_roles": { + "builder": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 20 + }, + "verifier": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 20 + }, + "reviewer": { + "model": "gpt-6-astra", + "maximum_timebox_minutes": 10 + }, + "deployer": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 30 + }, + "dogfooder": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 10 + } + }, + "model_selection": { + "availability": [ + "gpt-6.1-sol", + "gpt-6-astra" + ], + "choice": "Sol high preparation/build/verification; Astra high adversarial review; root owns deployment and retry.", + "rationale": "Cross-module failure recovery and safe diagnostics require substantive judgment. No attested runtime model identity available.", + "unavailable_consequence": "hold or delegate; never implement as fallback" + }, + "reviewer_cap": 2, + "repair_cycle_cap": 2, + "requires_deploy": true, + "requires_chrome_dogfood": false, + "immutable_after_building": { + "fields": [ + "risk", + "process_budget", + "selected_controls", + "child_roles", + "model_selection", + "reviewer_cap", + "repair_cycle_cap", + "requires_deploy", + "requires_chrome_dogfood", + "profile_hash" + ], + "expansion_rule": "New revision and escalation reason required for added controls/roles after production builder dispatch." + }, + "accounting": { + "observer": "orchestration_harness", + "clock": "monotonic", + "child_self_report": "advisory_only", + "fixed_categories": [ + "process", + "delivery", + "unclassified" + ], + "unclassified_rule": "counts_as_process_until_reviewer_resolves", + "receipts": [], + "terminal_rules": { + "target": "actual_process_minutes <= 0.25 * actual_delivery_minutes", + "hard_hold": "actual_process_minutes > actual_delivery_minutes => held_process_budget", + "no_in_task_exception": true + } + }, + "profile_hash": "sha256:4e9f51a20e27e6d5e2c6654b2ee7564289377b29bb20ecc6e49c28942d79dc84" +} diff --git a/.traceweaver/updater-stop-20261104/workflow-profile-revision2.json b/.traceweaver/updater-stop-20261104/workflow-profile-revision2.json new file mode 100644 index 0000000..2e2e495 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/workflow-profile-revision2.json @@ -0,0 +1,103 @@ +{ + "schema_version": "tw-workflow-profile/1", + "task_id": "UPDATER-STOP-20261104", + "profile_revision": 2, + "profile_status": "frozen_before_production_builder", + "risk": "L3", + "selection_rationale": "Stop/recovery mutates containers and repair is release-facing; destructive/external-effect class even though only two production files. Current task authors tests only.", + "process_budget": { + "target_total_effort_percent": 20, + "hard_ceiling_total_effort_percent": 50, + "target_process_to_delivery_ratio_percent": 25, + "hard_ceiling_process_to_delivery_ratio_percent": 100, + "estimated_delivery_minutes": 80, + "estimated_process_target_minutes": 20, + "estimated_process_ceiling_minutes": 80 + }, + "selected_controls": [ + "owner-approved exact plan/hash", + "isolated released-main baseline", + "minimal real-socket RED before production mutation", + "full reviewed V&V capsule", + "independent final verification", + "Astra adversarial review", + "full-duration socket proof", + "disposable Docker update/recovery proof before production", + "protected source-to-dev handoff and bounded main patch release", + "fixed host route only", + "one LTX IPMI retry after installed updater identity/health proof", + "preserve readiness/grace/identity/policy/native recovery guards", + "safe bounded diagnostics", + "retained rollback and history proof", + "no publication from preparation worker" + ], + "child_roles": { + "builder": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 20 + }, + "verifier": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 20 + }, + "reviewer": { + "model": "gpt-6-astra", + "maximum_timebox_minutes": 10 + }, + "deployer": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 30 + }, + "dogfooder": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 10 + } + }, + "model_selection": { + "availability": [ + "gpt-6.1-sol", + "gpt-6-astra" + ], + "choice": "Sol high preparation/build/verification; Astra high adversarial review; root owns deployment and retry.", + "rationale": "Cross-module failure recovery and safe diagnostics require substantive judgment. No attested runtime model identity available.", + "unavailable_consequence": "hold or delegate; never implement as fallback" + }, + "reviewer_cap": 2, + "repair_cycle_cap": 1, + "requires_deploy": true, + "requires_chrome_dogfood": false, + "immutable_after_building": { + "fields": [ + "risk", + "process_budget", + "selected_controls", + "child_roles", + "model_selection", + "reviewer_cap", + "repair_cycle_cap", + "requires_deploy", + "requires_chrome_dogfood", + "profile_hash" + ], + "expansion_rule": "New revision and escalation reason required for added controls/roles after production builder dispatch." + }, + "accounting": { + "observer": "orchestration_harness", + "clock": "monotonic", + "child_self_report": "advisory_only", + "fixed_categories": [ + "process", + "delivery", + "unclassified" + ], + "unclassified_rule": "counts_as_process_until_reviewer_resolves", + "receipts": [], + "terminal_rules": { + "target": "actual_process_minutes <= 0.25 * actual_delivery_minutes", + "hard_hold": "actual_process_minutes > actual_delivery_minutes => held_process_budget", + "no_in_task_exception": true + } + }, + "revision_reason": "Reduce repair cycle cap to current tw-code-review maximum; no added scope or control.", + "profile_hash": "sha256:aaa66c2aad99a1e23e58e7112872f82b918eb1534edd68b102022a0c7f05d2eb" +} diff --git a/.traceweaver/updater-stop-20261104/workflow-profile.json b/.traceweaver/updater-stop-20261104/workflow-profile.json new file mode 100644 index 0000000..8e6c380 --- /dev/null +++ b/.traceweaver/updater-stop-20261104/workflow-profile.json @@ -0,0 +1,107 @@ +{ + "schema_version": "tw-workflow-profile/1", + "task_id": "UPDATER-STOP-20261104", + "profile_revision": 3, + "profile_status": "frozen_before_compatibility_RED_dispatch", + "risk": "L3", + "selection_rationale": "Stop/recovery mutates containers and repair is release-facing; destructive/external-effect class even though only two production files. Current task authors tests only.", + "process_budget": { + "target_total_effort_percent": 20, + "hard_ceiling_total_effort_percent": 50, + "target_process_to_delivery_ratio_percent": 25, + "hard_ceiling_process_to_delivery_ratio_percent": 100, + "estimated_delivery_minutes": 140, + "estimated_process_target_minutes": 35, + "estimated_process_ceiling_minutes": 140 + }, + "selected_controls": [ + "owner-approved exact plan/hash", + "isolated released-main baseline", + "minimal real-socket RED before production mutation", + "full reviewed V&V capsule", + "independent final verification", + "Astra adversarial review", + "full-duration socket proof", + "disposable Docker update/recovery proof before production", + "protected source-to-dev handoff and bounded main patch release", + "fixed host route only", + "one LTX IPMI retry after installed updater identity/health proof", + "preserve readiness/grace/identity/policy/native recovery guards", + "safe bounded diagnostics", + "retained rollback and history proof", + "no publication from preparation worker", + "strict immutable full-tree historical1.5.4 template closure", + "compatibility RED before production edit", + "matching officialwheel/container and real stagingadoption recovery", + "explicit bounded separate officialhostvenv provisioning exception; globalCLI unchanged" + ], + "child_roles": { + "builder": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 20 + }, + "verifier": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 20 + }, + "reviewer": { + "model": "gpt-6-astra", + "maximum_timebox_minutes": 10 + }, + "deployer": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 30 + }, + "dogfooder": { + "model": "gpt-6.1-sol", + "maximum_timebox_minutes": 10 + } + }, + "model_selection": { + "availability": [ + "gpt-6.1-sol", + "gpt-6-astra" + ], + "choice": "Sol high preparation/build/verification; Astra high adversarial review; root owns deployment and retry.", + "rationale": "Cross-module failure recovery and safe diagnostics require substantive judgment. No attested runtime model identity available.", + "unavailable_consequence": "hold or delegate; never implement as fallback" + }, + "reviewer_cap": 2, + "repair_cycle_cap": 1, + "requires_deploy": true, + "requires_chrome_dogfood": false, + "immutable_after_building": { + "fields": [ + "risk", + "process_budget", + "selected_controls", + "child_roles", + "model_selection", + "reviewer_cap", + "repair_cycle_cap", + "requires_deploy", + "requires_chrome_dogfood", + "profile_hash" + ], + "expansion_rule": "New revision and escalation reason required for added controls/roles after production builder dispatch." + }, + "accounting": { + "observer": "orchestration_harness", + "clock": "monotonic", + "child_self_report": "advisory_only", + "fixed_categories": [ + "process", + "delivery", + "unclassified" + ], + "unclassified_rule": "counts_as_process_until_reviewer_resolves", + "receipts": [], + "terminal_rules": { + "target": "actual_process_minutes <= 0.25 * actual_delivery_minutes", + "hard_hold": "actual_process_minutes > actual_delivery_minutes => held_process_budget", + "no_in_task_exception": true + } + }, + "revision_reason": "Explicit owner approval of reviewed compatibility addendum revision2 adds strict historicalprofile resources, packaged/staged adoption and separate official hostvenv provisioning. Original two-file source review remains valid for exact unchanged hashes.", + "profile_hash": "sha256:38bbffb104e856adfcecfd785449f2b156cb5762e4d7e316d8de5ec09e96aa53" +} diff --git a/pyproject.toml b/pyproject.toml index 3312a7a..5baa9e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "cryptolabs-proxy" -version = "1.6.0" +version = "1.6.1" description = "Unified reverse proxy and fleet management landing page for CryptoLabs products" readme = "README.md" license = {text = "MIT"} diff --git a/requirements.md b/requirements.md index d2fc55b..4b8da7d 100644 --- a/requirements.md +++ b/requirements.md @@ -40,3 +40,24 @@ Verification: `VER-PAIR-005`; validation: `VAL-PAIR-005`. See scoped authority a The implementation shall preserve existing working links and legacy clients, keep the current pinned WordPress package/publisher boundary, and deliver installed product updates through accepted DC Overview Fleet Management. Deployment and paid-service acceptance shall remain held until observed in the intended environment. Verification: `VER-PAIR-006`; validation: `VAL-PAIR-006`. See scoped authority and protocol for executable acceptance boundaries. + + +## REQ-UPDATER-001 — owner-approved updater repair + +Bounded stop-only acknowledgement headroom; preserve existing stop grace (13s default), other socket timeouts and readiness deadlines. + +Authority: `.traceweaver/updater-stop-20261104/authority.json`, unchanged approved plan control. Verification: `VER-UPDATER-001`; validation: `VAL-UPDATER-001`. Intended-environment acceptance remains held. + + +## REQ-UPDATER-002 — owner-approved updater repair + +Fixed allowlisted phase/category diagnostics, safe known wrapped-cause classification, separate primary/recovery failure; no exception text/payload/credentials/traceback serialization; diagnostics cannot interrupt recovery. Preserve rollback, identity, selection and native guards. + +Authority: `.traceweaver/updater-stop-20261104/authority.json`, unchanged approved plan control. Verification: `VER-UPDATER-002`; validation: `VAL-UPDATER-002`. Intended-environment acceptance remains held. + + +## REQ-UPDATER-003 — owner-approved historical-profile prerequisite + +Recognize one explicitly named released-standard1.5.4 source via complete ordered structural equality and immutable eight-template historical closure; preserve current candidate rendering, auth/module identity, selection/source drift denial, declaration and recovery guards. Verify matching official wheel/container and disposable staging adoption before bounded separate official hostvenv provisioning, fixed native Proxy adoption and the already-approved single LTX IPMI retry. + +Authority: `.traceweaver/updater-stop-20261104/compatibility/owner-approval.json` and approved addendum. Verification `VER-UPDATER-003`; validation `VAL-UPDATER-003`. Operational outcomes remain held. diff --git a/src/cryptolabs_proxy/__init__.py b/src/cryptolabs_proxy/__init__.py index 4c4c6f4..eb63c19 100644 --- a/src/cryptolabs_proxy/__init__.py +++ b/src/cryptolabs_proxy/__init__.py @@ -1,6 +1,6 @@ """CryptoLabs Proxy - Unified reverse proxy for CryptoLabs products.""" -__version__ = "1.6.0" +__version__ = "1.6.1" # Export programmatic setup API from .setup import ( diff --git a/src/cryptolabs_proxy/migration.py b/src/cryptolabs_proxy/migration.py index 9fc617f..e30b146 100644 --- a/src/cryptolabs_proxy/migration.py +++ b/src/cryptolabs_proxy/migration.py @@ -1,3 +1,4 @@ +# TRACEWEAVER: file-role=bounded-docker-stop-transport; req=REQ-UPDATER-001; trace=TRACE-UPDATER-001; ver=VER-UPDATER-001 """Dry-run planning and bounded state helpers for custom VPM proxy migration. This module intentionally does not contact Docker at import time. The calling @@ -62,6 +63,9 @@ def candidate_retained(cls, detail: str) -> "MigrationOutcome": + DOCKER_HEALTH_TIMEOUT + 10 # bounded local auth-probe allowance ) +# Stop grace remains independent of the time allowed for the daemon to +# acknowledge it after SIGTERM/forced termination and teardown. +STOP_ACK_HEADROOM = 15 @dataclass(frozen=True) @@ -295,8 +299,8 @@ def __init__(self, socket_path: str = "/var/run/docker.sock", timeout: int = 15) self.socket_path = socket_path self.timeout = timeout - def _request(self, method: str, path: str, payload: dict | None = None, allowed=(200, 201, 204)): - connection = _UnixHTTPConnection(self.socket_path, self.timeout) + def _request(self, method: str, path: str, payload: dict | None = None, allowed=(200, 201, 204), *, timeout=None): + connection = _UnixHTTPConnection(self.socket_path, self.timeout if timeout is None else timeout) body = json.dumps(payload).encode() if payload is not None else None headers = {"Content-Type": "application/json"} if body else {} try: @@ -316,12 +320,15 @@ def _request(self, method: str, path: str, payload: dict | None = None, allowed= def inspect(self, container: str) -> dict[str, Any]: return json.loads(self._request("GET", f"/containers/{quote(container, safe='')}/json")) +# TRACEWEAVER: entrypoint=stop; req=REQ-UPDATER-001; trace=TRACE-UPDATER-001; ver=VER-UPDATER-001 def stop(self, container: str, ignore_missing: bool = False): allowed = (204, 304, 404) if ignore_missing else (204, 304) - # Leave the Unix-socket read timeout enough headroom to receive the - # Engine response after its graceful-stop period. + # Preserve the existing grace, including for nondefault timeout callers. + # Only this request receives response headroom; shared transport and + # readiness deadlines do not change. grace = max(1, self.timeout - 2) - self._request("POST", f"/containers/{quote(container, safe='')}/stop?t={grace}", allowed=allowed) + self._request("POST", f"/containers/{quote(container, safe='')}/stop?t={grace}", + allowed=allowed, timeout=grace + STOP_ACK_HEADROOM) def rename(self, old: str, new: str): self._request("POST", f"/containers/{quote(old, safe='')}/rename?name={quote(new, safe='')}", allowed=(204,)) diff --git a/src/cryptolabs_proxy/standard_adoption.py b/src/cryptolabs_proxy/standard_adoption.py index 0d67389..7c22489 100644 --- a/src/cryptolabs_proxy/standard_adoption.py +++ b/src/cryptolabs_proxy/standard_adoption.py @@ -1,3 +1,4 @@ +# TRACEWEAVER: file-role=strict-released-standard-source; req=REQ-UPDATER-003; trace=TRACE-UPDATER-003; ver=VER-UPDATER-003 """Explicit standard configuration adoption, without Nginx passthrough. Public manifests contain identities and declarative fields only. Inspected @@ -15,6 +16,7 @@ import tarfile import time from urllib.parse import quote, urlsplit +from jinja2 import DictLoader, Environment, select_autoescape from .config import get_jinja_env, validate_host_forward_groups, render_host_forward_groups, validate_acme_challenge, render_acme_challenge, validate_hostname_policy, validate_http_policy, render_policy_healthcheck, policy_healthcheck from .custom_config import render_managed_vpm_config @@ -187,6 +189,44 @@ def render_standard(declaration): return get_jinja_env().get_template('nginx.conf.j2').render(domain=declaration['domain'],letsencrypt=declaration['tls']=='letsencrypt',services=declaration['services'],host_forward_groups=declaration.get('host_forward_groups',[]),acme_challenge=declaration.get('acme_challenge'),hostname_policy=validate_hostname_policy(declaration.get('hostname_policy'),declaration['domain']),http_policy=validate_http_policy(declaration.get('http_policy'),declaration['domain'],declaration.get('acme_challenge'))).encode() +_RELEASED_STANDARD_154_COMMIT = '61565a7228539a0b8b0bfb602e06ea3efcc6b94a' +_RELEASED_STANDARD_154_HASHES = { + 'nginx.conf.j2': 'f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de', + 'acme-challenge.conf.j2': '7e594162700825757c9d402971094448aa1834d1f7121ac1c02f152f345e149a', + 'fleet-api-routes.conf.j2': '6991ca6bf1dd4b258e8ee7851fc69ef50b19dfe2353570e4911a0ebadc68ed1b', + 'exporter-auth-routes.conf.j2': '450f4c418c09474ac45b6dd314c47cc090fe7d230a0206b30e48c7975023133b', + 'host-forwarding.conf.j2': '35c4a1fe1d3001865a77d7653350b7a61968953b94172dc7063bc31a42c0f9f7', + 'standard-service-routes.conf.j2': 'ef0f55aae48e35127d288781e68281a371505ba27384c8fd04dff9200dce3963', + 'vast-price-manager-auth-blocks.conf.j2': 'b9d7013434557492887b0600bc2afc92227ee17f9efebe55b0cccc4b16bd3f81', + 'vast-price-manager.conf.j2': '32483d169a09c42653396e66c5c7efe1995bd599f44f11ee64fa2f0731a0a2f8', +} + + +def _render_released_standard_154(declaration): + """Render only the pinned release closure, never mutable current includes.""" + directory=Path(__file__).with_name('templates')/'released-standard-1.5.4' + try: + provenance=json.loads((directory/'provenance.json').read_bytes()) + if provenance!={'release':'v1.5.4','commit':_RELEASED_STANDARD_154_COMMIT, + 'templates':_RELEASED_STANDARD_154_HASHES}: + raise ValueError() + templates={} + for name,digest in _RELEASED_STANDARD_154_HASHES.items(): + data=(directory/name).read_bytes() + if sha256(data)!=digest: raise ValueError() + templates[name]=data.decode() + environment=Environment(loader=DictLoader(templates), + autoescape=select_autoescape(['html','xml']),trim_blocks=True,lstrip_blocks=True) + return environment.get_template('nginx.conf.j2').render( + domain=declaration['domain'],letsencrypt=declaration['tls']=='letsencrypt', + services=declaration['services'],host_forward_groups=declaration.get('host_forward_groups',[]), + acme_challenge=declaration.get('acme_challenge'), + hostname_policy=validate_hostname_policy(declaration.get('hostname_policy'),declaration['domain']), + http_policy=validate_http_policy(declaration.get('http_policy'),declaration['domain'],declaration.get('acme_challenge'))).encode() + except Exception: + raise AdoptionError('historical_profile_unavailable') from None + + def _policy_healthcheck(source, declaration): try: return policy_healthcheck(source.get('Config',{}).get('Healthcheck'),declaration['domain'],declaration.get('hostname_policy'),declaration.get('http_policy'),letsencrypt=declaration['tls']=='letsencrypt') @@ -566,6 +606,7 @@ def inspect(self): 'upstreams':[_safe_upstream(w[1:]) for w in words if w[0] in ('proxy_pass','set') and any(re.search(r'(?i)https?://', word) for word in w[1:])], 'custom_mode':registry.config.get('custom_config',{}).get('mode'),'owner':'cryptolabs-proxy','directives':sorted({w[0] for w in words})} +# TRACEWEAVER: entrypoint=_coverage; req=REQ-UPDATER-003; trace=TRACE-UPDATER-003; ver=VER-UPDATER-003 def _coverage(self,active,declaration): tree=parse_nginx(active) # Entire configuration, including every directive and server, must @@ -581,6 +622,8 @@ def visit(items): visit(nodes); return nodes actual=normalize(tree); expected=normalize(parse_nginx(render_standard(declaration))) if actual==expected: return 'standard' + historical=normalize(parse_nginx(_render_released_standard_154(declaration))) + if actual==historical: return 'released-standard-1.5.4' legacy=get_jinja_env().loader.get_source(get_jinja_env(),'legacy-bootstrap-nginx.conf')[0].encode() profiles=[legacy] for enabled in (False,True): profiles.append(render_managed_vpm_config(legacy,enabled)) diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/acme-challenge.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/acme-challenge.conf.j2 new file mode 100644 index 0000000..e74ac0c --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/acme-challenge.conf.j2 @@ -0,0 +1,15 @@ +{% if acme_challenge | default(none) %} + location ^~ /.well-known/acme-challenge/ { + proxy_pass {{ acme_challenge.origin }}; + proxy_set_header Host $host; + proxy_connect_timeout {{ acme_challenge.get('connect_timeout_seconds', 2) }}s; + proxy_read_timeout {{ acme_challenge.get('read_timeout_seconds', 10) }}s; +{% if not legacy_forward_profile | default(false) %} + proxy_set_header X-Mgmt-Token ""; + proxy_set_header X-Fleet-Auth-Token ""; + proxy_set_header X-Fleet-Auth-User ""; + proxy_set_header X-Fleet-Auth-Role ""; + proxy_set_header X-Fleet-Authenticated ""; +{% endif %} + } +{% endif %} diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/exporter-auth-routes.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/exporter-auth-routes.conf.j2 new file mode 100644 index 0000000..a2c1cee --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/exporter-auth-routes.conf.j2 @@ -0,0 +1,37 @@ + # Exporter account APIs require a current Fleet administrator. + location = /_exporter_admin { + internal; + proxy_pass http://127.0.0.1:8081/auth/exporters/authorize; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header Cookie $http_cookie; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Capture the suffix explicitly: variable proxy_pass does not replace + # a prefix URI. Preserve query arguments and never accept a client token. + location ~ ^/vastai-api/(.*)$ { + auth_request /_exporter_admin; + auth_request_set $mgmt_token $upstream_http_x_mgmt_token; + set $upstream_vastai_api http://vastai-exporter:8622; + proxy_pass $upstream_vastai_api/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Mgmt-Token $mgmt_token; + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + location ~ ^/runpod-api/(.*)$ { + auth_request /_exporter_admin; + auth_request_set $mgmt_token $upstream_http_x_mgmt_token; + set $upstream_runpod_api http://runpod-exporter:8623; + proxy_pass $upstream_runpod_api/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Mgmt-Token $mgmt_token; + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/fleet-api-routes.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/fleet-api-routes.conf.j2 new file mode 100644 index 0000000..0d8b329 --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/fleet-api-routes.conf.j2 @@ -0,0 +1,52 @@ + location /api/build-info { + proxy_pass http://127.0.0.1:8080/api/build-info; + } + + # Version management and update endpoints (protected) + location /api/versions { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/versions; + proxy_set_header Host $host; + proxy_connect_timeout 10s; + proxy_read_timeout 30s; + } + + location /api/update-settings { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/update-settings; + proxy_set_header Host $host; + proxy_set_header Content-Type $http_content_type; + proxy_connect_timeout 5s; + proxy_read_timeout 10s; + } + + location /api/update { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/update; + proxy_set_header Host $host; + proxy_set_header Content-Type $http_content_type; + proxy_connect_timeout 10s; + proxy_read_timeout 120s; # Updates can take time + } + + location /api/pull { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/pull; + proxy_set_header Host $host; + proxy_set_header Content-Type $http_content_type; + proxy_connect_timeout 10s; + proxy_read_timeout 300s; # Image pulls can be slow + } + + location @api_unauthorized { + default_type application/json; + return 401 '{"error":"Authentication required"}'; + } + location /assets/ { + alias /usr/share/nginx/html/assets/; + expires 1h; + } diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/host-forwarding.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/host-forwarding.conf.j2 new file mode 100644 index 0000000..add3b3d --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/host-forwarding.conf.j2 @@ -0,0 +1,61 @@ +{% for group in host_forward_groups | default([]) %} +{% for protocol in ['http','https'] %} +{% set forwarding = group[protocol] %} + server { +{% if protocol == 'http' %} + listen 80; +{% else %} + listen 443 ssl; +{% if group.get('http2', true) %} + http2 on; +{% endif %} +{% endif %} + server_name {{ group.hostnames | join(' ') }}; +{% if protocol == 'https' %} + ssl_certificate {{ group.certificate }}; + ssl_certificate_key {{ group.certificate_key }}; + ssl_protocols TLSv1.2 TLSv1.3; +{% endif %} + location / { + proxy_pass {{ forwarding.origin }}; +{% if protocol == 'https' %} + proxy_ssl_verify {{ 'on' if forwarding.get('verify_tls', true) else 'off' }}; +{% if forwarding.get('verify_tls', true) %} + proxy_ssl_trusted_certificate {{ forwarding.get('ca_certificate', '/etc/ssl/certs/ca-certificates.crt') }}; +{% endif %} + proxy_ssl_server_name {{ 'on' if forwarding.get('sni', true) else 'off' }}; +{% endif %} + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto {{ '$scheme' if forwarding.get('forwarded_proto', 'scheme') == 'scheme' else forwarding.forwarded_proto }}; +{% if forwarding.get('websocket', false) %} + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; +{% endif %} +{% for key, directive in [('read_timeout_seconds','proxy_read_timeout'),('send_timeout_seconds','proxy_send_timeout'),('connect_timeout_seconds','proxy_connect_timeout')] %} +{% if key in forwarding %} + {{ directive }} {{ forwarding[key] }}s; +{% endif %} +{% endfor %} +{% if 'buffering' in forwarding %} + proxy_buffering {{ 'on' if forwarding.buffering else 'off' }}; +{% endif %} +{% if 'max_body_size_mb' in forwarding %} + client_max_body_size {{ forwarding.max_body_size_mb }}M; +{% endif %} +{% if not legacy_forward_profile | default(false) %} + # External backends own their authentication; Fleet authorities + # and exporter management tokens are never forwarded. + proxy_set_header X-Mgmt-Token ""; + proxy_set_header X-Fleet-Auth-Token ""; + proxy_set_header X-Fleet-Auth-User ""; + proxy_set_header X-Fleet-Auth-Role ""; + proxy_set_header X-Fleet-Authenticated ""; +{% endif %} + } +{% include 'vast-price-manager-auth-blocks.conf.j2' %} + } +{% endfor %} +{% endfor %} diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/nginx.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/nginx.conf.j2 new file mode 100644 index 0000000..5a77d27 --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/nginx.conf.j2 @@ -0,0 +1,332 @@ +worker_processes auto; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + client_max_body_size 100M; + + # Gzip compression + gzip on; + gzip_vary on; + gzip_proxied any; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml; + + # Rate limiting + limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s; + + {% if letsencrypt or http_policy %} + # Redirect HTTP to HTTPS + server { + listen 80{% if hostname_policy %} default_server{% endif %}; + server_name {{ domain }}; +{% if hostname_policy %} + if ($host != {{ domain }}) { + return 444; + } +{% endif %} + +{% if http_policy %} + location ^~ /.well-known/acme-challenge/ { + root /var/www/certbot; + default_type text/plain; + try_files $uri =404; + } + location / { + return 308 https://{{ domain }}$request_uri; + } + {% include "vast-price-manager-auth-blocks.conf.j2" %} +{% else %} + location /.well-known/acme-challenge/ { + root /var/www/certbot; + } + + location / { + return 301 https://$host$request_uri; + } +{% endif %} + } + + server { + listen 443 ssl http2{% if hostname_policy %} default_server{% endif %}; + server_name {{ domain }}; +{% if hostname_policy %} + if ($host != {{ domain }}) { + return 444; + } +{% endif %} + + {% if letsencrypt %} + ssl_certificate /etc/letsencrypt/live/{{ domain }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ domain }}/privkey.pem; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256; + ssl_prefer_server_ciphers off; + ssl_session_cache shared:SSL:10m; + {% else %} + ssl_certificate /etc/nginx/ssl/server.crt; + ssl_certificate_key /etc/nginx/ssl/server.key; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; + {% endif %} + {% else %} + server { + listen 80{% if hostname_policy %} default_server{% endif %}; + listen 443 ssl http2{% if hostname_policy %} default_server{% endif %}; + server_name {{ domain }}; +{% if hostname_policy %} + if ($host != {{ domain }}) { + return 444; + } +{% endif %} + + ssl_certificate /etc/nginx/ssl/server.crt; + ssl_certificate_key /etc/nginx/ssl/server.key; + ssl_protocols TLSv1.2 TLSv1.3; + {% endif %} + + # DNS resolver for Docker networks - CRITICAL for runtime resolution + # This allows nginx to start even if backend services don't exist yet + resolver 127.0.0.11 valid=10s ipv6=off; + resolver_timeout 5s; + + # Security headers + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; + +{% include 'acme-challenge.conf.j2' %} + # ===================================================== + # ERROR HANDLERS + # ===================================================== + + location @service_unavailable { + default_type application/json; + return 503 '{"error":"Service unavailable","message":"The requested service is not running. Install it or wait for it to start."}'; + } + + # ===================================================== + # AUTHENTICATION + # ===================================================== + + # Auth server endpoints (public) + location /auth/ { + proxy_pass http://127.0.0.1:8081/auth/; +{% if http_policy %} + proxy_hide_header X-Mgmt-Token; + proxy_cookie_flags fleet_session secure httponly samesite=lax; +{% endif %} + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + +{% if http_policy %} + location = /auth/headers { return 404; } + location = /auth/headers/ { return 404; } + location = /auth/exporters/authorize { return 404; } + location = /auth/exporters/authorize/ { return 404; } +{% endif %} + # Internal auth verification endpoint (for auth_request) + location = /_auth_check { + internal; + proxy_pass http://127.0.0.1:8081/auth/headers; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + proxy_set_header Cookie $http_cookie; + } + + # ===================================================== + # Internal API (blocked from public access) + # Only reachable via direct Docker network (172.30.0.10:8080) + # ===================================================== + location /internal/ { + return 403; + } + + # ===================================================== + # PUBLIC ENDPOINTS (no auth required) + # ===================================================== + + # Health check API (always public) + location /api/health { + default_type application/json; + return 200 '{"status":"ok","proxy":"running"}'; + } + + # Service health check (internal, no auth) + location /api/services { + proxy_pass http://127.0.0.1:8080/api/services; + proxy_set_header Host $host; + } + + {% include "fleet-api-routes.conf.j2" %} + + # Static assets (no auth) + location /static/ { + root /usr/share/nginx/html; + } + + # ===================================================== + # PROTECTED ENDPOINTS (auth required) + # ===================================================== + + # Fleet Management Landing Page (requires auth) + location = / { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + + # Redirect to login if not authenticated + error_page 401 = @login_redirect; + + root /usr/share/nginx/html; + index index.html; + } + + location @login_redirect { + return 302 /auth/login?next=$request_uri; + } + + {% include "vast-price-manager-auth-blocks.conf.j2" %} + + {% if 'vast-price-manager' in services %} + {% include "vast-price-manager.conf.j2" %} + {% endif %} + + {% include "standard-service-routes.conf.j2" %} + + {% for name, service in services.items() %} + {% if name in ['ipmi-monitor','dc-overview','grafana','prometheus','vastai-exporter','runpod-exporter','vast-price-manager'] %} + # Vast Price Manager uses its dedicated admin-only route above. + {% elif not service.path %} + # {{ service.get('display_name', name) }} - external service, no local proxy route + {% else %} + # {{ service.get('display_name', name) }} - uses variable for runtime DNS resolution + location ~ ^{{ service.path }}(?.*)$ { + # Require authentication + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + + # Redirect to login if not authenticated + error_page 401 = @login_redirect; + + {% if name == 'grafana' or service.container_name == 'grafana' %} + # Map Fleet roles to Grafana roles (Admin, Editor, Viewer) + set $grafana_role "Viewer"; + if ($auth_role = "admin") { + set $grafana_role "Admin"; + } + if ($auth_role = "readwrite") { + set $grafana_role "Editor"; + } + {% endif %} + + # Variable allows nginx to start even if service doesn't exist yet + set $upstream_{{ name | replace('-', '_') }} http://{{ service.container_name }}:{{ service.port }}; + proxy_pass $upstream_{{ name | replace('-', '_') }}/$custom_{{ name | replace('-', '_') }}$is_args$args; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name {{ service.path.rstrip('/') }}; + + # Forward authentication headers to backend services + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated "true"; + + {% if name == 'grafana' or service.container_name == 'grafana' %} + # Grafana-specific: pass user and role for auto-login with correct permissions + proxy_set_header X-WEBAUTH-USER $auth_user; + proxy_set_header X-WEBAUTH-ROLE $grafana_role; + {% endif %} + + proxy_read_timeout 300; + proxy_connect_timeout 300; + proxy_send_timeout 300; + + {% if name == 'grafana' or service.container_name == 'grafana' %} + # Inject Fleet Management Home button into Grafana HTML + # target="_top" prevents Grafana's SPA router from intercepting the click + sub_filter '' ''; + sub_filter '' '
Home|Grafana
'; + sub_filter_once on; + sub_filter_types text/html; + proxy_set_header Accept-Encoding ""; + {% elif name == 'prometheus' or service.container_name == 'prometheus' %} + # Inject Fleet Management Home button into Prometheus HTML + sub_filter '' ''; + sub_filter '' '
Home|Prometheus
'; + sub_filter_once on; + sub_filter_types text/html; + proxy_set_header Accept-Encoding ""; + {% endif %} + + # Graceful error handling when service is unavailable + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + {% endif %} + {% endfor %} + + # Exporter management pages - served by auth server + location /vastai/ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + error_page 401 = @login_redirect; + proxy_pass http://127.0.0.1:8081/vastai/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /runpod/ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + error_page 401 = @login_redirect; + proxy_pass http://127.0.0.1:8081/runpod/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + {% include "exporter-auth-routes.conf.j2" %} + + # Default: show landing page + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } + } + {% include "host-forwarding.conf.j2" %} + +} diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/provenance.json b/src/cryptolabs_proxy/templates/released-standard-1.5.4/provenance.json new file mode 100644 index 0000000..393c112 --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/provenance.json @@ -0,0 +1,14 @@ +{ + "release": "v1.5.4", + "commit": "61565a7228539a0b8b0bfb602e06ea3efcc6b94a", + "templates": { + "nginx.conf.j2": "f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de", + "acme-challenge.conf.j2": "7e594162700825757c9d402971094448aa1834d1f7121ac1c02f152f345e149a", + "fleet-api-routes.conf.j2": "6991ca6bf1dd4b258e8ee7851fc69ef50b19dfe2353570e4911a0ebadc68ed1b", + "exporter-auth-routes.conf.j2": "450f4c418c09474ac45b6dd314c47cc090fe7d230a0206b30e48c7975023133b", + "host-forwarding.conf.j2": "35c4a1fe1d3001865a77d7653350b7a61968953b94172dc7063bc31a42c0f9f7", + "standard-service-routes.conf.j2": "ef0f55aae48e35127d288781e68281a371505ba27384c8fd04dff9200dce3963", + "vast-price-manager-auth-blocks.conf.j2": "b9d7013434557492887b0600bc2afc92227ee17f9efebe55b0cccc4b16bd3f81", + "vast-price-manager.conf.j2": "32483d169a09c42653396e66c5c7efe1995bd599f44f11ee64fa2f0731a0a2f8" + } +} diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/standard-service-routes.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/standard-service-routes.conf.j2 new file mode 100644 index 0000000..d5095e7 --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/standard-service-routes.conf.j2 @@ -0,0 +1,238 @@ + {% if 'ipmi-monitor' in services %} + # IPMI Monitor API - returns JSON 401 for unauthenticated requests + location ~ ^/ipmi/api/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @api_unauthorized; + + set $upstream_ipmi http://{{ services['ipmi-monitor'].container_name }}:{{ services['ipmi-monitor'].port }}; + proxy_pass $upstream_ipmi/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /ipmi; + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # IPMI Monitor - regex location to properly rewrite URI with variable proxy_pass + location ~ ^/ipmi/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @login_redirect; + + # Variable allows nginx to start even if service doesn't exist + set $upstream_ipmi http://{{ services['ipmi-monitor'].container_name }}:{{ services['ipmi-monitor'].port }}; + proxy_pass $upstream_ipmi/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /ipmi; + # Forward authentication headers from proxy auth + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + {% endif %} + {% if 'dc-overview' in services %} + # DC Overview API - returns JSON 401 for unauthenticated requests + location ~ ^/dc/api/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @api_unauthorized; + + set $upstream_dc http://{{ services['dc-overview'].container_name }}:{{ services['dc-overview'].port }}; + proxy_pass $upstream_dc/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /dc; + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # DC Overview / Server Manager - regex location to properly rewrite URI with variable proxy_pass + location ~ ^/dc/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @login_redirect; + + # Variable allows nginx to start even if service doesn't exist + set $upstream_dc http://{{ services['dc-overview'].container_name }}:{{ services['dc-overview'].port }}; + proxy_pass $upstream_dc/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /dc; + # Forward authentication headers from proxy auth + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # Shortcuts for /servers and /settings -> /dc/... + location = /servers { + return 301 /dc/servers; + } + location = /settings { + return 301 /dc/settings; + } + + {% endif %} + {% if 'grafana' in services %} + # Grafana - uses variable for runtime DNS resolution + location /grafana/ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + error_page 401 = @login_redirect; + + # Map Fleet roles to Grafana roles + set $grafana_role "Viewer"; + if ($auth_role = "admin") { + set $grafana_role "Admin"; + } + if ($auth_role = "readwrite") { + set $grafana_role "Editor"; + } + + # Variable allows nginx to start even if service doesn't exist + set $upstream_grafana http://{{ services['grafana'].container_name }}:{{ services['grafana'].port }}; + proxy_pass $upstream_grafana; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + # Pass authenticated user and role to Grafana + proxy_set_header X-WEBAUTH-USER $auth_user; + proxy_set_header X-WEBAUTH-ROLE $grafana_role; + proxy_read_timeout 300s; + + # Inject Fleet Management Home button into Grafana HTML + # target="_top" prevents Grafana's SPA router from intercepting the click + sub_filter '' ''; + sub_filter '' '
Home|Grafana
'; + sub_filter_once on; + sub_filter_types text/html; + proxy_set_header Accept-Encoding ""; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + {% endif %} + {% if 'prometheus' in services %} + # Prometheus - uses variable for runtime DNS resolution + # Prometheus is configured with --web.route-prefix=/prometheus/ so we must preserve the path + location /prometheus { + auth_request /_auth_check; + error_page 401 = @login_redirect; + + # Variable allows nginx to start even if service doesn't exist + set $upstream_prometheus http://{{ services['prometheus'].container_name }}:{{ services['prometheus'].port }}; + proxy_pass $upstream_prometheus; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 300s; + + # Inject Fleet Management Home button into Prometheus HTML + sub_filter '' ''; + sub_filter '' '
Home|Prometheus
'; + sub_filter_once on; + sub_filter_types text/html; + proxy_set_header Accept-Encoding ""; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + {% endif %} + {% if 'vastai-exporter' in services %} + # Vast.ai Exporter metrics endpoint + location /vastai-metrics/ { + auth_request /_auth_check; + error_page 401 = @login_redirect; + + set $upstream_vastai http://{{ services['vastai-exporter'].container_name }}:{{ services['vastai-exporter'].port }}; + proxy_pass $upstream_vastai/metrics; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 30s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + {% endif %} + {% if 'runpod-exporter' in services %} + # RunPod Exporter metrics endpoint + location /runpod-metrics/ { + auth_request /_auth_check; + error_page 401 = @login_redirect; + + set $upstream_runpod http://{{ services['runpod-exporter'].container_name }}:{{ services['runpod-exporter'].port }}; + proxy_pass $upstream_runpod/metrics; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 30s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + {% endif %} diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager-auth-blocks.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager-auth-blocks.conf.j2 new file mode 100644 index 0000000..5c4653c --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager-auth-blocks.conf.j2 @@ -0,0 +1,7 @@ + # VPM calls these endpoints only over the Docker network on port 8081. + # Exact locations keep the generic public /auth/ forwarding route from + # exposing the session authority or password reauthentication API. + location = /auth/vast-price-manager/session { return 404; } + location = /auth/vast-price-manager/session/ { return 404; } + location = /auth/vast-price-manager/reauth { return 404; } + location = /auth/vast-price-manager/reauth/ { return 404; } diff --git a/src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager.conf.j2 b/src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager.conf.j2 new file mode 100644 index 0000000..bee6989 --- /dev/null +++ b/src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager.conf.j2 @@ -0,0 +1,43 @@ + # Vast Price Manager has a dedicated admin-only route. It strips the + # prefix once and explicitly preserves the remainder and query string. + location = /_vast_pricing_admin { + internal; + proxy_pass http://127.0.0.1:8081/auth/vast-price-manager/authorize; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header Cookie $http_cookie; + proxy_set_header X-Original-URI $request_uri; + } + + location = /vast-pricing { + return 308 /vast-pricing/; + } + + location ~ ^/vast-pricing(?/.*)$ { + auth_request /_vast_pricing_admin; + error_page 401 = @login_redirect; + + # Runtime Docker DNS resolution permits startup before this opt-in + # service has been installed. + set $upstream_vast_price_manager vast-price-manager; + proxy_pass http://$upstream_vast_price_manager:8088$vpm_upstream_path$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + # VPM directly introspects the signed Fleet session on its + # configured internal origin. Never pass client identity headers. + proxy_set_header X-Fleet-Auth-User ""; + proxy_set_header X-Fleet-Auth-Role ""; + proxy_set_header X-Fleet-Auth-Token ""; + proxy_set_header X-Fleet-Authenticated ""; + # Preserve the browser Fleet cookie for VPM's direct introspection. + proxy_set_header Cookie $http_cookie; + # Auth-request failures still use the redirect above. Do not + # intercept VPM's own 401 reauthentication result, which must + # reach its caller as an error rather than a Fleet login redirect. + proxy_intercept_errors off; + error_page 502 503 504 = @service_unavailable; + } diff --git a/src/cryptolabs_proxy/updates.py b/src/cryptolabs_proxy/updates.py index afae181..9e98e6e 100644 --- a/src/cryptolabs_proxy/updates.py +++ b/src/cryptolabs_proxy/updates.py @@ -1,3 +1,4 @@ +# TRACEWEAVER: file-role=safe-update-recovery-diagnostics; req=REQ-UPDATER-002; trace=TRACE-UPDATER-002; ver=VER-UPDATER-002 """Serialized fleet image updates executed outside the serving proxy container. Job files contain only operation state, never container environments or Docker @@ -100,10 +101,12 @@ def __init__(self, job): class UpdateEngine(DockerEngine): - def _request(self, method, path, payload=None, allowed=(200, 201, 204)): + def _request(self, method, path, payload=None, allowed=(200, 201, 204), *, timeout=None): """Use an Engine API version accepted by the Docker 29 fleet host.""" if not path.startswith(f'/{DOCKER_API_VERSION}/'): path = f'/{DOCKER_API_VERSION}{path}' + if timeout is not None: + return super()._request(method, path, payload, allowed, timeout=timeout) return super()._request(method, path, payload, allowed) def image(self, reference): @@ -375,18 +378,48 @@ def wait_ready(engine, name, image_id, timeout=150): time.sleep(1) +_FAILURE_PHASES = frozenset({'inspect', 'image', 'prepare', 'stop', 'disconnect', + 'rename', 'create', 'start', 'readiness', 'remove', 'connect'}) + + +def _failure_diagnostics(phase, error, *, recovery=False): + """Return only fixed values; diagnostic inspection must never block recovery.""" + category = 'unknown' + try: + # Only unwrap our known transport wrapper, and only one level. Never + # inspect arbitrary chains, stringify errors, or expose class names. + cause = error.__cause__ if type(error) is MigrationError else None + classified = cause if cause is not None else error + if isinstance(classified, TimeoutError): + category = 'timeout' + elif isinstance(classified, OSError): + category = 'os_error' + elif type(classified) is UpdateError: + category = 'update_error' + elif type(classified) is MigrationError: + category = 'migration_error' + except Exception: + pass + prefix = 'recovery' if recovery else 'failure' + return {f'{prefix}_phase': phase if phase in _FAILURE_PHASES else 'unknown', + f'{prefix}_category': category} + + +# TRACEWEAVER: entrypoint=replace_container; req=REQ-UPDATER-002; trace=TRACE-UPDATER-002; ver=VER-UPDATER-002 def replace_container(engine, name, image, job_id, *, timeout=150, expected_id=None, policy=None, expected_image=None): """Swap without destroying the previous runtime; prove recovery on failure.""" backup = f'{name}.rollback-{job_id}' detached = [] started_stop = renamed = created = False source = None + phase = 'inspect' try: source = engine.inspect(name) if expected_id and source['Id'] != expected_id: raise UpdateError('Container changed during update preparation.') if not source.get('State', {}).get('Running'): raise UpdateError('Service is stopped; use its installer to start it.') + phase = 'image' candidate = engine.image(image) if expected_image and candidate['Id'] != expected_image: raise UpdateError('Candidate changed during update preparation.') @@ -395,6 +428,7 @@ def replace_container(engine, name, image, job_id, *, timeout=150, expected_id=N if candidate['Id'] == source['Image'] and (not policy or (source['Config'].get('Labels') or {}).get(WATCHTOWER_LABEL) == 'false'): return {'success': True, 'state': 'unchanged', 'image_id': source['Image'], 'message': 'Already running the selected image.'} if name == 'cryptolabs-proxy': return _proxy_hold() + phase = 'prepare' request = build_update_request(source, engine.image(source['Image']), candidate) if policy: request['Config']['Labels'].update({WATCHTOWER_LABEL: 'false', @@ -403,36 +437,49 @@ def replace_container(engine, name, image, job_id, *, timeout=150, expected_id=N request['Config']['Labels'].update({CHANNEL_LABEL: image, IMAGE_LABEL: candidate['Id']}) endpoints = request['NetworkingConfig']['EndpointsConfig'] started_stop = True + phase = 'stop' engine.stop(name) for network in endpoints: + phase = 'disconnect' engine.disconnect(name, network) detached.append(network) + phase = 'rename' engine.rename(name, backup) renamed = True + phase = 'create' engine.create(name, request) created = True + phase = 'start' engine.start(name) + phase = 'readiness' if not wait_ready(engine, name, candidate['Id'], timeout): raise UpdateError('Replacement failed application health or image verification.') return {'success': True, 'state': 'completed', 'image_id': candidate['Id'], 'rollback_container': backup, 'message': 'Updated and health verified.'} except Exception as error: + failure = _failure_diagnostics(phase, error) message = str(error) if isinstance(error, UpdateError) else 'Container update failed.' if not started_stop: - return {'success': False, 'state': 'failed', 'message': message} + return {'success': False, 'state': 'failed', 'message': message, **failure} try: if created: + phase = 'remove' engine.remove(name, ignore_missing=True) if renamed: + phase = 'rename' engine.rename(backup, name) for network in detached: + phase = 'connect' engine.connect(name, network, endpoints[network]) + phase = 'start' engine.start(name) + phase = 'readiness' if not wait_ready(engine, name, source['Image'], timeout): raise UpdateError('Original service did not recover.') - return {'success': False, 'state': 'rolled_back', 'message': message + ' Original service restored and health verified.'} - except Exception: - return {'success': False, 'state': 'recovery_required', 'message': message + ' Automatic recovery was not verified; operator recovery required.', 'rollback_container': backup if renamed else name} + return {'success': False, 'state': 'rolled_back', 'message': message + ' Original service restored and health verified.', **failure} + except Exception as recovery_error: + return {'success': False, 'state': 'recovery_required', 'message': message + ' Automatic recovery was not verified; operator recovery required.', 'rollback_container': backup if renamed else name, + **failure, **_failure_diagnostics(phase, recovery_error, recovery=True)} def _job_path(directory, job_id): diff --git a/tests/fixtures/released-standard-1.5.4-declaration.json b/tests/fixtures/released-standard-1.5.4-declaration.json new file mode 100644 index 0000000..569915a --- /dev/null +++ b/tests/fixtures/released-standard-1.5.4-declaration.json @@ -0,0 +1,44 @@ +{ + "schema_version": 1, + "domain": "fleet.example.test", + "tls": "self-signed", + "services": { + "ipmi-monitor": { + "container_name": "ipmi-monitor", + "path": "/ipmi/", + "port": 5000 + }, + "dc-overview": { + "container_name": "dc-overview", + "path": "/dc/", + "port": 5001 + }, + "grafana": { + "container_name": "grafana", + "path": "/grafana/", + "port": 3000 + }, + "prometheus": { + "container_name": "prometheus", + "path": "/prometheus/", + "port": 9090 + }, + "vastai-exporter": { + "container_name": "vastai-exporter", + "path": "/vastai-metrics/", + "port": 8622 + }, + "runpod-exporter": { + "container_name": "runpod-exporter", + "path": "/runpod-metrics/", + "port": 8623 + }, + "vast-price-manager": { + "container_name": "vast-price-manager", + "path": "/vast-pricing/", + "port": 8088 + } + }, + "obsolete_overlays": [], + "obsolete_owner_labels": [] +} diff --git a/tests/fixtures/released-standard-1.5.4-provenance.json b/tests/fixtures/released-standard-1.5.4-provenance.json new file mode 100644 index 0000000..3246d5e --- /dev/null +++ b/tests/fixtures/released-standard-1.5.4-provenance.json @@ -0,0 +1,30 @@ +{ + "schema": "released-render-fixture/1", + "release": "v1.5.4", + "commit": "61565a7228539a0b8b0bfb602e06ea3efcc6b94a", + "templates": { + "nginx.conf.j2": "f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de", + "acme-challenge.conf.j2": "7e594162700825757c9d402971094448aa1834d1f7121ac1c02f152f345e149a", + "fleet-api-routes.conf.j2": "6991ca6bf1dd4b258e8ee7851fc69ef50b19dfe2353570e4911a0ebadc68ed1b", + "exporter-auth-routes.conf.j2": "450f4c418c09474ac45b6dd314c47cc090fe7d230a0206b30e48c7975023133b", + "host-forwarding.conf.j2": "35c4a1fe1d3001865a77d7653350b7a61968953b94172dc7063bc31a42c0f9f7", + "standard-service-routes.conf.j2": "ef0f55aae48e35127d288781e68281a371505ba27384c8fd04dff9200dce3963", + "vast-price-manager-auth-blocks.conf.j2": "b9d7013434557492887b0600bc2afc92227ee17f9efebe55b0cccc4b16bd3f81", + "vast-price-manager.conf.j2": "32483d169a09c42653396e66c5c7efe1995bd599f44f11ee64fa2f0731a0a2f8" + }, + "fixture_sha256": "f1aa7a0ed767e7432dd21123fc0086e0cc98e0b26ad3c95eff5fe233095e3e72", + "declaration": "released-standard-1.5.4-declaration.json", + "declaration_sha256": "c4f4f3e80ff3920522502f47335120e133bca6d8e8245133d0112b550f382274", + "render_options": { + "autoescape": [ + "html", + "xml" + ], + "trim_blocks": true, + "lstrip_blocks": true + }, + "renderer": "Jinja2 Environment with DictLoader containing exactly8git-tag blobs; no production render_standard/historical compatibility helper used", + "source_compare": "All8tag blobs equal independently archived released154 source; services.py byte-identical to tag; references finite and all resolve within8blob closure", + "safety": "Synthetic domain/declaration only; no exported live configuration", + "raw_reproduction_script": "/Users/hanneszietsman/CrypotAI/artifacts/ipmi-sel-release-20261104/artifacts/updater-compatibility-red/render-fixture.py" +} diff --git a/tests/fixtures/released-standard-1.5.4.nginx.conf b/tests/fixtures/released-standard-1.5.4.nginx.conf new file mode 100644 index 0000000..89b73db --- /dev/null +++ b/tests/fixtures/released-standard-1.5.4.nginx.conf @@ -0,0 +1,540 @@ +worker_processes auto; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + client_max_body_size 100M; + + # Gzip compression + gzip on; + gzip_vary on; + gzip_proxied any; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml; + + # Rate limiting + limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s; + + server { + listen 80; + listen 443 ssl http2; + server_name fleet.example.test; + + ssl_certificate /etc/nginx/ssl/server.crt; + ssl_certificate_key /etc/nginx/ssl/server.key; + ssl_protocols TLSv1.2 TLSv1.3; + + # DNS resolver for Docker networks - CRITICAL for runtime resolution + # This allows nginx to start even if backend services don't exist yet + resolver 127.0.0.11 valid=10s ipv6=off; + resolver_timeout 5s; + + # Security headers + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; + + # ===================================================== + # ERROR HANDLERS + # ===================================================== + + location @service_unavailable { + default_type application/json; + return 503 '{"error":"Service unavailable","message":"The requested service is not running. Install it or wait for it to start."}'; + } + + # ===================================================== + # AUTHENTICATION + # ===================================================== + + # Auth server endpoints (public) + location /auth/ { + proxy_pass http://127.0.0.1:8081/auth/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Internal auth verification endpoint (for auth_request) + location = /_auth_check { + internal; + proxy_pass http://127.0.0.1:8081/auth/headers; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + proxy_set_header Cookie $http_cookie; + } + + # ===================================================== + # Internal API (blocked from public access) + # Only reachable via direct Docker network (172.30.0.10:8080) + # ===================================================== + location /internal/ { + return 403; + } + + # ===================================================== + # PUBLIC ENDPOINTS (no auth required) + # ===================================================== + + # Health check API (always public) + location /api/health { + default_type application/json; + return 200 '{"status":"ok","proxy":"running"}'; + } + + # Service health check (internal, no auth) + location /api/services { + proxy_pass http://127.0.0.1:8080/api/services; + proxy_set_header Host $host; + } + + location /api/build-info { + proxy_pass http://127.0.0.1:8080/api/build-info; + } + + # Version management and update endpoints (protected) + location /api/versions { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/versions; + proxy_set_header Host $host; + proxy_connect_timeout 10s; + proxy_read_timeout 30s; + } + + location /api/update-settings { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/update-settings; + proxy_set_header Host $host; + proxy_set_header Content-Type $http_content_type; + proxy_connect_timeout 5s; + proxy_read_timeout 10s; + } + + location /api/update { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/update; + proxy_set_header Host $host; + proxy_set_header Content-Type $http_content_type; + proxy_connect_timeout 10s; + proxy_read_timeout 120s; # Updates can take time + } + + location /api/pull { + auth_request /_auth_check; + error_page 401 = @api_unauthorized; + proxy_pass http://127.0.0.1:8080/api/pull; + proxy_set_header Host $host; + proxy_set_header Content-Type $http_content_type; + proxy_connect_timeout 10s; + proxy_read_timeout 300s; # Image pulls can be slow + } + + location @api_unauthorized { + default_type application/json; + return 401 '{"error":"Authentication required"}'; + } + location /assets/ { + alias /usr/share/nginx/html/assets/; + expires 1h; + } + # Static assets (no auth) + location /static/ { + root /usr/share/nginx/html; + } + + # ===================================================== + # PROTECTED ENDPOINTS (auth required) + # ===================================================== + + # Fleet Management Landing Page (requires auth) + location = / { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + + # Redirect to login if not authenticated + error_page 401 = @login_redirect; + + root /usr/share/nginx/html; + index index.html; + } + + location @login_redirect { + return 302 /auth/login?next=$request_uri; + } + + # VPM calls these endpoints only over the Docker network on port 8081. + # Exact locations keep the generic public /auth/ forwarding route from + # exposing the session authority or password reauthentication API. + location = /auth/vast-price-manager/session { return 404; } + location = /auth/vast-price-manager/session/ { return 404; } + location = /auth/vast-price-manager/reauth { return 404; } + location = /auth/vast-price-manager/reauth/ { return 404; } + # Vast Price Manager has a dedicated admin-only route. It strips the + # prefix once and explicitly preserves the remainder and query string. + location = /_vast_pricing_admin { + internal; + proxy_pass http://127.0.0.1:8081/auth/vast-price-manager/authorize; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header Cookie $http_cookie; + proxy_set_header X-Original-URI $request_uri; + } + + location = /vast-pricing { + return 308 /vast-pricing/; + } + + location ~ ^/vast-pricing(?/.*)$ { + auth_request /_vast_pricing_admin; + error_page 401 = @login_redirect; + + # Runtime Docker DNS resolution permits startup before this opt-in + # service has been installed. + set $upstream_vast_price_manager vast-price-manager; + proxy_pass http://$upstream_vast_price_manager:8088$vpm_upstream_path$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + # VPM directly introspects the signed Fleet session on its + # configured internal origin. Never pass client identity headers. + proxy_set_header X-Fleet-Auth-User ""; + proxy_set_header X-Fleet-Auth-Role ""; + proxy_set_header X-Fleet-Auth-Token ""; + proxy_set_header X-Fleet-Authenticated ""; + # Preserve the browser Fleet cookie for VPM's direct introspection. + proxy_set_header Cookie $http_cookie; + # Auth-request failures still use the redirect above. Do not + # intercept VPM's own 401 reauthentication result, which must + # reach its caller as an error rather than a Fleet login redirect. + proxy_intercept_errors off; + error_page 502 503 504 = @service_unavailable; + } + # IPMI Monitor API - returns JSON 401 for unauthenticated requests + location ~ ^/ipmi/api/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @api_unauthorized; + + set $upstream_ipmi http://ipmi-monitor:5000; + proxy_pass $upstream_ipmi/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /ipmi; + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # IPMI Monitor - regex location to properly rewrite URI with variable proxy_pass + location ~ ^/ipmi/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @login_redirect; + + # Variable allows nginx to start even if service doesn't exist + set $upstream_ipmi http://ipmi-monitor:5000; + proxy_pass $upstream_ipmi/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /ipmi; + # Forward authentication headers from proxy auth + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # DC Overview API - returns JSON 401 for unauthenticated requests + location ~ ^/dc/api/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @api_unauthorized; + + set $upstream_dc http://dc-overview:5001; + proxy_pass $upstream_dc/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /dc; + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # DC Overview / Server Manager - regex location to properly rewrite URI with variable proxy_pass + location ~ ^/dc/(.*)$ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + auth_request_set $auth_token $upstream_http_x_fleet_auth_token; + error_page 401 = @login_redirect; + + # Variable allows nginx to start even if service doesn't exist + set $upstream_dc http://dc-overview:5001; + proxy_pass $upstream_dc/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Script-Name /dc; + # Forward authentication headers from proxy auth + proxy_set_header X-Fleet-Auth-User $auth_user; + proxy_set_header X-Fleet-Auth-Role $auth_role; + proxy_set_header X-Fleet-Auth-Token $auth_token; + proxy_set_header X-Fleet-Authenticated true; + proxy_read_timeout 300s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # Shortcuts for /servers and /settings -> /dc/... + location = /servers { + return 301 /dc/servers; + } + location = /settings { + return 301 /dc/settings; + } + + # Grafana - uses variable for runtime DNS resolution + location /grafana/ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + error_page 401 = @login_redirect; + + # Map Fleet roles to Grafana roles + set $grafana_role "Viewer"; + if ($auth_role = "admin") { + set $grafana_role "Admin"; + } + if ($auth_role = "readwrite") { + set $grafana_role "Editor"; + } + + # Variable allows nginx to start even if service doesn't exist + set $upstream_grafana http://grafana:3000; + proxy_pass $upstream_grafana; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + # Pass authenticated user and role to Grafana + proxy_set_header X-WEBAUTH-USER $auth_user; + proxy_set_header X-WEBAUTH-ROLE $grafana_role; + proxy_read_timeout 300s; + + # Inject Fleet Management Home button into Grafana HTML + # target="_top" prevents Grafana's SPA router from intercepting the click + sub_filter '' ''; + sub_filter '' '
Home|Grafana
'; + sub_filter_once on; + sub_filter_types text/html; + proxy_set_header Accept-Encoding ""; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # Prometheus - uses variable for runtime DNS resolution + # Prometheus is configured with --web.route-prefix=/prometheus/ so we must preserve the path + location /prometheus { + auth_request /_auth_check; + error_page 401 = @login_redirect; + + # Variable allows nginx to start even if service doesn't exist + set $upstream_prometheus http://prometheus:9090; + proxy_pass $upstream_prometheus; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 300s; + + # Inject Fleet Management Home button into Prometheus HTML + sub_filter '' ''; + sub_filter '' '
Home|Prometheus
'; + sub_filter_once on; + sub_filter_types text/html; + proxy_set_header Accept-Encoding ""; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # Vast.ai Exporter metrics endpoint + location /vastai-metrics/ { + auth_request /_auth_check; + error_page 401 = @login_redirect; + + set $upstream_vastai http://vastai-exporter:8622; + proxy_pass $upstream_vastai/metrics; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 30s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + # RunPod Exporter metrics endpoint + location /runpod-metrics/ { + auth_request /_auth_check; + error_page 401 = @login_redirect; + + set $upstream_runpod http://runpod-exporter:8623; + proxy_pass $upstream_runpod/metrics; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 30s; + + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + + # Vast Price Manager uses its dedicated admin-only route above. + # Vast Price Manager uses its dedicated admin-only route above. + # Vast Price Manager uses its dedicated admin-only route above. + # Vast Price Manager uses its dedicated admin-only route above. + # Vast Price Manager uses its dedicated admin-only route above. + # Vast Price Manager uses its dedicated admin-only route above. + # Vast Price Manager uses its dedicated admin-only route above. + + # Exporter management pages - served by auth server + location /vastai/ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + error_page 401 = @login_redirect; + proxy_pass http://127.0.0.1:8081/vastai/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /runpod/ { + auth_request /_auth_check; + auth_request_set $auth_user $upstream_http_x_fleet_auth_user; + auth_request_set $auth_role $upstream_http_x_fleet_auth_role; + error_page 401 = @login_redirect; + proxy_pass http://127.0.0.1:8081/runpod/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Exporter account APIs require a current Fleet administrator. + location = /_exporter_admin { + internal; + proxy_pass http://127.0.0.1:8081/auth/exporters/authorize; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header Cookie $http_cookie; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Capture the suffix explicitly: variable proxy_pass does not replace + # a prefix URI. Preserve query arguments and never accept a client token. + location ~ ^/vastai-api/(.*)$ { + auth_request /_exporter_admin; + auth_request_set $mgmt_token $upstream_http_x_mgmt_token; + set $upstream_vastai_api http://vastai-exporter:8622; + proxy_pass $upstream_vastai_api/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Mgmt-Token $mgmt_token; + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + + location ~ ^/runpod-api/(.*)$ { + auth_request /_exporter_admin; + auth_request_set $mgmt_token $upstream_http_x_mgmt_token; + set $upstream_runpod_api http://runpod-exporter:8623; + proxy_pass $upstream_runpod_api/api/$1$is_args$args; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Mgmt-Token $mgmt_token; + proxy_intercept_errors on; + error_page 502 503 504 = @service_unavailable; + } + # Default: show landing page + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } + } + +} \ No newline at end of file diff --git a/tests/test_proxy_lifecycle_review_repairs.py b/tests/test_proxy_lifecycle_review_repairs.py index a833bf2..76c0679 100644 --- a/tests/test_proxy_lifecycle_review_repairs.py +++ b/tests/test_proxy_lifecycle_review_repairs.py @@ -1,3 +1,6 @@ +# TRACEWEAVER: file-role=real-stop-socket-deadline; req=REQ-UPDATER-001; trace=TRACE-UPDATER-001; ver=VER-UPDATER-001 +# TRACEWEAVER: verifies=VER-UPDATER-001; req=REQ-UPDATER-001; trace=TRACE-UPDATER-001 +# TRACEWEAVER: file-role=real-stop-socket-deadline; req=REQ-UPDATER-001; trace=TRACE-UPDATER-001; ver=VER-UPDATER-001 """Customer lifecycle regressions; real auth, renderer, switch, and file locks.""" from contextlib import contextmanager from copy import deepcopy @@ -14,6 +17,111 @@ from tests.test_standard_adoption import Engine, REF, system +@contextmanager +def delayed_stop_socket(delay): + """Real HTTP/Unix boundary; only the remote Docker response is substituted.""" + import socket + import threading + # macOS AF_UNIX paths are short; pytest's tmp_path can exceed 104 bytes. + import tempfile + with tempfile.TemporaryDirectory(prefix='stop-ack-', dir='/tmp') as directory: + socket_path = str(Path(directory) / 'docker.sock') + listener = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + listener.bind(socket_path) + listener.listen(1) + listener.settimeout(5) + requests, errors = [], [] + finish = threading.Event() + + def serve(): + try: + connection, _ = listener.accept() + with connection: + connection.settimeout(5) + request = b'' + while b'\r\n\r\n' not in request: + part = connection.recv(4096) + if not part: + raise AssertionError('client closed before HTTP headers') + request += part + requests.append(request.split(b'\r\n', 1)[0].decode()) + if not finish.wait(delay): + try: + connection.sendall(b'HTTP/1.1 204 No Content\r\nContent-Length: 0\r\n\r\n') + except BrokenPipeError: + pass # Expected when a bounded client times out. + except Exception as error: + errors.append(error) + + thread = threading.Thread(target=serve) + thread.start() + try: + yield socket_path, requests + finally: + finish.set() + listener.close() + thread.join(timeout=6) + assert not thread.is_alive() + assert not errors, errors + + +def test_stop_delayed_ack_uses_headroom_without_changing_grace(monkeypatch): + """Short regression; opt in to the same default-15s path for release proof.""" + from cryptolabs_proxy import migration + full_duration = os.environ.get('UPDATER_FULL_DURATION') == '1' + transport = 15 if full_duration else .2 + delay = 15.25 if full_duration else .6 + if not full_duration: + monkeypatch.setattr(migration, 'STOP_ACK_HEADROOM', .35, raising=False) + with delayed_stop_socket(delay) as (socket_path, requests): + engine = updates.UpdateEngine(socket_path=socket_path, timeout=transport) + engine.stop('service/name') + assert requests == [f'POST /v1.45/containers/service%2Fname/stop?t={max(1, transport - 2)} HTTP/1.1'] + assert engine.timeout == transport + + +def test_stop_ack_exceeding_budget_is_bounded_and_recovers(monkeypatch): + import time + from cryptolabs_proxy import migration + from tests.test_updates import Engine as UpdateFixtureEngine + + monkeypatch.setattr(migration, 'STOP_ACK_HEADROOM', .35, raising=False) + with delayed_stop_socket(5) as (socket_path, requests): + socket_engine = updates.UpdateEngine(socket_path=socket_path, timeout=.2) + + class SocketStopEngine(UpdateFixtureEngine): + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + socket_engine.stop(name, **kwargs) + + engine = SocketStopEngine() + started = time.monotonic() + result = updates.replace_container(engine, 'prometheus', 'sha256:new', 'job', timeout=0) + elapsed = time.monotonic() - started + # Preserved short-caller grace 1s + .35s ACK headroom, with scheduler tolerance. + assert 1.2 <= elapsed < 3, elapsed + assert result['state'] == 'rolled_back' + assert result['failure_phase'] == 'stop' + assert result['failure_category'] == 'timeout' + assert engine.inspect('prometheus')['State']['Running'] is True + assert requests == ['POST /v1.45/containers/prometheus/stop?t=1 HTTP/1.1'] + assert not any(call[0] in ('rename', 'create') for call in engine.calls) + + +def test_non_stop_socket_request_keeps_its_transport_budget(): + """Raising the global timeout must not accidentally satisfy the stop test.""" + import time + from cryptolabs_proxy.migration import MigrationError + with delayed_stop_socket(5) as (socket_path, requests): + engine = updates.UpdateEngine(socket_path=socket_path, timeout=.2) + started = time.monotonic() + with pytest.raises(MigrationError) as caught: + engine.inspect('prometheus') + assert isinstance(caught.value.__cause__, TimeoutError) + assert time.monotonic() - started < 1 + assert requests == ['GET /v1.45/containers/prometheus/json HTTP/1.1'] + + def archive(directory): output = io.BytesIO() with tarfile.open(fileobj=output, mode='w') as bundle: diff --git a/tests/test_standard_adoption.py b/tests/test_standard_adoption.py index d0410ef..b217859 100644 --- a/tests/test_standard_adoption.py +++ b/tests/test_standard_adoption.py @@ -1,3 +1,6 @@ +# TRACEWEAVER: file-role=historical-adoption-contract; req=REQ-UPDATER-003; trace=TRACE-UPDATER-003; ver=VER-UPDATER-003 +# TRACEWEAVER: verifies=VER-UPDATER-003; req=REQ-UPDATER-003; trace=TRACE-UPDATER-003 +# TRACEWEAVER: file-role=historical-adoption-contract; req=REQ-UPDATER-003; trace=TRACE-UPDATER-003; ver=VER-UPDATER-003 """Synthetic standard adoption: production render and compensated switch path.""" import hashlib import json @@ -70,11 +73,16 @@ def connect(self,name,network,endpoint): self.calls.append(('connect',name,netwo def remove(self,name,ignore_missing=False): self.calls.append(('remove',name)); self.containers.pop(name,None) -def system(tmp_path,monkeypatch): +def system(tmp_path,monkeypatch, *, historical=False): from cryptolabs_proxy.standard_adoption import StandardAdoption settings=declaration(tmp_path); directory=tmp_path/'config'; directory.mkdir() generate_nginx_config(directory,settings['domain'],False,{n:DEFAULT_SERVICES[n] for n in KNOWN}) config=(directory/'nginx.conf').read_bytes() + if historical: + fixtures=Path(__file__).with_name('fixtures') + recorded=json.loads((fixtures/'released-standard-1.5.4-declaration.json').read_text()) + assert {k:v for k,v in settings.items() if k!='release_selection_dir'}==recorded + config=(fixtures/'released-standard-1.5.4.nginx.conf').read_bytes() reg=ServiceRegistry(directory); reg.config={'custom_config':{'mode':'vpm-managed','baseline_path':'private-old','baseline_sha256':'b'*64}}; reg.services={'vast-price-manager':DEFAULT_SERVICES['vast-price-manager']}; reg.save() engine=Engine(config); adoption=StandardAdoption(directory,engine=engine) monkeypatch.setattr('cryptolabs_proxy.standard_adoption.os', SimpleNamespace(geteuid=lambda: 0)) @@ -124,10 +132,12 @@ def test_plan_rejects_unsupported_without_mutation(tmp_path,monkeypatch,change): assert engine.calls==[] and ServiceRegistry(directory).config['custom_config'] -@pytest.mark.parametrize('change',['source','config','selection','digest','validation','mount-source','mount-rw','mount-option','mount-add','mount-remove','env-order']) -def test_adopt_preflight_denial_stops_nothing(tmp_path,monkeypatch,change): +@pytest.mark.parametrize('historical,change', + [(False,c) for c in ['source','config','selection','digest','validation','mount-source','mount-rw','mount-option','mount-add','mount-remove','env-order']] + +[(True,'source'),(True,'selection')]) +def test_adopt_preflight_denial_stops_nothing(tmp_path,monkeypatch,change,historical): from cryptolabs_proxy.standard_adoption import AdoptionError - adoption,engine,settings,directory=system(tmp_path,monkeypatch); plan=adoption.plan(settings) + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) if change=='source': engine.current['Config']['Env'].append('NEW=drift') if change=='config': engine.config+=b'\n# drift' if change=='selection': (Path(settings['release_selection_dir'])/'selection.json').write_text('{}') @@ -144,8 +154,10 @@ def test_adopt_preflight_denial_stops_nothing(tmp_path,monkeypatch,change): assert ServiceRegistry(directory).config['custom_config'] -def test_adopt_preserves_private_identity_tls_networks_and_repeat(tmp_path,monkeypatch): - adoption,engine,settings,directory=system(tmp_path,monkeypatch) +@pytest.mark.parametrize('historical',[False,True]) +def test_adopt_preserves_private_identity_tls_networks_and_repeat(tmp_path,monkeypatch,historical): + from cryptolabs_proxy.standard_adoption import render_standard, _declaration + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical) inspect=engine.inspect from itertools import count inspections=count() @@ -157,7 +169,12 @@ def rotating_mounts(name): return observed monkeypatch.setattr(engine,'inspect',rotating_mounts) plan=adoption.plan(settings) + assert plan['source_profile']==('released-standard-1.5.4' if historical else 'standard') + expected=render_standard(_declaration(settings)) + assert plan['candidate_sha256']==hashlib.sha256(expected).hexdigest() + assert b'location ^~ /api/account-link/ {' in expected outcome=adoption.adopt(settings,plan['plan_id']); assert outcome['state']=='adopted' + assert engine.config==expected request=engine.request assert request['Config']['Env'][:3]==engine.current['Config']['Env'] assert request['Config']['Labels']['com.centurylinklabs.watchtower.enable']=='false' @@ -174,9 +191,10 @@ def rotating_mounts(name): calls=len(engine.calls); assert adoption.adopt(settings,plan['plan_id'])['state']=='already_adopted'; assert len(engine.calls)==calls -def test_late_health_failure_restores_files_and_consistent_source_auth(tmp_path,monkeypatch): +@pytest.mark.parametrize('historical',[False,True]) +def test_late_health_failure_restores_files_and_consistent_source_auth(tmp_path,monkeypatch,historical): from cryptolabs_proxy.standard_adoption import AdoptionError - adoption,engine,settings,directory=system(tmp_path,monkeypatch); plan=adoption.plan(settings) + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) before={p.name:p.read_bytes() for p in directory.iterdir()}; engine.fail_health=True with pytest.raises(AdoptionError): adoption.adopt(settings,plan['plan_id']) assert engine.containers['cryptolabs-proxy']['Image']=='sha256:old' and engine.containers['cryptolabs-proxy']['State']['Running'] @@ -468,9 +486,55 @@ def test_interactive_setup_cannot_overwrite_custom_mode(tmp_path,monkeypatch): assert ServiceRegistry(tmp_path).config['custom_config'] -def test_selected_image_must_have_normal_auth_module_even_without_overlay(tmp_path,monkeypatch): +@pytest.mark.parametrize('historical',[False,True]) +def test_selected_image_must_have_normal_auth_module_even_without_overlay(tmp_path,monkeypatch,historical): from cryptolabs_proxy.standard_adoption import AdoptionError - adoption,engine,settings,directory=system(tmp_path,monkeypatch); plan=adoption.plan(settings) + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=historical); plan=adoption.plan(settings) monkeypatch.setattr(engine,'artifact_file_sha256',lambda *args:'0'*64,raising=False) with pytest.raises(AdoptionError): adoption.adopt(settings,plan['plan_id']) assert not [c for c in engine.calls if c[0]=='stop'] + + +@pytest.mark.parametrize('change',['directive','upstream','auth','extra-server','extra-route','route-order']) +def test_historical_full_tree_changes_are_rejected_before_mutation(tmp_path,monkeypatch,change): + from cryptolabs_proxy.standard_adoption import AdoptionError + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=True) + original=engine.config + if change=='directive': engine.config=original.replace(b'keepalive_timeout 65;',b'keepalive_timeout 66;',1) + if change=='upstream': engine.config=original.replace(b'http://dc-overview:5001',b'http://unapproved:5001',1) + if change=='auth': engine.config=original.replace(b'auth_request /_auth_check;',b'',1) + if change=='extra-server': engine.config=original.replace(b'http {',b'http { server { listen 8089; return 200; }',1) + if change=='extra-route': engine.config=original.replace(b'server_name fleet.example.test;',b'server_name fleet.example.test; location /unapproved/ { return 200; }',1) + if change=='route-order': + # Swap complete regex route blocks, retaining their original bodies. + def block(header): + start=original.index(header); opening=original.index(b'{',start); depth=1; end=opening+1 + while depth: + depth+=(original[end:end+1]==b'{')-(original[end:end+1]==b'}'); end+=1 + return start,end + first,last=sorted([block(b'location ~ ^/ipmi/api/(.*)$'),block(b'location ~ ^/dc/(.*)$')]) + a,b=first; c,d=last + engine.config=original[:a]+original[c:d]+original[b:c]+original[a:b]+original[d:] + assert engine.config!=original + with pytest.raises(AdoptionError,match='unsupported_source_behavior'): + adoption.plan(settings) + assert not engine.calls + assert engine.current['State']['Running'] + + +@pytest.mark.parametrize('resource',['nginx.conf.j2','fleet-api-routes.conf.j2','provenance.json']) +def test_historical_resource_drift_fails_closed(tmp_path,monkeypatch,resource): + from cryptolabs_proxy.standard_adoption import AdoptionError + adoption,engine,settings,directory=system(tmp_path,monkeypatch,historical=True) + read=Path.read_bytes; changed=[] + def drift(path): + data=read(path) + if path.parent.name=='released-standard-1.5.4' and path.name==resource: + changed.append(path.name) + return b'{}' if resource=='provenance.json' else data+b'\n# altered package\n' + return data + monkeypatch.setattr(Path,'read_bytes',drift) + with pytest.raises(AdoptionError,match='historical_profile_unavailable'): + adoption.plan(settings) + assert changed==[resource] + assert not engine.calls diff --git a/tests/test_updates.py b/tests/test_updates.py index b49cfb3..afc28a8 100644 --- a/tests/test_updates.py +++ b/tests/test_updates.py @@ -1,3 +1,6 @@ +# TRACEWEAVER: file-role=persisted-updater-failure-contract; req=REQ-UPDATER-002; trace=TRACE-UPDATER-002; ver=VER-UPDATER-002 +# TRACEWEAVER: verifies=VER-UPDATER-002; req=REQ-UPDATER-002; trace=TRACE-UPDATER-002 +# TRACEWEAVER: file-role=persisted-updater-failure-contract; req=REQ-UPDATER-002; trace=TRACE-UPDATER-002; ver=VER-UPDATER-002 """Updater failures must not destroy existing runtime state or conceal outcomes.""" import importlib.util import json @@ -148,6 +151,71 @@ def test_inspection_failure_never_stops_original(): assert not engine.calls +@pytest.mark.parametrize('phase,category,recovery_fails', [ + ('stop', 'timeout', False), + ('disconnect', 'os_error', False), + ('stop', 'unknown', False), + ('stop', 'timeout', True), +]) +def test_worker_persists_safe_primary_and_recovery_diagnostics( + monkeypatch, tmp_path, phase, category, recovery_fails): + """An ambiguous failed stop needs safe phase/cause evidence after recovery. + + Reuse the worker's actual persistence path, rather than serializing a + hand-built result. The source may already be stopped when its ACK fails. + """ + secret = 'synthetic-credential-must-never-be-recorded' + + class PrivateFailure(RuntimeError): + def __str__(self): + raise AssertionError('diagnostics must not format unknown exceptions') + + class FailingEngine(Engine): + def fail(self): + if category == 'unknown': + raise PrivateFailure(secret) + cause = TimeoutError(secret) if category == 'timeout' else OSError(secret) + raise updates.MigrationError(secret) from cause + + def stop(self, name, **kwargs): + super().stop(name, **kwargs) + if phase == 'stop': + self.fail() + + def disconnect(self, name, network): + super().disconnect(name, network) + if phase == 'disconnect': + self.fail() + + def start(self, name): + if recovery_fails: + raise OSError(secret) + super().start(name) + + engine = FailingEngine() + monkeypatch.setattr(updates, 'pull_target', lambda target: True) + job = {'id': 'e' * 32, 'service': 'prometheus', 'branch': 'main', 'action': 'update'} + updates.write_job(tmp_path, job) + returned = updates.run_job(tmp_path, job['id'], engine=engine) + stored = updates.read_job(tmp_path, job['id']) + assert stored == returned + result = stored['results']['prometheus'] + assert result['state'] == ('recovery_required' if recovery_fails else 'rolled_back') + assert result['success'] is False + assert result['failure_phase'] == phase + assert result['failure_category'] == category + if recovery_fails: + assert result['recovery_phase'] == 'start' + assert result['recovery_category'] == 'os_error' + else: + assert 'recovery_phase' not in result + assert 'recovery_category' not in result + assert engine.inspect('prometheus')['State']['Running'] is True + assert secret not in json.dumps(stored) + assert 'PrivateFailure' not in json.dumps(stored) + assert not any(call[0] in ('rename', 'create') for call in engine.calls) + + def test_success_retains_old_container_and_verifies_new_identity(): engine = Engine() result = updates.replace_container(engine, 'prometheus', 'sha256:new', 'job', timeout=0) diff --git a/traceability-matrix.md b/traceability-matrix.md index 8c0c607..54f0476 100644 --- a/traceability-matrix.md +++ b/traceability-matrix.md @@ -10,6 +10,9 @@ | TRACE-PAIR-004 | REQ-PAIR-004 | src/cryptolabs_proxy/auth.py; src/cryptolabs_proxy/account_link.py; tests/test_account_link.py; nginx/nginx.conf; src/cryptolabs_proxy/templates/nginx.conf.j2 | VER-PAIR-004 | VAL-PAIR-004 | Owner-approved source authority; reviewed scope | | TRACE-PAIR-005 | REQ-PAIR-005 | src/cryptolabs_proxy/auth.py; src/cryptolabs_proxy/account_link.py; tests/test_account_link.py; nginx/nginx.conf; src/cryptolabs_proxy/templates/nginx.conf.j2 | VER-PAIR-005 | VAL-PAIR-005 | Owner-approved source authority; reviewed scope | | TRACE-PAIR-006 | REQ-PAIR-006 | src/cryptolabs_proxy/auth.py; src/cryptolabs_proxy/account_link.py; tests/test_account_link.py; nginx/nginx.conf; src/cryptolabs_proxy/templates/nginx.conf.j2 | VER-PAIR-006 | VAL-PAIR-006 | Owner-approved source authority; reviewed scope | +| TRACE-UPDATER-001 | REQ-UPDATER-001 | src/cryptolabs_proxy/migration.py; src/cryptolabs_proxy/updates.py; tests/test_updates.py; tests/test_proxy_lifecycle_review_repairs.py | VER-UPDATER-001 | VAL-UPDATER-001 | Owner-approved source implementation scope | +| TRACE-UPDATER-002 | REQ-UPDATER-002 | src/cryptolabs_proxy/migration.py; src/cryptolabs_proxy/updates.py; tests/test_updates.py; tests/test_proxy_lifecycle_review_repairs.py | VER-UPDATER-002 | VAL-UPDATER-002 | Owner-approved source implementation scope | +| TRACE-UPDATER-003 | REQ-UPDATER-003 | src/cryptolabs_proxy/standard_adoption.py; src/cryptolabs_proxy/templates/released-standard-1.5.4/; tests/test_standard_adoption.py | VER-UPDATER-003 | VAL-UPDATER-003 | Owner-approved source implementation scope | ## Account pairing acceptance boundary @@ -28,6 +31,31 @@ The TRACE-PAIR rows identify owner-approved and quality-reviewed source implemen | src/cryptolabs_proxy/account_link.py | REQ-PAIR-001 | TRACE-PAIR-001 | VER-PAIR-001 | entrypoint | trace-anchor-target | | src/cryptolabs_proxy/account_link.py | REQ-PAIR-003 | TRACE-PAIR-003 | VER-PAIR-003 | entrypoint | trace-anchor-target | | src/cryptolabs_proxy/account_link.py | REQ-PAIR-004 | TRACE-PAIR-004 | VER-PAIR-004 | entrypoint | trace-anchor-target | +| src/cryptolabs_proxy/migration.py | REQ-UPDATER-001 | TRACE-UPDATER-001 | VER-UPDATER-001 | file-role | bounded-docker-stop-transport | +| src/cryptolabs_proxy/migration.py | REQ-UPDATER-001 | TRACE-UPDATER-001 | VER-UPDATER-001 | entrypoint | bounded-docker-stop-transport | +| src/cryptolabs_proxy/updates.py | REQ-UPDATER-002 | TRACE-UPDATER-002 | VER-UPDATER-002 | file-role | safe-update-recovery-diagnostics | +| src/cryptolabs_proxy/updates.py | REQ-UPDATER-002 | TRACE-UPDATER-002 | VER-UPDATER-002 | entrypoint | safe-update-recovery-diagnostics | +| tests/test_updates.py | REQ-UPDATER-002 | TRACE-UPDATER-002 | VER-UPDATER-002 | file-role | persisted-updater-failure-contract | +| tests/test_updates.py | REQ-UPDATER-002 | TRACE-UPDATER-002 | VER-UPDATER-002 | verifies | persisted-updater-failure-contract | +| tests/test_proxy_lifecycle_review_repairs.py | REQ-UPDATER-001 | TRACE-UPDATER-001 | VER-UPDATER-001 | file-role | real-stop-socket-deadline | +| tests/test_proxy_lifecycle_review_repairs.py | REQ-UPDATER-001 | TRACE-UPDATER-001 | VER-UPDATER-001 | verifies | real-stop-socket-deadline | +| src/cryptolabs_proxy/standard_adoption.py | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | file-role | strict-released-standard-source | +| src/cryptolabs_proxy/standard_adoption.py | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | entrypoint | strict-released-standard-source | +| tests/test_standard_adoption.py | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | file-role | historical-adoption-contract | +| tests/test_standard_adoption.py | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | verifies | historical-adoption-contract | + +| src/cryptolabs_proxy/templates/released-standard-1.5.4/acme-challenge.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 7e594162700825757c9d402971094448aa1834d1f7121ac1c02f152f345e149a; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/exporter-auth-routes.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 450f4c418c09474ac45b6dd314c47cc090fe7d230a0206b30e48c7975023133b; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/fleet-api-routes.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 6991ca6bf1dd4b258e8ee7851fc69ef50b19dfe2353570e4911a0ebadc68ed1b; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/host-forwarding.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 35c4a1fe1d3001865a77d7653350b7a61968953b94172dc7063bc31a42c0f9f7; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/nginx.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 f12e2b9800cbaa0e49e685506cfaad38eb7e568fa6d239fa15277af59073d8de; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/provenance.json | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 addd4a945cf32982a2a7dac30ad2d1eea8eb32585400b28d74c4e9df57e105e5; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/standard-service-routes.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 ef0f55aae48e35127d288781e68281a371505ba27384c8fd04dff9200dce3963; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager-auth-blocks.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 b9d7013434557492887b0600bc2afc92227ee17f9efebe55b0cccc4b16bd3f81; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| src/cryptolabs_proxy/templates/released-standard-1.5.4/vast-price-manager.conf.j2 | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 32483d169a09c42653396e66c5c7efe1995bd599f44f11ee64fa2f0731a0a2f8; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| tests/fixtures/released-standard-1.5.4-declaration.json | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 c4f4f3e80ff3920522502f47335120e133bca6d8e8245133d0112b550f382274; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| tests/fixtures/released-standard-1.5.4-provenance.json | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 a3203f4e7ef156b403cd039d53c7dc2f02940499c1abb1c862cd52fa5524bff3; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | +| tests/fixtures/released-standard-1.5.4.nginx.conf | REQ-UPDATER-003 | TRACE-UPDATER-003 | VER-UPDATER-003 | Exception | Immutable released/synthetic resource; SHA256 f1aa7a0ed767e7432dd21123fc0086e0cc98e0b26ad3c95eff5fe233095e3e72; root-precode-review.json generated_resource_anchor_exception; external provenance mapping, no inline mutation | ## Generated pairing fixture provenance @@ -37,3 +65,14 @@ These are generated raw data copies within the approved verification scope. Inli | --- | --- | --- | --- | --- | --- | | tests/fixtures/pairing-producer-v1.json | REQ-PAIR-001; REQ-PAIR-003; REQ-PAIR-004; REQ-PAIR-005; REQ-PAIR-006 | TRACE-PAIR-001; TRACE-PAIR-003; TRACE-PAIR-004; TRACE-PAIR-005; TRACE-PAIR-006 | VER-PAIR-001; VER-PAIR-003; VER-PAIR-004; VER-PAIR-005; VER-PAIR-006 | Exception | Generated data approved for exact-byte provenance mapping; SHA256 d58a17f90c33e935b4307b5816e462d0445ee984b72e1d03948dfa3cd9d9404d; regenerate and drift-check from wordpress/actual-producer-fixture.json | | tests/fixtures/pairing-wire-v1.json | REQ-PAIR-001; REQ-PAIR-003; REQ-PAIR-004; REQ-PAIR-005; REQ-PAIR-006 | TRACE-PAIR-001; TRACE-PAIR-003; TRACE-PAIR-004; TRACE-PAIR-005; TRACE-PAIR-006 | VER-PAIR-001; VER-PAIR-003; VER-PAIR-004; VER-PAIR-005; VER-PAIR-006 | Exception | Generated data approved for exact-byte provenance mapping; SHA256 8ccd5db5c28c55da4e9118c7f913e45532e3213007b8e98a4af214f4bb20d652; regenerate and drift-check from fixtures/pairing-wire-v1.json | + + +## Updater stop repair — approved scope, outcomes pending + +# Scoped updater matrix proposal (not applied to unrelated pairing authority) + + +| Trace | Requirement | Implementation | Verification | Validation | Status | +| --- | --- | --- | --- | --- | --- | + +Updater rows authorize source implementation only. GREEN/review/release checks and operational acceptance remain open until their evidence exists. Compatibility addendum is awaiting owner approval; no deployment GO is asserted.