Skip to content

[ECHO] Enable qualified autonomous Worker publishing with bounded expense reads - #2095

Merged
swu-echo[bot] merged 8 commits into
mainfrom
echo/um-autonomous-worker-publish-20261127
Nov 27, 2026
Merged

swu-echo[bot] merged 8 commits into
mainfrom
echo/um-autonomous-worker-publish-20261127

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Enables qualified autonomous Worker publishing via version upload + exact-version deploy, and bounds expenses dashboard D1 reads with a short-lived cache. Both changes are unverified in production in this description.

Changes

  • scripts/deploy-mapped-worker.py: adds tagged_versions() and publish() to upload a tagged version then deploy exactly that version at 100%. Promotion requires exactly one new version tagged with the commit SHA, unchanged main, un-tripped usage guard, and unchanged live deployment, with exact-version receipt check after deploy. This avoids plain wrangler deploy rewriting custom-domain routes. Review reported an unresolved check-to-deploy race that could overwrite a concurrent change, and unresolved first-page-only version listing.
  • scripts/worker-targets.json: switches all mapped Worker commands from deploy to versions upload, finalizes guard ceilings, and removes limits_pending. Expenses subrequest ceiling lowered from 200 to 60; auditor 50/20 and inbox 500/30 confirmed.
  • workers/expenses-site/src/index.mjs: adds 15s per-isolate read cache for dashboard rows, sync state, and total count with in-flight coalescing. Failed reads are not cached, /health always queries D1, unknown category returns 400 without D1 access, and cache is cleared after completed manual or scheduled sync. Dashboard and /api/expenses share the same cached loader. Review reported an unresolved torn-snapshot risk from independently cached rows and footer.

Tests added

  • scripts/test-deploy-mapped-worker.py: covers exact-version upload/deploy, config parity, same-tag old-version exclusion, fail-closed on missing/ambiguous versions, skip on moved main, guard-trip refusal, live-changed refusal, post-deploy mismatch, tag filtering, and ceiling mapping. No run results are reported here.
  • workers/expenses-site/src/__tests__/index.test.mjs: covers single D1 read in window, concurrent coalescing, per-filter isolation, 400 for unknown filters, valid filters including empty, no caching of failures, TTL re-read, post-sync invalidation, guard-off 503 precedence, and uncached /health. No run results are reported here.

Summary

Enables qualified autonomous Worker publishing with bounded expense reads. Deployment now promotes only an exact uploaded version identified by Wrangler's structured JSONL receipt and direct version API tag check, never by newest-version listing. Adds 600s timeouts on upload and deploy, fail-closed handling for missing, oversized, ambiguous or mismatched receipts, and post-deploy continuity verification that rejects concurrent promotions or traffic changes in the final gap. Expense dashboard read cache now stores one expiring snapshot per known filter holding rows, footer sync time and total count together, preserving 15s TTL and at most 10 filter entries. This prevents pairing rows with a footer or count from a different read across a sync, while still costing 3 D1 statements per filter window and without using a transaction.

Tests added

Updated scripts/test-deploy-mapped-worker.py mocks for deployment_head, verify_deployment_continuity and uploaded_version, plus new UploadReceiptChecks and DeploymentContinuityChecks covering exact receipt identity, refusal on malformed or mismatched receipts, timeout propagation, and concurrent-deployment detection. Added workers/expenses-site tests for per-filter snapshot consistency across ledger moves, no caching on partial failure with full 3-read retry, and shared load between dashboard page and JSON for the all filter. Run status and deployment verification remain unverified in this description.

Open review findings

Automated review reported 2 unresolved items, described here as unverified: high — exact versions equality may reject healthy 100% deploys with extra fields in scripts/deploy-mapped-worker.py:191; medium — per-filter snapshots duplicate shared footer and count reads in `workers/expenses-site/src/index.mjs:67.


Summary

Updated deployment continuity verification in scripts/deploy-mapped-worker.py to tolerate forward-compatible API responses. The check now compares only version_id and percentage for 100% traffic, ignoring extra fields in version entries.

Impact

Prevents false concurrent-deployment failures when the deployments API adds new version fields. Fail-closed behavior for differing traffic or mismatched history is retained as unverified beyond added unit coverage.

Tests

Added test_response_extension_fields_are_ignored alongside existing test_clean_serial_promotion and test_interleaved_promotion_and_changed_traffic_fail cases. No test execution results, deployment, or runtime verification are reported.

Open risk

Automated review reported 1 medium finding: scripts/deploy-mapped-worker.py:195 may raise TypeError instead of fail-closed RuntimeError when the versions list is null. This remains unresolved.


Purpose

This change continues the qualified autonomous Worker publishing effort with bounded expense reads. The supplied diff is limited to deployment continuity verification hardening.

Changes

  • Updated verify_deployment_continuity in scripts/deploy-mapped-worker.py to fail closed with RuntimeError when the versions list is missing or malformed. This prevents silently blessing an external promotion in the final API-call gap.
  • Added test_null_and_malformed_versions_refuse_cleanly in scripts/test-deploy-mapped-worker.py covering null and malformed versions values.

Tests

  • New unit test was added for malformed versions handling; no test execution results, deployment, or runtime verification were reported in the provided materials. Behavior remains unverified beyond the added test definition.

Open Risk

  • Automated review reported one medium finding that non-dict deployment entries may still cause AttributeError instead of a fail-closed error at scripts/deploy-mapped-worker.py:195. This remains unresolved in the supplied diff.

Summary

Enables qualified autonomous Worker publishing with bounded expense reads. CI now fetches a dedicated deploy-health bearer alongside the existing Fleet credential, uses the Fleet credential for receipt lifecycle verification, and checks live Worker health with the least-privilege bearer. The receipt-inbox /health endpoint accepts either the existing reader bearer or the dedicated deployment bearer, while receipt summary, evidence, and status changes remain restricted to existing authorized credentials.

Changes

  • Switched receipt-inbox deployment health checks to a dedicated RECEIPT_INBOX_DEPLOY_HEALTH_TOKEN and documented the finite read-only deployment service credential model.
  • Added health-only authorization that validates the bearer format and SHA256 digest, fails closed on missing or malformed configuration, and runs unchanged readiness checks.
  • Hardened deployment continuity verification to refuse cleanly on malformed deployment history instead of proceeding.

Tests added

  • Added unit coverage that the deployment bearer returns identical readiness, cannot read summary or evidence, cannot change status, and surfaces unavailable readiness.
  • Added unit and workerd coverage for bearer isolation, digest mismatch, and malformed configuration.
  • Added publisher tests for malformed deployment history and versions handling.

Verification status

Automated code review reported no issues in the changes reviewed. Test execution results, live deployment, and runtime verification are unverified from the provided changes.


Summary

Enables qualified autonomous Worker publishing with bounded expense reads. CI now fetches a dedicated deploy-health credential alongside the existing Fleet deploy credential, and receipt-inbox /health accepts that dedicated bearer for readiness only.

Changes

  • CI worker-deploy.yml fetches RECEIPT_INBOX_DEPLOY_HEALTH_TOKEN via the finite read-only service reader and uses it for deploy health checks, while lifecycle verification reuses the existing Cloudflare deploy credential. No receipt-data bearer enters CI.
  • workers/receipt-inbox adds deployHealthAuthorized() backed only by a SHA256 digest in Worker configuration. It authorizes GET /health with identical readiness logic, and continues to return 401 for summary, evidence, and status-change routes. Malformed or mismatched digests fail closed.
  • scripts/worker-targets.json points receipt-inbox health verification at the dedicated deploy-health bearer.
  • scripts/deploy-mapped-worker.py refuses to bless a deployment when concurrent deployment history is malformed, instead of proceeding silently.
  • Adds docs/worker-deploy-service-credentials.md describing the finite service reader, credential scope, bootstrap/postproof flow, and renewal process.

Tests

  • Added test_malformed_history_refuses_cleanly for deployment continuity, plus unit and workerd tests covering deploy-bearer health success, denial of receipt reads/writes, readiness failure handling, and fail-closed digest cases.
  • Automated code review completed and found no issues in the changes it reviewed. Live deployment, preproof/postproof execution, and runtime verification remain unverified in this change.

Summary

Hardens the final continuity check before Worker promotion to reject malformed deployment history envelopes instead of failing unpredictably. This preserves the existing protection against silently blessing an external promotion in the final API-call gap.

Changes

  • Updated deployment continuity verification to safely handle non-dictionary or unexpected deployment-history responses as unverifiable.
  • Added coverage for malformed history envelopes including empty, non-object, and unexpected-shape responses.

Testing

  • Added unit tests for malformed history envelope handling; no run results, deployment, or runtime verification are reported in the provided changes. Operational behavior beyond the added unverified cases remains unverified.

@kody-ai

This comment has been minimized.

Comment thread scripts/deploy-mapped-worker.py Resolved
Comment thread scripts/deploy-mapped-worker.py Resolved
Comment thread scripts/deploy-mapped-worker.py Resolved
Comment thread workers/expenses-site/src/index.mjs Resolved
@kody-ai

kody-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Automatic approval held

Kody's assessment:

Risk was identified in this PR.

@kody-ai

This comment has been minimized.

Comment thread scripts/deploy-mapped-worker.py Resolved
Comment thread workers/expenses-site/src/index.mjs Resolved
@kody-ai

This comment has been minimized.

Comment thread scripts/deploy-mapped-worker.py Resolved
@kody-ai

This comment has been minimized.

@swu-echo

swu-echo Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@kody start-review
[ECHO] Final current-head review requested 9783152.  Findings evidence-replied; exact remote bytes qualified.  Please review current source, not earlier superseded head.

Comment thread scripts/deploy-mapped-worker.py Resolved
@swu-echo

swu-echo Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@kody start-review
[ECHO] Review dedicated health-only authentication and runtime credential delivery.  Existing read/evidence/status auth is unchanged.  Dedicated bearer can only call existing health readiness checks.  No shared root secret moves or broad root readers; CI fetches dedicated health from existing scoped folder and uses its existing Cloudflare credential for mandatory lifecycle read.  Routine activation waits for first service postproof.

@kody-ai

This comment has been minimized.

@swu-echo

swu-echo Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@kody start-review
[ECHO] Final source proof and docs at e470bd6.  No activation yet.  Dedicated UM health authentication passed actual workerd capability isolation; AFC service canary actual workerd passed earlier.  Source publisher checks fail closed on malformed histories without rejecting extra API fields.

Comment thread .github/workflows/worker-deploy.yml Resolved
@kody-ai

This comment has been minimized.

@kody-ai

This comment has been minimized.

@swu-echo

swu-echo Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@kody start-review
[ECHO] Final current-head 1e23d6b.  Malformed continuity response envelope now explicitly fails as RuntimeError; receipt tests and remote-byte readback pass.  No activation occurred.

@kody-ai

kody-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@swu-echo
swu-echo Bot merged commit 85e61ff into main Nov 27, 2026
17 checks passed
@swu-echo
swu-echo Bot deleted the echo/um-autonomous-worker-publish-20261127 branch November 27, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant