Skip to content

data: stranded vendor evidence prose and bundle templates become data (W49) - #103

Merged
open-coder-ai merged 3 commits into
mainfrom
w49/prose-to-data
Sep 2, 2026
Merged

data: stranded vendor evidence prose and bundle templates become data (W49)#103
open-coder-ai merged 3 commits into
mainfrom
w49/prose-to-data

Conversation

@open-coder-ai

Copy link
Copy Markdown
Owner

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 in allow_semantics.py, packaging_limits.py, permissions_render.py and bundler.py moves 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 to data/templates/*.py.tmpl, loaded via importlib.resources and rendered by __TOKEN__ + str.replace, so every template is valid Python exactly as committed and ruff check . lints it in the existing CI lint job (extend-include, documented F821 per-file-ignore for spliced names; formatter excludes templates because their text is frozen into generated bundles). AGENTS.md gains the compact externalized_text hard rule beside code_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.

  • No capability claim is widened without a mechanism behind it
  • Any new/changed MATRIX row carries a verified record — n/a, no matrix change
  • Payload shapes come from a primary source — n/a, no payload change

Checks

  • pytest -q passes — 1446 passed, 4 skipped (33 new tests: tests/test_data_tables.py schema + mutation coverage, tests/test_bundler_templates.py token coverage)
  • ruff check . and ruff format --check . pass (the check now also lints the three templates as Python)
  • Runtime path is still stdlib-only (importlib.resources only; tests/check_stdlib_only.py green)
  • Commits are signed off (git commit -s)

Additional gates for this move:

  • Golden fixtures byte-untouched: git diff tests/fixtures is 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.
  • Package-data: the derivation test now walks data/ recursively (it previously checked only the top level), so data/templates/*.py.tmpl and data/vendors/*.json are both derived into the wheel manifest check; pyproject.toml ships the new pattern.
  • Token coverage is mutation-tested: an orphaned __TOKEN__ planted in a template fails 14 tests; the planted-lint-error check confirmed ruff check . really discovers .py.tmpl files. These mutations fail; no claim the class is closed.
  • No version bump (CHANGELOG Unreleased entry only).

Notes for the reviewer

  • The two vouch-evidence strings bundle() splices into a generated runtime's degrade() docstring moved verbatim to allow-semantics.json vouch_notes — they are vendor evidence, but they are also frozen bundle bytes, hence verbatim.
  • Kept in code as genuinely agentseam-design text (not vendor facts): the condensed allow_semantics.py module docstring stating the bare-ALLOW rule (the audit detail now lives in the data/schema descriptions), the renderer Unrepresentable reason strings in permissions_render.py/permissions.py/packaging.py fallbacks (diagnostics beside the condition that raises them, per the standard's stated line), and tools/recount's stated tables (recount is the derivation source for vendor JSON; externalizing it is a separate decision).
  • docs/design/dialect-families.md cites bundler_templates.py line numbers from D3; those references describe the design at its pin and were left untouched.

🤖 Generated with Claude Code


Generated by Claude Code

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>
@open-coder-ai
open-coder-ai marked this pull request as ready for review September 2, 2026 01:01
@open-coder-ai
open-coder-ai merged commit dc45d4b into main Sep 2, 2026
14 checks passed
@open-coder-ai open-coder-ai mentioned this pull request Sep 2, 2026
4 tasks
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.

2 participants