Repository navigation
Asset record support: budget-neutral reader, declared repo_meta + assessment block, trust-rule tests - #2
Merged
Conversation
…move unused pytest import
select_source_paths appends record paths (basename == RECORD_BASENAME) after every existing pass, outside all shared budgets: never counts toward total/mtotal/src_files, never sets capped, never displaces any other selected file. Oversized bodies (>RECORD_MAX_BYTES) are skipped; overflow beyond _RECORD_MAX_FILES=20 subdir records is dropped silently without flipping capped.
Spec §7 channel 2: a record naming provider env vars or "mcp server" must never generate persisted marker_hits from its own text. Adds _skip_marker_scan(path) guarding the single shared scan_text call site in _scan_present_blobs, which every scan pass in GitContentFetcher.fetch (manifest pre-scan, source pre-scan, final re-scan over the selected set) routes through -- one guard covers all of them.
…anch DirectSource.acquire parses asset-record.json (record.parse_record) out of the freshly fetched files and merges declared_created_by, declared_maintained_by, declared_created_at into a copy of repo_meta. ONLY on the `acquired` branch: `unchanged` fetches no files, so the record is unreadable there, and emitting None keys would look identical to "record removed" to CodeRoot's executor, which preserves prior DB values on that branch (Task 8). Updates test_acquire_result_carries_repo_meta_on_both_branches to reflect the now-asymmetric key sets between the two branches.
assemble.build now computes record.declared_block(content) after the subdir filter (so a subdir subject reads its own re-rooted asset-record.json) and serves it at assessment["declared"] (technologies/model_access fact envelopes, or None). Deliberately not threaded into build_payload/compute_fingerprint — content_fingerprint stays byte-identical with and without a record, verified by the existing fingerprint-parity tests plus a manual check. Updates the pinned assessment-shape test to sixteen keys.
…rsarial record is inert
…0; F402 rename - _clean_technologies: a dependencies list where every entry is rejected (or which starts empty) now collapses to None instead of [], so declared_block never asserts a false "zero dependencies" fact. - _RECORD_MAX_FILES raised from 20 to 40 to match _SKILL_MAX_FILES parity — a monorepo with >20 subdir records is a legitimate case, not adversarial; the per-file RECORD_MAX_BYTES cap already bounds the worst case at 640KiB of budget-neutral reads. - git_fetch._ls_tree: rename the loop variable `record` to `entry` (ruff F402, was shadowing the `record` module import). - content.py record pass: reorder the basename-equality check ahead of the `not in selected` membership tests (cheaper, runs first); note the terminal record pass in select_source_paths's docstring.
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.
Implements Part A (Tasks 1-7) of the authoring-MCP plan (spec: CodeRoot-Open-Source docs/superpowers/specs/2026-08-09-authoring-mcp-design.md).
What
record.py: tolerantasset-record.jsonreader — malformed = absent, never raises (incl. RecursionError on adversarial nesting); field-level defects drop fields, all-rejected dependency lists collapse to absent rather than serving a false "zero dependencies" declarationcapped, never displaces another file (cap 40, per-file 16KiB)scan_textcall site — an adversarial record produces zero marker hits (non-vacuity control test included)ALLOWLIST_VERSION7 → 8 (forces corpus re-acquisition on rollout)DirectSource.acquireemitsdeclared_created_by/maintained_by/created_atonrepo_meta(acquired branch only — the unchanged branch deliberately omits them; CodeRoot preserves prior values there)assemble.buildserves adeclaredblock (technologies + model_access fact envelopes, sourcedeclared: asset-record.json) — excluded frombuild_payload, socontent_fingerprintis byte-identical with/without a recorddeclared— whole-payload equality, mutation-tested during review (fingerprint leak, prose leak, suppressor promotion all caught)Verification
645 passed, 2 skipped (pre-existing corpus-gated). Ruff: no new lints. Two adversarial review rounds on the spec + per-task reviews + whole-branch final review (verdict READY, all four classification channels independently re-verified).
Rollout note: deploy order matters — see the plan's rollout notes (stop workers → migrate → deploy → restart); deploying this before the OSS counterpart while old workers run causes a silent corpus-wide NULL-stamp on the declared columns.
🤖 Generated with Claude Code