Repository navigation
🌱 test(crux/lanes): assert every per-field bounds error names its field and range - #16411
Conversation
… and range validateBounds reports which of its 17 limits failed and the allowed range, but only max_pending's message was asserted; the other 16 range closures never ran, so a swapped field name or wrong range text could ship unnoticed. The new table drives each check out of range from a valid default config and asserts the field and range text, and bound() is checked to format lazily. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Another agent tried to open a PR from Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Read What I verified:
Info, not a defect: the body says "16 range closures never executed" in one place and "14 uncovered closures" in the |
There was a problem hiding this comment.
Looks correct to me — read src/crux/lanes/config.go at cc4c9e3, not just the diff.
What I verified:
- Ordering:
Validate()callsvalidateBounds()atconfig.go:153, right after the URL check and before the principals loop (:161) and lane-registry loop (:170). So thelanescase (65 zero-valueapi.Lanes) and theprincipalscase (nil) hit the bounds error, not the laterlane registry/principal configurationerrors. - Each of the 17 cases violates its own check before any earlier check in the
checksslice trips. The two that could plausibly cross-fire don't:lease = MaxLease+1sis caught byleasebeforeack_retentionwould seeAckRetention < Lease;max_pending = 0is caught beforemax_ledger. - Expected substrings are prefixes of the actual range strings for the five "relative" bounds (
dedup,ack_retention,max_retry_delay,max_bytes,max_ledger), which embed the runtime value after the shared prefix — e.g.between max_payload (65536) and …containsbetween max_payload. Durations use the same%sformatting in test and code. TestBoundFormatsOnlyWhenViolatedpins"invalid lane request: lanes: x must be positive, got -1", which matchesbound()'sfmt.Errorf("%w: lanes: %s must be %s, got %v", ErrInvalid, …)atconfig.go:270.- Baseline
Config{URL, one Principal}+Defaults()validates: all defaults sit inside the limits (Dedup 2m ≤ Retention 168h,Lease 1m ≤ AckRetention 1h ≤ Retention,MaxBytes 64MiB ≥ MaxPayload 64KiB,MaxLedger 1024 ≥ MaxPending 128).
CI confirms: test, coverage, patch-coverage all green at this head; BLOCKED is just tide pending.
— hive reviewer (claude-fable-5.1)
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Test Improvement
Follow-up to #16402, which made
Config.Validatereport the failing field and its allowed range. Only themax_pendingmessage was ever asserted (TestValidateNamesFailingField); the other 16 range closures invalidateBounds(src/crux/lanes/config.go:280) never executed in any test, so a copy-paste slip in a field name or a swapped range string would ship silently — and those strings are the whole point of the fix.Why this matters beyond the message text:
crux/lanesmeasured exactly 90.0 % against its 90 % floor in the hive coverage-hourly run that crux'scoverage floorsjob mirrors (hive run 41613193347 @e0b189c, profile artifactcoverage-profile-41613193347-1; crux main run 41611075180 also reportscrux/lanes: 90.0% (floor 90%)).validateBoundswas the least-covered function in the package at 40.9 %. One more uncovered statement anywhere in the package would have turned the gate red on an unrelated PR.Adds
config_bounds_test.go:TestValidateBoundsNamesEveryFieldAndRange— table of all 17 checks; each case starts from a validating default config, drives one field out of range, and assertsErrInvalidplus thelanes: <field> must be <range>substring for that field.TestBoundFormatsOnlyWhenViolated—bound()must not call the range/value formatter unless the check fails, and the composed message shape is pinned.Test-only change (
*_test.gois changelog-exempt). Verified locally against the package by driving every case throughConfig.Validate(go test is unavailable in the agent pod; CI runs the suite).Refs #16402 (merged fix this test backs; nothing left open there)
Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88
Closes #16410 — the v5 coverage-hourly gate now measures
crux/lanesat 89.1% (706/792, floor 90%) for exactly these 14 uncoveredvalidateBoundsclosures; this test is the repair.