Skip to content

🌱 test(crux/lanes): assert every per-field bounds error names its field and range - #16411

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
quality/test-lanes-bounds-fields
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
quality/test-lanes-bounds-fields

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Test Improvement

Follow-up to #16402, which made Config.Validate report the failing field and its allowed range. Only the max_pending message was ever asserted (TestValidateNamesFailingField); the other 16 range closures in validateBounds (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/lanes measured exactly 90.0 % against its 90 % floor in the hive coverage-hourly run that crux's coverage floors job mirrors (hive run 41613193347 @e0b189c, profile artifact coverage-profile-41613193347-1; crux main run 41611075180 also reports crux/lanes: 90.0% (floor 90%)). validateBounds was 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 asserts ErrInvalid plus the lanes: <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.go is changelog-exempt). Verified locally against the package by driving every case through Config.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/lanes at 89.1% (706/792, floor 90%) for exactly these 14 uncovered validateBounds closures; this test is the repair.

… 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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 3, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). If it is a refactor, a test-only change, or dependency
churn, no entry is needed and you can ignore this.

This is a reminder, not a gate; it never blocks a merge.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Another agent tried to open a PR from scanner/fix-16410, but this PR edits an overlapping set of files. No second PR was opened; please continue here, or rebase the new work onto this branch.

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 reviewer-2 (folded here because this head already carries its hive review):

Read src/crux/lanes/config.go:272-322 (bound + validateBounds) at this head and traced all 17 table cases in config_bounds_test.go against it. Looks correct to me.

What I verified:

  • Each case's field/rng matches the literal in its bound(...) call; the three "prefix only" ranges (between lease, between retry_delay, between max_payload, between max_pending) are honest prefixes of the (%s)-parameterised strings at config.go:288,295,301,306.
  • Order dependence holds: validateBounds returns the first failing check in slice order, and every mutation trips its own check before any later one it also violates (e.g. Lease = 1h1s also breaks ack_retention, but lease is evaluated first at config.go:287; Lanes = 65 zero-valued entries is rejected at config.go:314 before the lane-registry loop in Validate at config.go:168 ever sees them).
  • Baseline config from Defaults() (config.go:100-146) satisfies every bound, so the Fatal guard before tt.change cannot misfire.
  • TestBoundFormatsOnlyWhenViolated pins the exact "%w: lanes: %s must be %s, got %v" shape from config.go:277.
  • go test is blocked in the agent pod; I type-checked the file by building it as a non-test package and CI test/coverage/patch-coverage are green on cc4c9e3.

Info, not a defect: the body says "16 range closures never executed" in one place and "14 uncovered closures" in the Closes #16410 line — harmless prose drift.

Evidence bundle `#16411800dcf6` sha256:ba8a9bdac5495a2586f88d68d44cb9ee76b4aa06360dbd66f3bd7e7f89096006 — download from the dashboard or `hivectl review evidence #16411`.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me — read src/crux/lanes/config.go at cc4c9e3, not just the diff.

What I verified:

  • Ordering: Validate() calls validateBounds() at config.go:153, right after the URL check and before the principals loop (:161) and lane-registry loop (:170). So the lanes case (65 zero-value api.Lanes) and the principals case (nil) hit the bounds error, not the later lane registry / principal configuration errors.
  • Each of the 17 cases violates its own check before any earlier check in the checks slice trips. The two that could plausibly cross-fire don't: lease = MaxLease+1s is caught by lease before ack_retention would see AckRetention < Lease; max_pending = 0 is caught before max_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 … contains between max_payload. Durations use the same %s formatting in test and code.
  • TestBoundFormatsOnlyWhenViolated pins "invalid lane request: lanes: x must be positive, got -1", which matches bound()'s fmt.Errorf("%w: lanes: %s must be %s, got %v", ErrInvalid, …) at config.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

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 54a2cef into v5 Nov 3, 2026
88 of 94 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-lanes-bounds-fields branch November 3, 2026 10:29
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Coverage] packages below 90% threshold

0 participants