Repository navigation
test(routing): add evidence boundary and invariant tests - #1260
Conversation
Add package tests for the first-content evidence predicates and for invariants that routing holds by design. Boundary tables cover the capacity and performance freshness limits, the budget edge between feasible and predicted late, the candidate gate, the explicit measurement dating rules, and the decode and prefill rate fallback chains. Seeded property tests check the forecast invariants, that a faster rate never makes a forecast later, that the first-content preference never empties or reorders the pool, and that heartbeats on a virtual clock never make an unchanged measurement younger. Each failure prints its seed and case. All new tests pass on master. The tests that expose the idle-evidence feedback loop in #1238 are in a separate draft pull request. 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 |
After #1243 merges, the decode fallback table needs a row for an idle provider whose decode measurement is older than 30 minutes. The row cannot be added yet because the age field does not exist on master. 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-landing 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 |
Rename the random candidate generator and pool helpers to say what they return, and merge the two identical new-sample flags in the dating check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tor/tests Master keeps every coordinator test under coordinator/tests in the external package, and the first-content predicates now live in internal packages. Move both files to coordinator/tests/registry and test each predicate at the package that owns it: - forecast.UnknownReason, forecast.Evaluate and forecast.Allows for the freshness, budget and candidate gate tables and the seeded forecast invariants. - measurements.History.Reconcile for the explicit measurement dating table. - performance.Rates for the decode and prefill rate chains. - selection.Prefer for the seeded pool narrowing invariant. - Registry.Heartbeat and ReserveProviderEx for the synctest dating invariant. The routing age now comes from the routing decision. The scheduler folds busy and pending work into one occupied input, so the two hedge rows become one table row plus a scheduler test where a pending reservation keeps a hedge off the provider. All rows, seeds and synctest schedules are kept. 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. |
Gajesh2007
left a comment
There was a problem hiding this comment.
Reviewed exact head a09c193 and rechecked clean integration against master b52b393. The delta is limited to two external registry test files with no serving-code change. All eleven added boundary/property/heartbeat test functions passed locally on this head; current coordinator, integration, release-integrity, documentation and signature checks passed. These tests protect current evidence invariants and do not establish the stronger starvation policy proposed in draft #1262. Low incremental merge and deployment risk.
Summary
Add package tests in
coordinator/registryfor the first-content evidence predicates and for invariants that routing holds by design. The change has tests only. No production code changes.These tests pass on
master. The tests that expose the idle-evidence feedback loop in #1238 fail onmasterby design, so they are in a separate draft pull request.Linked issue
Refs #1238
What the tests check
Boundary tables (
first_content_evidence_boundary_test.go):TestFirstContentUnknownReasonBoundariesTestFirstContentStatusAtBudgetBoundaryTestFirstContentCandidateAllowedTablefirstContentCandidateAllowed(ceiling, fresh-feasible, hedge with busy or pending work)TestExplicitMeasurementTimeBoundariesmaxPrefillTPS; count regression; changed rate without a new sample; unchanged sample keeps the older timeTestResolveEffectiveTPSPrecedence,TestResolvePrefillTPSPrecedenceSeeded property tests (
first_content_invariants_test.go). Each failure prints the seed and case:TestFirstContentForecastInvariantsTestFirstContentForecastRateMonotonicityTestFirstContentPreferenceNeverEmptiesPoolTestHeartbeatMeasurementDatingInvariantsRegistry.Heartbeaton atesting/synctestclock, legacy and explicit paths: a measurement never becomes younger without a new sample, is never dated after its report, a changed legacy value is dated at the previous accepted report, and a replayed capacity sequence changes nothingDiagrams
Behavior:
flowchart LR subgraph Before A1[Evidence predicates] --> B1[Single-decision tests at typical values] B1 --> C1[Limits and invariants not pinned] end subgraph After A2[Evidence predicates] --> B2[Tables on both sides of each limit] A2 --> C2[Seeded random property checks] B2 --> D2[A changed limit or broken invariant fails a named test] C2 --> D2 endCode:
flowchart LR subgraph Before T1[first_content_forecast_test.go] --> F1[estimateFirstContent] end subgraph After T2[first_content_evidence_boundary_test.go] --> F2[firstContentForecastUnknownReason] T2 --> G2[firstContentCandidateAllowed] T2 --> H2[explicitMeasurementTime] T2 --> R2[resolveEffectiveTPS / resolvePrefillTPS] T3[first_content_invariants_test.go] --> E3[estimateFirstContent] T3 --> P3[preferFirstContentCandidates] T3 --> HB3[Registry.Heartbeat to reconcileFirstContentMeasurementsLocked] endTest plan
go test -race ./coordinator/registry/... -count=1go test -race ./registry/ -run '<new tests>' -count=20go vet ./registry/...,gofmt -l coordinator/(clean)golangci-lint run ./coordinator/registry/...with v2.1.6, the CI version: 0 issuesmake coordinator-testmake docs-impact-check BASE=origin/master,make docs-checkmaster: each of these changes makes a new test fail: legacy measurement dated at every heartbeat;>=for the capacity limit; the preference returns an empty pool; busy work counted as feasible; an unchanged explicit sample renewed.master.Components touched
Protocol / interface changes
Documentation impact
*_test.gois outside the docs-impact rules and no behavior changes.Notes for reviewers
master. It is in the draft closed-loop pull request with the other tests that are red by design.🤖 Generated with Claude Code
Refactor Pass
A dedicated refactor subagent reviewed the diff against the
AGENTS.mdstructure, clean-code and refactor rules. Outcome: one test-only cleanup commit, edd8ba6.first_content_invariants_test.go:randomFirstContentSnapshotis nowrandomFirstContentCandidate, because it returns a candidate. The shared helpers now have domain names:firstContentStatusesOfandisOrderedCandidateSubset.checkHeartbeatMeasurementDating: therenewedandchangedByNewValuefields always held the same value in every row, so they are now onenewSamplefield.Validation on the final tree:
gofmt -l,go test -count=1 ./registry/...,go vet,golangci-lintv2.1.6 (0 issues),git diff --check,make docs-impact-check BASE=origin/master, andmake docs-check(324 OK) all pass.Needs a port before merge: the branch merges into master c5552d3 with no text conflict, but the merged tree fails.
TestCoordinatorTestsAreIsolatedrejects both files, because they are outsidecoordinator/tests/. Also,go test ./registry/does not compile there:firstContentFreshness,measuredFirstContentCandidateandtestLoggerare undefined. The tests must be rewritten against exported orinternal/APIs, as packageregistry_test.Port to master, 0265f77 plus a09c193 (follow-up): both test files moved to
coordinator/tests/registry/and run through real entry points:forecast.UnknownReason,forecast.Evaluate,forecast.Allows,measurements.History.Reconcile,performance.Rates,selection.Prefer, andRegistry.HeartbeatwithReserveProviderEx. The seeds, the 2000 cases and the synctest schedules are kept. The two hedge rows became one, because the scheduler folds busy and pending into one input. A new test,TestFirstContentHedgeSkipsProviderWithPendingReservation, covers the pending case through the scheduler. Mutation checks:minin place ofmax, removing the clamp and an inclusive cutoff are each caught. Removing the hedge gate'stotalPending > 0term is not caught:wholeMacBusyalready covers it, so that term may be dead. Open: the preference-tier rule and the snapshot-to-evidence mapping are covered only through the existingReserveProviderExtests.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.