data: stranded vendor evidence prose and bundle templates become data (W49) - #103
Merged
Conversation
The bare-ALLOW audit (allow_semantics.py), the packaging limits/also-reads/ unrecorded tables (packaging_limits.py) and the content-rule reasons (permissions_render.py) are facts about vendors, the same class #89 moved into data/*.json. They now live in data/allow-semantics.json, data/packaging-limits.json and data/permissions-content-reasons.json, each note keeping its stated basis/date as structured fields (only where the prose stated one -- nothing invented), each table validated against a schema file beside it with the same stdlib validator the vendor entries use, mutation-tested in tests/test_data_tables.py. The Python modules are loaders with unchanged public names and shapes (ALLOW_SEMANTICS, VOUCH_SPEAKS, tuple-keyed PART_LIMITS, _CONTENT_REASON), so no consumer changes; the bundler's two vouch-evidence strings move as data/allow-semantics.json vouch_notes verbatim. Every golden fixture is byte-identical and bundle() output is unchanged for all 12 agents. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
The header banner, the specialized runtime and the vendor-binding block were Python source held as string literals. They are template files now, loaded via importlib.resources and rendered by __TOKEN__ str.replace (never .format), so each template is valid Python exactly as committed: ruff lints them (extend-include, with a documented F821 per-file-ignore for names the bundler splices in from other sections) and the formatter excludes them because their text is frozen into generated bundles. tests/test_bundler_templates.py pins token coverage both ways -- the token set in each file equals the set the renderer supplies, and no rendered bundle keeps a residual token -- and parses every template. The package-data derivation test now walks data/ recursively so the template directory (and data/vendors/) ships in the wheel. bundle() output is byte-identical for all 12 agents (sha256 compared before/after); the equivalence and subprocess-replay suites are green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
AGENTS.md gains the compact externalized_text hard rule beside code_comments (owner standard 2026-09-02): non-Python text and vendor facts live in data/template files read by code, __TOKEN__ + str.replace, templates linted as their own language, package-data and frozen-binary coverage tested; error messages and behaviour stay code. CHANGELOG gets the Unreleased entry; no version bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Claude <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.
What this changes
No behaviour differs: this externalizes text per the owner standard of 2026-09-02 (org-plan
plan/coding-standards.md§2). (1) The per-vendor evidence prose stranded inallow_semantics.py,packaging_limits.py,permissions_render.pyandbundler.pymoves into schema-validated data tables (data/allow-semantics.json,data/packaging-limits.json,data/permissions-content-reasons.json), each note keeping its stated basis/date as structured fields; the Python modules become loaders with unchanged public names and shapes. (2) The bundle header/runtime/binding source held as string literals moves todata/templates/*.py.tmpl, loaded viaimportlib.resourcesand rendered by__TOKEN__+str.replace, so every template is valid Python exactly as committed andruff check .lints it in the existing CI lint job (extend-include, documentedF821per-file-ignore for spliced names; formatter excludes templates because their text is frozen into generated bundles).AGENTS.mdgains the compactexternalized_texthard rule besidecode_comments.Claim check
No adapter or matrix change; every evidence note moved verbatim. Basis/date fields were added only where the prose itself states them (cursor's 2026-08-28 live experiment, gemini_cli's 2026-08-28 source read, the "Documented"/"Source"/"Docs-basis only" phrasings, claude_code's content-rule citation read 2026-08-29) — nothing invented, and rows whose prose states no basis carry none.
MATRIXrow carries averifiedrecord — n/a, no matrix changeChecks
pytest -qpasses — 1446 passed, 4 skipped (33 new tests:tests/test_data_tables.pyschema + mutation coverage,tests/test_bundler_templates.pytoken coverage)ruff check .andruff format --check .pass (the check now also lints the three templates as Python)importlib.resourcesonly;tests/check_stdlib_only.pygreen)git commit -s)Additional gates for this move:
git diff tests/fixturesis empty.bundle()byte-identical for all 12 agents: sha256 of every bundle compared before/after the refactor, equal; the bundle-equivalence and subprocess-replay suites are green.data/recursively (it previously checked only the top level), sodata/templates/*.py.tmplanddata/vendors/*.jsonare both derived into the wheel manifest check;pyproject.tomlships the new pattern.__TOKEN__planted in a template fails 14 tests; the planted-lint-error check confirmedruff check .really discovers.py.tmplfiles. These mutations fail; no claim the class is closed.Notes for the reviewer
bundle()splices into a generated runtime'sdegrade()docstring moved verbatim toallow-semantics.jsonvouch_notes— they are vendor evidence, but they are also frozen bundle bytes, hence verbatim.allow_semantics.pymodule docstring stating the bare-ALLOW rule (the audit detail now lives in the data/schema descriptions), the rendererUnrepresentablereason strings inpermissions_render.py/permissions.py/packaging.pyfallbacks (diagnostics beside the condition that raises them, per the standard's stated line), andtools/recount's stated tables (recount is the derivation source for vendor JSON; externalizing it is a separate decision).docs/design/dialect-families.mdcitesbundler_templates.pyline numbers from D3; those references describe the design at its pin and were left untouched.🤖 Generated with Claude Code
Generated by Claude Code