Skip to content

CR follow-ups on #210: pin the charset claim, parse for the import, correct three docs - #215

Merged
gregoryfoster merged 6 commits into
mainfrom
cr/210-followups
Sep 11, 2026
Merged

gregoryfoster merged 6 commits into
mainfrom
cr/210-followups

Conversation

@gregoryfoster

Copy link
Copy Markdown
Contributor

Review of 00d9dd9..c88bbd1 (the #210 delegation). Six findings, five applied, one observation. No behaviour change — the only src/ edit is a docstring.

# Finding Action
1 The delegation test's docstring claimed a cross-table agreement check that cannot exist post-delegation Fixed c3b25ed
2 extension_for asserted a charset property of co-core's data that nothing pinned, in the commit that deleted the guard enforcing it Fixed 1ab8fbf
3 The mimetypes guard matched source text, missing two import spellings Fixed 272c616
4 docs/BUS.md paragraph left ragged by the pin correction Fixed c30de3f
5 docs/ARCHITECTURE.md did not name co-core as the extension table's owner Fixed ecc9105
6 uv.lock gained sdist entries the 0.13.2 pins lacked Observation, no action

The two that mattered

Finding 2 is the one with teeth. extension_for's docstring said "every value it yields is lower-case alphanumeric" — a claim about another repository's data, written in the same commit that deleted _EXTENSION_SAFE, the local regex which had been enforcing exactly that. Nothing depended on it for safety (RenderOccasion.values re-checks every occasion value against _SEGMENT_SAFE, so an unusable answer raises InvalidOccasionError rather than writing a malformed key) but the failure would have surfaced at replication time pointing at a table this repo does not own. Now asserted over the same inputs the delegation test uses, hoisted into one tuple so the two cannot drift, and widened to the four table entries neither test covered: application/xhtml+xml, application/xml, text/xml, image/gif.

Finding 3: assert "import mimetypes" not in source read straight past from mimetypes import guess_extension and import mimetypes as mt — the two spellings most likely to appear if the fallback returns — and would trip on prose containing the phrase, which this module's own comment block already runs close to. Now reuses _imported_modules from the layering guard, whose planted-import tests keep the scanner honest, plus a new planted test covering all three spellings. Substring-matching over source is precisely what CR 9–11 replaced with AST for this same package.

Verification

ruff check clean, ruff format --check clean, 1772 passed / 2 skipped (the two hook tests that skip outside the main checkout) / 3 deselected. Two net-new tests.

🤖 Generated with Claude Code

gregoryfoster and others added 6 commits September 11, 2026 16:27
The docstring claimed the test pins agreement between two tables that could
drift entry by entry. Deleting the local table is what ended that drift; the
equality now holds by construction and cannot fail while extension_for is a
bare delegation. What it really catches is a local branch or normalisation
step reintroduced ahead of the call, which is worth keeping and worth naming
accurately - a test whose stated purpose is unachievable reads as coverage the
suite does not have.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
extension_for's docstring asserted that every value co-core yields is
lower-case alphanumeric, in the same commit that deleted _EXTENSION_SAFE - the
local check which enforced exactly that. The claim became a fact about another
repository's data with nothing here to catch it changing.

Now asserted over the same inputs the delegation test uses, hoisted into
_MEDIA_TYPES_CHECKED so the two cannot drift apart, and widened to the four
table entries neither test covered (application/xhtml+xml, application/xml,
text/xml, image/gif).

Nothing depended on the claim for safety: RenderOccasion.values re-checks every
occasion value against _SEGMENT_SAFE, so an unusable answer raises
InvalidOccasionError rather than writing a malformed key. But it would raise at
replication time, pointing at a table this repo does not own. The docstring now
says that instead of asserting the property outright.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
assert "import mimetypes" not in source read straight past
`from mimetypes import guess_extension` and `import mimetypes as mt` - the two
spellings most likely to appear if someone reintroduces the fallback - and
would trip on any comment containing the phrase, which this module's own block
already runs close to. Substring matching over source is the technique CR 9-11
replaced with an AST scan for this same package, for this same reason.

Reuses _imported_modules from the layering guard rather than writing a second
scanner: it resolves aliases and relative forms, and its own planted-import
tests keep it honest, so the detector is proven elsewhere instead of trusted
here. A new planted test covers all three mimetypes spellings.

_EXTENSIONS moves from a substring check to an AST scan of assigned names,
keeping the hasattr check beside it - one sees a definition the other cannot
(shadowed or conditional), and vice versa.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
"helper. Deriving evaluates" sat alone mid-paragraph, breaking the column the
rest of the file keeps and making the diff read as a truncation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…t tree

The destination.py entry credited rep_fields.py for the _slug companions but
described the extension as simply "implied by the origin's media type", which
now under-describes a cross-repo dependency of exactly the same kind. The tree
is where someone looks to find out which module owns what.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>


Setting this worktree up, I replaced the .wheelhouse directory with a symlink
to the main checkout's, to skip re-downloading 324 wheels. The directory is not
untracked: .gitignore carries `.wheelhouse/*` plus `!.wheelhouse/.gitkeep`
precisely so the find-links directory exists at checkout, because uv reads that
config on every invocation and errors if it is missing (archiver#116). So
`rm -rf` deleted a tracked file and `git add -A` committed the symlink in its
place.

In CI that symlink dangles - it names a path on this VM - and every job that
touches the wheelhouse died at setup: lint, test and client-drift all failed in
under 40s on `Failed to read --find-links directory`. Locally nothing showed,
because locally the target exists.

Restores .gitkeep and links the wheels individually inside the directory, which
`.wheelhouse/*` ignores.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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