Skip to content

test(maintenance): give the reindex canary a real authority drift to find - #4027

Merged
Sinity merged 3 commits into
masterfrom
feature/fix/tjr4z-canary-divergence
Aug 19, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/fix/tjr4z-canary-divergence

Conversation

@Sinity

@Sinity Sinity commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

The canary's anti-vacuity assertion failed because the corpus side moved, not the comparison. A faithful rebuild of the campaign corpus now reproduces the active index exactly, so there was no divergence left for the canary to surface. The > 0 assertion and the differ are both untouched; instead the fixture now creates the authority drift it claims to detect.

Problem

test_real_inactive_rebuild_and_canary_preserve_active_and_reject_parser_as_duplicate asserted canary.comparison.unexpected_count > 0 and got 0.

The ledger asked which side moved. Dumping both sides inside the fixture answers it unambiguously — the canary compared everything it was supposed to and found nothing:

counts_by_table: {}
differences:     ()
missing_tables:  ()   missing_columns: ()
compared_tables: (... 'dirs', 'sessions', 'thread_sessions', 'web_content_constructs' ...)

ACTIVE    raw_revision_applications: 20     raw_revision_heads: 18
CANDIDATE raw_revision_applications: 20     raw_revision_heads: 18

Identical row counts on both tables, zero differences across every compared table, nothing missing. The comparison is reading the candidate's real read model perfectly well — there is simply nothing to report. The divergence the assertion depended on was an incidental rebuild discrepancy that has since been fixed, which makes the assertion vacuous rather than wrong.

This is the class the lead flagged from #4007's review advisories (fixture not genuinely divergent), and it lands on the fixture rather than on the comparison — so per that direction, the fix is to make the fixture genuinely divergent.

Solution

Before the canary runs, perturb the active index's accepted authority semantically: reverse one raw_revision_heads.accepted_content_hash, and flip one raw_revision_applications.decision to superseded.

The column choice is the load-bearing part. reindex_canary._VOLATILE_COLUMNS_BY_TABLE deliberately ignores decided_at_ms (and decision_id) on exactly these two tables, with the comment that their semantic decision tuple stays compared "so accepted/superseded/rejected authority drift stays visible". A timestamp nudge would therefore be correctly ignored and prove nothing; perturbing the accepted tuple is precisely the drift class the canary exists to surface.

This strengthens the anti-vacuity property rather than relaxing it. The assertion previously rode on an accidental discrepancy; it now rides on a divergence the test declares itself. The paired assertion — set(counts_by_table) == {"raw_revision_applications", "raw_revision_heads"} — passes because the canary reported that specific drift and nothing else, which a fabricated summary could not produce. That is the mutation the docstring names.

The untouched-active digest is re-anchored immediately after the deliberate edit, so the post-canary _digest(root / "index.db") == active_before assertion still means "the canary did not write to the active index" instead of silently absorbing it.

I did not weaken the > 0 assert, and I did not touch _compare_table or the delta-expectation classification #4007 introduced.

Verification

  • devtools verify --quick — all ten steps ok.
  • devtools test tests/unit/maintenance/test_reindex_campaign.py — 4 passed, with the xfail marker removed in the same commit (the file previously reported 1 xfailed).
  • Red→green: on origin/master the test fails assert 0 > 0 under --runxfail; with the drift in place it passes, and reverting only the drift restores the identical failure.
  • Full devtools verify deliberately skipped per the lane gate policy for bootstrap-predicted lanes; focused + quick is the gate and the merge receipt is recorded centrally.

Bead disposition matrix

Bead Disposition Evidence Residual
polylogue-tjr4z satisfied Bisected by dumping both sides: comparison healthy, corpus no longer divergent. Fixture made genuinely divergent on the two named tables; > 0 assert and differ untouched; xfail removed. None. The three #4007 advisories on polylogue-0x7nh (intersection-only column diffs, the "v43" fixture carrying current DDL, row-declarations waiving schema diffs) are untouched and remain that bead's scope.

Ref polylogue-tjr4z

…find

Ref polylogue-tjr4z

The corpus side moved, not the comparison. Dumping both sides in the
fixture shows the canary compared every scoped table and found nothing:
differences=(), counts_by_table={}, missing_tables=(), missing_columns=(),
with raw_revision_applications 20 rows and raw_revision_heads 18 rows
IDENTICAL on the active index and the candidate generation. A faithful
rebuild of this campaign corpus now reproduces the active index exactly,
so the divergence the canary was written to surface no longer exists to be
surfaced.

The >0 assertion is untouched, and so is the differ. Instead the fixture
now creates the drift it claims to detect: before the canary runs, the
ACTIVE index's accepted authority is perturbed semantically -- one
raw_revision_heads.accepted_content_hash reversed, one
raw_revision_applications.decision flipped to superseded.

Both columns are chosen deliberately. reindex_canary's
_VOLATILE_COLUMNS_BY_TABLE ignores decided_at_ms (and decision_id) on
exactly these two tables so that accepted/superseded authority drift stays
visible, so a timestamp nudge would be correctly ignored and would prove
nothing. Perturbing the accepted tuple is the drift class the canary
exists for.

This strengthens the anti-vacuity property rather than relaxing it. The
assertion previously depended on an incidental rebuild discrepancy that
has since been fixed; it now depends on a declared divergence the test
itself creates, so the paired assertion -- counts_by_table being exactly
{raw_revision_applications, raw_revision_heads} -- confirms the canary
reported that specific drift and could not have come from a fabricated
summary.

The untouched-active digest is re-anchored after the deliberate edit, so
the post-canary assertion still means "the canary did not write to the
active index" instead of silently absorbing it.

xfail marker removed in the same commit; the file is 4 passed.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d90d8e91-a9cd-4e26-be0a-62654ce54f7d


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit f8436e7 into master Aug 19, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the feature/fix/tjr4z-canary-divergence branch August 19, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant