test: replace docs-slug census count pin with slug↔page bijection#331
Merged
Conversation
The count pin `_EXPECTED_CONCRETE_CLASS_COUNT = 22` fired on any error-class add/remove even when slug and page were supplied correctly, friction with no behavioral cause. Fold the class→page test into a single slug↔page bijection: set equality reports missing pages and orphan pages separately, preserves the narrowing-walk guard (fewer slugs than pages fails), and adds orphan-page coverage the census lacked. No magic constant to hand-bump. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the hand-maintained
_EXPECTED_CONCRETE_CLASS_COUNT = 22pin intests/test_docs_slug_census.pywith a slug↔page bijection test.Why
The count pin fired on any concrete-error add/remove even when the slug and troubleshooting page were supplied correctly — friction on valid changes with no behavioral cause. Its one genuine value was catching a narrowing walk (a filter regression finding fewer classes, letting the skipped ones escape the slug/page gates); the existing non-empty check only catches the walk finding zero.
What
_EXPECTED_CONCRETE_CLASS_COUNTandtest_census_pins_the_concrete_class_count.test_every_docs_slug_has_a_troubleshooting_pageintotest_slugs_and_troubleshooting_pages_are_in_bijection— set equality reporting both directions.Net: magic constant gone (no hand-bump on valid add/remove), narrowing-walk guard preserved (fewer slugs than pages → mismatch), orphan-page coverage added (a stale page after a class removal).
Rationale bundle:
planning/changes/2026-07-15.04-census-bijection.md.Test
just test-cigreen — 392 passed, 100% coverage.just lint-ciandjust check-planningclean.🤖 Generated with Claude Code