Repository navigation
ci: report coordinator e2e statement coverage and raise unit test coverage - #1274
Conversation
Each coverage step now writes a table with the columns Component, Statements or Lines, Regions or Branches, Functions and Target (80%, report-only), then states its denominator and what it excludes. The Go number now counts coordinator packages only; the profile also holds e2e/testbed and a frozen docs evidence package. The Rust step reads lines, regions and functions by field name from the JSON report and fails when one is missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cargo-llvm-cov leaves out every tests.rs module under src/ (four files, 825 lines), not only src/artifacts/tests.rs. The Go step now says when the profile has no coordinator rows, and the Rust step keeps two decimals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The e2e testbed runs the coordinator inside the go test process, so the three e2e lanes now run with -coverpkg over coordinator/... and write binary coverage data with -test.gocoverdir. A new report step merges the lanes with go tool covdata, writes one job-summary row, and fails only when a lane passed but wrote no data. The lane data is uploaded as the coordinator-e2e-coverage artifact for 14 days. The test commands, filters, timeouts and pass/fail rules do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project d-inference with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
… referrals and usage totals on both backends Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eceipts and session start Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontroller and supervisor helpers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, config checks and startup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep master's date-only stamp and runner note in docs/developer/test.md, and keep the coverage summary wording from this branch in the CI workflow map row. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Write the coordinator rows into the scoped profile with the grep that checks them, and drop the sidecar step's unused pipefail (it has no pipeline now). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the word-split E2E_COVER_FLAGS string with E2E_COVER_PKG so the three lanes need no shellcheck SC2086 suppression; argv is unchanged. State every failure condition of the e2e coverage report step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project eigen-homepages-darkbloom with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-console-ui-dev with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-landing with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
…fixtures Split store and mdm tests by domain, rename test files after their owners, and share the event log, logger and in-memory provider socket across the App Attest service tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master #1324 moved every coordinator test under coordinator/tests/ and deleted coordinator/appattest/service/fixtures_test.go. The merge takes master's deletion; the next commit ports the added helpers and tests to the external test packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve docs/developer/test.md: keep master's stamp and its new registry snapshot-age paragraph, then the scoped coverage paragraph; in the CI workflow map, keep master's ci.yml row and apply this branch's coverage-table wording to the coordinator and sidecar jobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the coordinator reorganization, no production package holds a _test.go file, so every coordinator package is credited through the runner's -coverpkg list. Say so in the job summary and in test.md: the coordinator/tests packages and their helpers are not instrumented, a production package that no test imports counts at 0%, and the component router decides whether either coverage table appears. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the ported #1252 coverage scoping and master 5b7a675. Conflicts: - integration.yml: master made the exact-cache lane a blocking gate (no continue-on-error). Keep master's step and comments, and keep this PR's step id and per-lane coverage directory. - CHANGELOG.md: keep both sides under the CI and contributor workflow heading. - docs/developer/test.md: take master's new sections and workflow-map ci.yml row, and add this PR's coverage clause to the integration row. The e2e coverage text no longer calls the exact-cache lane expected red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the coordinator/tests layout move, -coverpkg over coordinator/... also instruments the test-only packages that a binary links, such as tests/internal/testdb. A "Select e2e coverage packages" step now drops the tests, testkit and testdb path segments, as scripts/run-coordinator-tests.py does, and exports E2E_COVER_PKG. The coordinator-row scoping that ci.yml and integration.yml both copied moves to scripts/coordinator-statement-coverage.sh. It keeps the guards of both copies: no blocks, no coordinator rows, or no statement total fails the step. The component router selects the coordinator, integration and benchmark jobs when the script changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 0/0 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Previous review (not confirmed resolved)Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 0/0 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. |
Master moved every coordinator test into the mirrored coordinator/tests
tree and moved much of the tested code into coordinator/internal. Port
this PR's in-package tests to external test packages that use the
exported and internal APIs of the new owners:
- store: tests/store/contracts, on both backends through storeBackends.
- config: new tests/config.
- appattest/service: tests/appattest/service and its exchange and
authorization packages; the exchange tests run a worker that
StartSession starts, and the moved code is tested through
internal/appattest/{exchange,receipt}.
- promptcontract: tests/promptcontract, through
internal/promptcontract/{artifacts,catalog,endpoint,preload,process,sidecar}.
- datadog and mdm: tests/datadog and tests/mdm.
- cmd/coordinator: the startup test runs internal/command/coordinator.Main;
the APNs attestor tests run app.Run in tests/app.
Tests that master already covers are dropped: the old-protocol row of
TestStartSessionRefusesUnservableRegistrations, TestTrustStatusAndMetricHooksAreOptional,
"non string instructions", the generation-mismatch cases of the preload
matches test and the datadog httpMetrics check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… owners - testkit.FreeListenPort replaces two copies in the startup and APNs tests. - The exchange harness moves to exchange_fixture_test.go; session_start uses it too. - Background worker callbacks count with atomics, which removes a racy bool. - The exchange tests use shadowKeyID, the name the service tests use. - The artifact tree test uses master's readOnlyTempRoot. - TestCatalogBoundedStatusError moves to catalog_state_test.go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PR's subtest called runAttempt with a context that was already cancelled. With zero onboarding jitter the select at the top of runAttempt can take timer.C before ctx.Done(); the prepare send then fails on the cancelled context and the attempt ends as send_failed (12 of 400 runs failed at 41e718c). The test now cancels only after synctest.Wait, when the worker is durably blocked, so the cancelled context never reaches that select. The jitter still decides where the worker blocks, so the test reads it from the events: with no prepare sent the outcome must be prepare:disconnected; after a sent prepare (read and checked) it must be ready:disconnected. No attest, assert or supported-ready outcome may appear. Production code is unchanged: with a cancelled context the writer rejects the frame, so nothing reaches the provider either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master covered this branch only by timing in an unrelated suite; the ported worker tests did not, so the package would read one statement lower under the full run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Absorbs #1284 (coordinator statement-coverage tests and the deterministic appattest cancelled-before-challenge fix) into #1274. One PR now covers CI coverage and test infrastructure. No conflicts. docs/developer/test.md merged cleanly with both sides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in master through #1328 (goose migrations, store in store/postgres/), #1344, #1351, #1352 and others. Conflicts: - ci.yml (Report coverage): master inlined the empty-profile, coordinator-row and statement-format checks (#1252). This PR moved the same checks into scripts/coordinator-statement-coverage.sh, which ci.yml and integration.yml both call. Keep the script call. - docs/developer/test.md (coverage command): keep the script call. - docs/developer/test.md (CI workflow map): keep master's ci.yml row (adds the provider coverage table) and this PR's integration.yml row (adds the e2e coverage row and artifact). The #1284 store contract tests and coverage tests build and vet against master's store layout with no change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master #859 made RecordReferral a no-op when an account is referred again by the same code, and a conflict (ErrReferralConflict) when a second referrer or the referrer itself is used. The #1284 contract test expected an error for the same-code repeat, so it failed on both backends after the master merge. Keep the assertion that an account cannot be referred twice: the repeat with the same code must succeed without a second count, and a second referrer must return ErrReferralConflict. Also check that a self-referral is a conflict. The stats assertion (2 referred) still proves that the repeat did not count twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test Refactor pass: 2c3060e added a self-referral assertion that #1284 did not have. Master already checks it in TestReferralAttributionAtomicAndImmutable (tests/store/contracts/consumer_settlement_test.go). Remove the copy. Every #1284 assertion stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project darkbloom-status with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Found 1 test failure on Blacksmith runners: Failure
|
Resolve docs/developer/test.md: take master's ci.yml row (adds `make sqlc-check`) and keep this branch's integration.yml row (e2e statement coverage and the coordinator-e2e-coverage artifact). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Title: ci: report coordinator e2e statement coverage and raise unit test coverage
Summary
This PR is the one PR for CI coverage and test infrastructure. It absorbs #1284 ("test(coordinator): raise statement coverage in store, appattest, promptcontract, datadog, mdm and cmd"). Close #1284 when this PR merges.
The PR has three parts:
go test ./e2e/lanes runs with-coverpkgover the productioncoordinator/...packages and writes binary coverage data (-test.gocoverdir). A new step merges the lanes, writes one row to the job summary, and uploads the data as thecoordinator-e2e-coverageartifact (14 days). The tests and their pass/fail rules do not change.coordinator/tests/raise statement coverage in the store, App Attest, prompt contract, Datadog, MDM, config, app and command packages. Only test files change. No production code changes.cancelled before first challengefailed 12 of 400 runs. It now has one exact expected outcome for each point where the worker stops.Linked issue
None.
What changed and why
1. E2E coverage scoping
e2e/testbed/suite.go(startCoordinator) callsapi.NewServerin the test process. So the PR instruments the coordinator packages in the e2e test binary.coordinator/...and removes thetests,testkitandtestdbpackages. The coordinator test runner uses the same scope. Go 1.26 counts every listed package that the binary links, so a test package in the list would change the denominator.go tool covdata textfmtmerges the three directories into one text profile. The merge is exact.setmode. It is the cheapest mode, so theTestProfilelatency checks see the least extra work. The e2e tests do not use-race.if: !cancelled()). A lane that failed or was skipped is not counted, and the summary names it. A low number never fails the job. The step fails only when a lane passed but wrote no data, or when the merged data has no coordinator rows or no total.scripts/coordinator-statement-coverage.shkeeps only the coordinator rows of a profile and prints the statement total. The Coordinator Tests job (ci.yml) and the e2e report (integration.yml) both call it. It fails on an empty profile, on a profile with no coordinator rows, and when there is no statement total. The component router (scripts/ci-component-paths.py) routes the script to the coordinator, integration and benchmark jobs.ci.yml, and the e2e number comes from a macOS job inintegration.yml. The two workflows have no order. A merged number needs aworkflow_runjob, which runs only from the default branch and cannot be tested in a PR. So the e2e number is its own row.2. Unit coverage tests (from #1284)
All tests are in the mirrored
coordinator/tests/tree, in external_testpackages. They use the exported andinternal/entry points. No test-only accessor was added to production code.tests/store/contracts, memory and Postgres throughstoreBackends): API key lifecycle, log reports, billing sessions, device auth, invite codes, referrals, usage totals, model price delete.Startworker lifecycle withtesting/synctest, maintenance metrics, the attest and assert challenge send path over a loopback WebSocket, reply and receipt verification,StartSession,ReleaseReady, and inventory reconcile storage failures.slogrecords.RequestDeviceAttestationagainst a local MicroMDM stand-in.ReadAppConfig, the APNs attestor configuration throughapp.Run, and the real coordinatorMainstartup and SIGTERM drain.coordinator/tests/internal/testkit/listen_port.go(FreeListenPort). The coordinator exits the process on a bind error, so the helper picks a free port below the macOS and Linux ephemeral port ranges.3. Flaky test fix
The old subtest called
runAttemptwith a context that was already cancelled. With zero onboarding jitter, theselectat the top ofrunAttemptcan taketimer.Cbeforectx.Done(). The prepare send then fails, and the outcome isprepare:send_failed.The test now cancels the context only after
synctest.Wait(), when the worker is blocked. It reads the stop point from the events:prepare:disconnected.ready:disconnected.Production code does not change. With a cancelled context the writer refuses the frame, so no frame gets to the provider in either case.
Before and after
Colors: blue = test run (unchanged), green = new or changed, grey = unchanged, red = no coverage or flaky.
Behavior
flowchart LR subgraph Before["Before"] direction TB B1["Coordinator Tests (ci.yml)"]:::run --> B2["unit coverage row<br/>inline scoping"]:::same B3["E2E lanes: paged, exact-cache, smoke"]:::run --> B4["no e2e coverage number"]:::none B5["appattest subtest<br/>cancelled before first challenge"]:::run --> B6["12 of 400 runs fail"]:::none B2 --> B7["coordinator/... 84.0%"]:::same end subgraph After["After"] direction TB A1["Coordinator Tests (ci.yml)<br/>+ 34 new test files"]:::new --> A2["unit coverage row<br/>shared script"]:::new A3["E2E lanes: paged, exact-cache, smoke"]:::run -. "covdata" .-> A4["Report e2e coverage"]:::new A4 --> A5["summary row: Coordinator (Go), e2e"]:::new A4 --> A6["artifact: coordinator-e2e-coverage"]:::new A7["appattest subtest<br/>cancel after synctest.Wait"]:::new --> A8["0 of 800 runs fail"]:::new A2 --> A9["coordinator/... 85.8%"]:::new end classDef run fill:#dbeafe,stroke:#1d4ed8,color:#0f172a classDef new fill:#dcfce7,stroke:#15803d,color:#052e16 classDef same fill:#f1f5f9,stroke:#64748b,color:#0f172a classDef none fill:#fee2e2,stroke:#b91c1c,color:#450a0aCode
flowchart LR subgraph Before["Before"] direction TB C1["ci.yml: Report coverage<br/>inline grep + go tool cover"]:::same C2["integration.yml: go test ./e2e/ -run ..."]:::run --> C3["test binary, not instrumented"]:::same C4["coordinator/tests/...<br/>existing tests"]:::run --> C5["production packages<br/>uncovered: workers, send paths,<br/>lowering branches, main startup"]:::none end subgraph After["After"] direction TB D0["scripts/coordinator-statement-coverage.sh"]:::new D1["ci.yml: Report coverage"]:::new --> D0 D2["integration.yml: Select e2e coverage packages"]:::new --> D3["go test ./e2e/ -cover -covermode=set<br/>-coverpkg=production coordinator/...<br/>-args -test.gocoverdir=lane dir"]:::new D3 --> D4["go tool covdata textfmt"]:::new --> D0 D5["coordinator/tests/... existing tests<br/>+ new external _test files<br/>+ testkit.FreeListenPort"]:::new --> D6["same production packages<br/>through exported and internal/ entry points"]:::same D5 --> D7["local doubles: httptest, loopback WebSocket,<br/>synctest, memory store, generated keys"]:::new end classDef run fill:#dbeafe,stroke:#1d4ed8,color:#0f172a classDef new fill:#dcfce7,stroke:#15803d,color:#052e16 classDef same fill:#f1f5f9,stroke:#64748b,color:#0f172a classDef none fill:#fee2e2,stroke:#b91c1c,color:#450a0aCoverage against master
Statement coverage of
coordinator/...rows only, fromscripts/run-coordinator-tests.py --race --coverprofileover every package except the top-levele2epackage, with Postgres 16 (DATABASE_URL), as CI runs it. Before: masterdccc9ee0. After: this branch (tests at2c3060e4;b64826f8only removes one duplicate assertion). Both runs were local, on the same machine, one after the other.coordinator/store/postgrescoordinator/store/memorycoordinator/storecoordinator/appattest/servicecoordinator/internal/appattest/receiptcoordinator/internal/appattest/exchangecoordinator/internal/appattest/qualificationcoordinator/internal/promptcontract/endpointcoordinator/internal/promptcontract/preloadcoordinator/internal/promptcontract/processcoordinator/internal/promptcontract/sidecarcoordinator/promptcontractcoordinator/datadogcoordinator/mdmcoordinator/configcoordinator/appcoordinator/internal/command/coordinatorcoordinator/...totalRead: every package that the new tests drive goes up, and the total goes from 84.0% to 85.8% (target 80%, report-only).
Of 258 coordinator packages, 41 go up, 213 do not change, and 4 go down by 1 to 4 statements. The 4 decreases are in packages that this PR does not test. Each missed block is a race or
select-order branch, or depends on random test input:attestation/attestation.go:426(-1 statement),internal/inference/attempt/race_loop.go:152(-2),internal/provider/challenge/challenge_verify.go:394(-4),internal/registry/providerwrite/wait.go:71(-2).The e2e coverage row comes from the E2E Integration Tests job on this head. It needs a macOS runner and models, so it was not measured locally.
Validation
All on the final tree (
b64826f8) unless stated.go build ./...andgo vet ./coordinator/...: pass.golangci-lint run(v2.1.6): 0 issues.gofmt -l coordinator/tests: no output.go test ./coordinator/tests/ -run TestCoordinatorTestsAreIsolated: pass.python3 scripts/test-coordinator-tests.py,test-ci-component-paths.py,test-provider-ci-workflow.pyandtest-docs-impact-check.py: OK.actionlint: 3 findings, all incodex.ymlandrelease-swift.yml. Masterdccc9ee0has the same 3 findings. None is in a file this PR changes.shellcheck scripts/coordinator-statement-coverage.sh: clean.yq), on GOCOVERDIR data from a small coordinator test binary:covdata pkglist: 250 packages, 0 test-only.::error::, exit 1.ci.yml"Report coverage" on a-coverprofilerun: exit 0, summary row written.go test -race -count=1with Postgres on every package that the new tests are in (tests/app,tests/appattest/service,.../authorization,.../exchange,tests/cmd/coordinator,tests/config,tests/datadog,tests/mdm,tests/promptcontract,tests/store/contracts): pass.run-coordinator-tests.py --race --coverprofile, as CI runs it): pass on this branch and on masterdccc9ee0.go test -race -count=400 -run 'TestExchangeWorkerObservesDisconnectAndMissingReady/cancelled_before_first_challenge'twice: 800 runs, 0 failures.TestPostgresAuditAndApprovedRefund,TestStripeSettlementRecoveryContract/postgres,TestPostgresRejectedRefundRollsBackWithFlagWrite) now pass. fix(store): refund rejected Stripe withdrawals when the coordinator clock is ahead #1352 fixed them.make docs-impact-check BASE=dccc9ee0: 44 changed files, OK.make docs-check: 1 problem in 337 files. It is local only.docs/reference/configuration.mdciteslibs/mlx-swift-lm/Libraries/MLXLLM/Models/MiMo/MiMoV26RowExactProjection.swift. The local submodule checkout is at an older commit. The file is present at master's gitlinke407e899. This PR does not changeconfiguration.mdor the gitlink.coordinator-e2e-coverage. CI only.Refactor Pass
#1274 (earlier pass): a dedicated refactor subagent changed the word-split
E2E_COVER_FLAGSstring to a quotedE2E_COVER_PKG, which removed threeSC2086suppressions. The copied coordinator-row scoping inci.ymlandintegration.ymlbecame one script.#1284 (earlier pass): a dedicated refactor subagent made one shared
testkit.FreeListenPort, replaced a racy bool with atomics, reused master's fixtures, and gave the files names for the behavior they check. There are 86 test functions before and after, with one rename. Every assertion stays.This consolidation: a dedicated refactor subagent read the two merges and the referral test change against
AGENTS.md.test.mdchange.FreeListenPortdoes not copy any master helper.ci.yml. Thetest.mdworkflow map keeps master's provider coverage text and this PR's e2e coverage text. No text is stale.b64826f8. It removes a self-referral assertion that the port added, because master'sTestReferralAttributionAtomicAndImmutablealready checks it.Merge notes
c49d7246: merge of test(coordinator): raise statement coverage in store, appattest, promptcontract, datadog, mdm and cmd #1284 headead79d82. No conflicts.eda60172: merge of masterdccc9ee0(Apply the coordinator schema as goose migrations #1328 goose migrations and thestore/postgres/layout, Freeze legacy MDM eligibility and require App Attest for base rewards #1344, docs(design): fix first-content dispatch link after #1324 move #1351, fix(store): refund rejected Stripe withdrawals when the coordinator clock is ahead #1352 and others).ci.yml"Report coverage": master put the empty-profile, coordinator-row and total checks inline (ci: scope the coordinator and sidecar coverage summaries #1252). This PR keeps the call to the shared script, which has the same three checks.docs/developer/test.md: the coverage command uses the script. The CI workflow map uses master'sci.ymlrow and this PR'sintegration.ymlrow.store/postgres/layout with no change.2c3060e4: master Add Open Sales Program with 5% consumer referral rewards #859 madeRecordReferrala no-op when the same code refers an account again, andErrReferralConflictfor a second referrer. The test(coordinator): raise statement coverage in store, appattest, promptcontract, datadog, mdm and cmd #1284 test expected an error for the same-code repeat. The test now expects success for the repeat andErrReferralConflictfor a second referrer.TotalReferred == 2still shows that the repeat did not count twice.Components touched
Protocol / interface changes
Documentation impact
docs/developer/test.md("E2E coverage in CI", the coverage command, theFreeListenPortnote and the CI workflow map row).CHANGELOG.mdhas one line under "CI and contributor workflow". The coverage tests are not user-visible, so they have no CHANGELOG line.Notes for reviewers
-run,-skip,-timeoutand-pflags do not change.go list -test -deps ./e2e/would remove them.coordinator/appattest/service/credential_owner.go, theCanonicalMachineIDlookup (lines 28 to 34) cannot run.APNS_MODEandAPNS_TOPICdefaults, thePreloadControllerdefaults, andrejectSymlinksandmakeTreeContentsReadOnly.🤖 Generated with Claude Code