test: make real Durable Object CI reliable and required#1648
Open
simple-agent-manager[bot] wants to merge 4 commits into
Open
test: make real Durable Object CI reliable and required#1648simple-agent-manager[bot] wants to merge 4 commits into
simple-agent-manager[bot] wants to merge 4 commits into
Conversation
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Makes the real Cloudflare Workers test tier deterministic, visible, and merge-blocking through one stable
Durable Object Workersresult. Every discoveredapps/api/tests/workers/**/*.test.tsfile is assigned exactly once to a real-runtime shard; no files are mocked, skipped, or converted to success.This is a fresh PR from current
main. It does not reopen or reuse #1619, and it must not be merged without separate explicit authorization.Reconciliation and root cause
PR #1619 closed unmerged at
7219669d, while SAM task01KXQZXGB2VPVPET0JN1Y2F036had been marked complete without an output summary. Final run 29721018453 / job 88283931687 used Node 22.23.1 and selected 36 files because final-head config replaced the seven-fileDURABLE_OBJECT_GATE_FILESlist withtests/workers/**/*.test.ts. It also changedmainfromtests/workers/worker-entrypoint.tstosrc/index.tsand upgraded pool 0.14.0 to 0.16.18/workerd 1.20260617.1. The earlier 7-file/228-test result therefore did not exercise the final merge head.Scientific minimization found:
maxWorkers=1still crashed, ruling out parallel-worker pressure as the primary cause.main.The solution uses Cloudflare's supported
cloudflareTest({ main, miniflare })configuration with focused binding/route entrypoints and one worker at a time. Official references: Vitest integration, configuration, isolation and concurrency, and test APIs.Coverage and resource evidence
durable-objectsSqlStorage, D1, alarms, hibernatable WebSockets, snapshots/recovery, node lifecyclehttpThe restored vertical slices include task-scoped ACP stuck-task reconciliation, ProjectData listing with ~1,500 sessions plus substantial message history, origin/attention behavior, node lifecycle, and session snapshot/recovery.
The inventory guard recursively discovers test files from the repository and derives ownership from whether a file uses
SELF; it fails if the inventory is empty or any file is unowned/duplicated. CI runs both shards withfail-fast: false, then aggregates their result without masking a failed shard. For unrelated changes the stable aggregate job remains present and green; change-detection failures fail closed.Red/green and final-head evidence
c2b6ffbe6: run 29831509892 recorded HTTP shard failure and aggregate failure. Reverta5e0391abremoved the assertion.a2a630b7c39340ec4bb1b4f1cd6a8d906a4fb3b8.88639985103,88639985173, aggregate88640976675); attempt 2 (88641497291,88641497278, aggregate88642585822); attempt 3 (88642926738,88642926724, aggregate88643941294). Attempts 1 and 2 were intentionally stopped only after all worker jobs and the aggregate passed; attempt 3 was left to complete all repository gates.Required-check enforcement
The workflow now exposes one stable
Durable Object Workerscontext and keeps it green for unrelated changes. Repository inspection found the onlyMainruleset (ID13102493) is disabled and contains no required checks. The attempted API update to activate it and require this context returned HTTP 403 (Resource not accessible by integration). A repository administrator must activate/add the context, or grant the SAM GitHub App Administration write permission; until then GitHub cannot literally block merge despite the check behavior being ready.Verification
pnpm --filter @simple-agent-manager/api test:workers:inventory— PASS, 27 + 9 = 36 files, each owned once.pnpm --filter @simple-agent-manager/api test:workers:durable-objects— PASS, 27 files / 449 tests / 158.58s.pnpm --filter @simple-agent-manager/api test:workers:http— PASS, 9 files / 102 tests / 64.32s.Specialist Review Evidence
External References
Consulted Cloudflare official documentation before finalizing the configuration: https://developers.cloudflare.com/workers/testing/vitest-integration/, https://developers.cloudflare.com/workers/testing/vitest-integration/configuration/, and https://developers.cloudflare.com/workers/testing/vitest-integration/isolation-and-concurrency/.
Codebase Impact Analysis
Changes are limited to
.github/workflows/ci.yml,apps/api/vitest.workers.config.ts,apps/api/tests/workers/, the API package scripts, and the repository task record. Productionapps/api/src/runtime code is unchanged.Documentation & Specs
The active task record documents prior-PR reconciliation, root cause, acceptance criteria, counts, durations, and the no-staging decision. The PR body carries final external run evidence.
Constitution & Risk Check
Reviewed Principle XI and CI security: runtime test timeout and worker concurrency use environment-overridable defaults; test-only domains, keys, and identifiers are isolated to Miniflare. Shards fail on crashes and unexpected unhandled errors, and aggregation fails closed.
Co-Authored-By: Claude noreply@anthropic.com