Skip to content

test(store): fail the casefold gate on stale allowlist entries and re-pin drifted sites - #508

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-casefold-allowlist-drift
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-casefold-allowlist-drift

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The advisory casefold audit from #463 (TestRepoIDCasefoldGate) had silently stopped observing anything. Eleven commits since then (#466, #471, #478, #480, #488, #490, #493, #496, #498, #500, #507) moved lines in registry.go, history.go, news.go and engine.go, and the allowlist is pinned by file:line. At main@3405c52:

  • 21 of 27 allowlist entries point at lines that are no longer flagged sites (}, defer s.mu.RUnlock(), a comment…), so the sites they reviewed resurface as 20 "unreviewed" hits.
  • 6 genuinely new sites appeared with no review: the persist-failure rollbacks from fix(history,news): roll back in-memory state when persist fails #466 (history.go:136,140, news.go:129,133) and the description-enrichment memo from 🐛 fix(registry): enrich descriptions once and back off on GitHub rate limits #480 (registry.go:184,214). All key a map by the same registry/hub profile spelling on write and read — not bugs, and they are now allowlisted with that reason.
  • Total: 26 hits, so DIBS_CASEFOLD_GATE=strict would fail today. Nobody saw this because t.Logf output from a passing test is dropped without -v, which CI does not pass — the "two weeks at zero unreviewed hits" observation period in docs/casefold-gate.md was measuring nothing.

Why fail on stale entries rather than just re-pin: a stale entry exempts nothing, and the drift is the one condition an advisory run can never surface on its own. Making it a failure in every mode is the smallest pushable change that stops the allowlist from rotting again; it does not change the advisory posture for unreviewed hits, which still needs the maintainers' call per the doc. Decision taken by hive: stale entries fail regardless of DIBS_CASEFOLD_GATE.

Refs #461 (gate accepted and landed in #463; the strict flip and CI visibility of the advisory output remain for maintainers — see the linked issue)

Validation

go test is not runnable from this host, so:

  • Extracted casefoldAudit and the allowlist into a scratch main and ran it against main@3405c52 with the old allowlist: 26 unreviewed sites, 21 stale entries. With the new allowlist: hits 0, stale [].
  • Ran the fixture scenario from TestCasefoldAuditReportsStaleAllowlistEntries through the same harness: hits 0, stale [pkg/fixture/fixture.go:5 pkg/fixture/gone.go:1], exactly one reviewed log line (the _test.go fixture is skipped); with a nil allowlist: hits 1, stale []. The new test fails on the pre-PR allowlist (21 stale entries → t.Fatalf).
  • Type-checked the test file by copying it as a non-test file into a scratch package and running go build; gofmt -l pkg/store/ prints nothing.
  • Each re-pinned entry was re-read against the code at its new line and kept only where the original reason still describes it (news.go:110 is now fetchedAt, :118 is getCached; the reasons were swapped accordingly).

Checklist

  • go build ./..., gofmt -l . clean; go vet/go test left to CI (not runnable on the authoring host)
  • go mod tidy leaves go.mod and go.sum unchanged (no dependency changes)
  • Total coverage unaffected (test-only change; no production statements added)
  • No HTTP routes, listing code, or Go version changed
  • Commits are signed off (git commit -s)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Refs #461 (closed by #462; this PR adds docs/casefold-gate.md, pkg/store/repoid_casefold_gate_test.go)

…-pin drifted sites

Since the advisory casefold audit landed in #463, eleven commits have moved
lines in registry.go, history.go, news.go and engine.go. 21 of the 27
allowlist entries now point at lines that are not flagged sites, so their
reviewed sites resurface as 20 'unreviewed' hits alongside 6 new sites from
the #466 persist-failure rollbacks and the #480 description-enrichment memo.
Nothing surfaced because the gate is advisory and CI runs without -v, so the
observation period the gate depends on was recording nothing.

A stale entry exempts nothing, so treat it as a failure regardless of
DIBS_CASEFOLD_GATE; re-pin the drifted entries; review the six new sites
(all key maps by the same registry/hub profile spelling on write and read).

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 Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown

[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

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2026
@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 Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Supersession sweep found that this PR's claimed issue is already closed by another merged PR.

  • Claimed issue: dibs#461
  • Closing PR: #462

Keeping this hive-authored PR open: with head 5c365d5 current with main, it still adds 2 file(s) #462 did not touch: docs/casefold-gate.md, pkg/store/repoid_casefold_gate_test.go. Its body now reads Refs #461 (closed by #462; …) instead of Closes #461, and it continues in the lane.

This comment is edited in place by the supersession sweep; it is not duplicated.

@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 the refactored audit at pkg/store/repoid_casefold_gate_test.go (head 5c365d5) and re-read the re-pinned sites against the tree at this commit:

  • pkg/registry/registry.go:184 / :214 — c.looked[repos[i].RepoID] read and write, both keyed by the hub profile spelling, matching the new reason.
  • pkg/history/history.go:136,137,140 and pkg/news/news.go:129,130,133 — snapshot / write / rollback all index s.data[repoID] with the same key, so the three-line rollback reasons describe the code.
  • pkg/news/news.go:110 is fetchedAt and :118 is getCached — the swapped reasons are right.
  • pkg/match/engine.go:196, pkg/api/index.go:94 land on the map sites they claim.

casefoldAudit keeps the previous skip rules (test files, pkg/cmd only) and only adds the used set; the stale check runs before the strict env check, so the advisory posture for unreviewed hits is unchanged. CI build-and-test is green on this head, which is the real proof that the 27 re-pinned entries all match today — I could not run go test from this host.

One thing to note for whoever lands this: the stale check will now also fail any future PR that edits lines above a reviewed site in registry.go/history.go/news.go/engine.go/index.go; docs/casefold-gate.md says what to do, so that seems intended.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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.

Read the gate at the PR head (pkg/store/repoid_casefold_gate_test.go) and spot-checked the re-pinned allowlist against the tree at 5c365d5. Looks correct to me.

  • Each new entry I checked points at a real flagged site whose reason still holds: pkg/registry/registry.go:184 / :214 read and write c.looked[repos[i].RepoID] with the same spelling; pkg/history/history.go:136 / :137 / :140 are the persist-failure snapshot, write and rollback on the same s.data[repoID] key; pkg/news/news.go:110 is the staleness read and :118 the cache lookup (reasons swapped to match, as the body says).
  • casefoldAudit keeps the previous hit semantics unchanged and only adds the used set; the stale check fails in every mode before the strict check, so an advisory run can no longer silently measure nothing. build-and-test is green on this head, which is the real proof that all 27 entries are live sites again.
  • Fixture test covers the three cases that matter (drifted line, missing file, _test.go skipped).

Nothing to change. Body matches the diff; Refs #461 is right since that issue is already closed.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 1938d81 into main Oct 28, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-casefold-allowlist-drift branch October 28, 2026 22:27
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#5085c365d5` sha256:69e6d73a0121e90590750f69dbcf3e1e5b3645c318d56cb0c909c08ac011cbcc — download from the dashboard or `hivectl review evidence #508`.

@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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
kubestellar-prow Bot pushed a commit that referenced this pull request Oct 29, 2026
* fix(ci): surface casefold audit with a warning-first ratchet

Record the zero-site baseline after #508 and publish verbose audit output in CI logs and the job summary. Keep increases advisory for one release, with an explicit ratchet mode for subsequent enforcement.

Hive-Run: #509
Hive-Plan: approved-ratchet
Hive-Spec: docs/casefold-gate.md#ci-observation-and-ratchet
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>

* fix(ci): validate casefold modes and define observation window

Reject misspelled gate modes even when the audit is clean, and cover the configuration error alongside existing ratchet policies. Define a checkable 14-day main observation window before the enforcement follow-up.

Hive-Run: #509
Hive-Plan: approved-ratchet
Hive-Spec: docs/casefold-gate.md#ci-observation-and-ratchet
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>

---------

Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
Co-authored-by: thatguywob <thatguywob@users.noreply.github.com>
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 dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants