chore(trust): harden CI gates, adopt static analysis, unify corpus traversal [v0.7.14] - #49
Merged
Merged
Conversation
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md. Convert the 2026-06-09 repository technical audit into a pinned roadmap artifact ahead of v0.8.x scoping: restore the eight orphaned CI test batteries with a self-guarding meta-test, add ruff/mypy gates, extract a canonical corpus traversal seam in core, and clean up repository hygiene.
Three agent commits today shipped with tool footers or a tool author identity and had to be amended. Make the guideline self-sufficient for agents: name the prohibited artifacts concretely (session links, Co-Authored-By tool trailers, generated-by lines), require the maintainer identity on both author and committer with a verification command, and require the artifact path in roadmap commit bodies.
rac-agent-session-start.md and rac-agent-instructions.md had drifted: each held rules the other lacked (attribution ban, pytest gate, branch discipline versus the six-step contract ritual). Fold the unique rules of instructions into session-start, add the corpus push gates, and retire the duplicate so one artifact owns session context.
Claude Code auto-loads the root CLAUDE.md at session start. Make it a thin router that imports rac-agent-session-start.md and rac-agent-commit-guidelines.md from the corpus, indexes the situational prompts by path, and points at the active roadmap series — so the canonical artifacts reach every agent session without duplication.
…:v0.7.14] Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 1. Eight test files (~1,306 lines, including all coverage for the two file-mutating commands rac new and rac migrate) were missing from the battery matrix and never ran in CI. Adds create, init, migrate, and resolve batteries, extends core, and adds tests/test_ci_batteries.py so an orphaned or duplicated battery entry fails the suite instead of relying on the matrix comment. All 163 orphaned tests pass unchanged.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 2. Pins ruff (E, F, W, I, UP, B; line length 100; py311 target) and mypy (disallow_untyped_defs for src/) in pyproject, adds ruff/mypy/types-PyYAML/ pytest-cov to the dev extras, and applies the mechanical fixes: import sorting, formatter pass, exception chaining (raise ... from), thirteen return/parameter annotations, distinct names where one variable held two result types, and two long lines wrapped via implicit concatenation so string contents are untouched. All 24 golden files are byte-identical; full suite passes (618 tests).
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 2. Adds a lint job to the reusable test workflow (ruff check, ruff format --check, mypy src/ on py3.11), so both ci.yml and the release gate inherit it through workflow_call.
…admap:v0.7.14] Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 4. Rule 1 gains a light pull-request tier (static gates plus a core/golden/ dogfood smoke battery); the full battery grid stays merge-gated. Records that the battery-sync risk is now enforced by tests/test_ci_batteries.py and marks the PR-trigger alternative as partially adopted.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 4. New pr-checks workflow runs the static gates and a core/golden/dogfood smoke battery on py3.11 for every pull request, per amended ADR-027 rule 1. The full battery grid remains merge-gated on main.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. walk_corpus composes find_markdown_files, parse_file, and classify into one lazy, deterministic iterator of CorpusEntry (path, product, classification). Services migrate onto it in the following commits; the v0.8.x Explorer consumes the same seam. Joins the core battery and the PR smoke set.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. Behavior unchanged; validate battery and goldens pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. Behavior unchanged; index, resolve, and golden batteries pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. The directory view reads type and confidence straight from the walk's classification — identical values to build_inspection, which derives them from the same classify call. Inspect battery and goldens pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. Behavior unchanged; stats battery and goldens pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. Behavior unchanged; portfolio, review, and golden batteries pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. All three directory entrypoints share one _corpus_items helper over walk_corpus; _build_report takes parsed items directly, and the single-file path keeps _parsed_items. All relationship batteries, goldens, and dogfood pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 3. Discovery and classification ride the seam; the no-overwrite guards and byte-preserving envelope write are unchanged. Migrate battery and goldens pass.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 4. The file was committed before .gitignore covered it; the ignore rule prevents recurrence.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 4. One full-suite coverage job on py3.11 with a term-missing report in the job log. Report-only — no threshold gate this release (currently 97%).
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 4. Adds the ruff/mypy commands to the contributor verification checklist, notes the battery-guard rule for new test files, and shows the local coverage view.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md.
Implements rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, Initiative 4. pytest --cov (now in CI and the contributor docs) writes .coverage locally; ignore it the same way other build artifacts are.
PR #49 shipped with a platform-appended 'Generated by Claude Code' footer and session link that had to be removed by hand — the third surface (after commit footers and commit identity) where a tool default injected attribution the project forbids. Make the PR guideline self-sufficient: verify the stored body after every create or edit, strip appended footers, treat the Implementation Process section as the only sanctioned AI disclosure, and check for sanitizer-eaten angle-bracket placeholders.
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.
Summary
Implements
rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md— the remediation release for the 2026-06-09 repository technical audit, closing every trust-infrastructure gap found before v0.8.x scoping begins.Adds:
rac newandrac migrate) restored to the matrix, with a self-guarding meta-test (tests/test_ci_batteries.py) that fails the suite on orphaned, duplicated, or stale battery entries.pr-checks.yml) runs the gates plus a core/golden/dogfood smoke battery on every pull request.walk_corpusinrac/core/corpus.pyis now the single walk→parse→classify definition, consumed by all seven repository services.CLAUDE.mdrouter importing the canonical session prompts, and consolidation ofrac-agent-session-start.md/rac-agent-instructions.md.Roadmap / ADR Trace
Roadmap:
rac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md(RAC-KTQAAPF5ZDZX; identity assigned by dogfoodingrac migrate metadata)Relevant ADRs:
rac/decisions/adr-027-ci-test-topology.md— amended in this PR, via the mechanism its own Principle 4 prescribeswalk_corpusis a core module, not a service helper)Scope
Included
create,init,resolve,migrate) and an extendedcorebattery; everytests/test_*.pyprovably maps to exactly one battery.[tool.ruff](E, F, W, I, UP, B; line-length 100; py311) and[tool.mypy](disallow_untyped_defsforsrc/) inpyproject.toml;ruff,mypy,types-PyYAML,pytest-covadded to the dev extras.raise … from), ~13 missing annotations, two variables renamed where one name held two result types, two over-length lines wrapped via implicit concatenation so string contents are byte-identical.CorpusEntrycarries the fullClassification(not just the type string) becauseinspectandstatsneed confidence; everyone else reads theartifact_typeproperty..DS_Storeremoved; coverage data files gitignored.CONTRIBUTING.md,docs/testing.md) updated with the new gates; CHANGELOG entries added.Excluded (deliberately — see roadmap Non-Goals)
services/relationships.py(552 lines, three concerns) — deferred to v0.8.0 service-API shaping.py.typed/ PEP 561 marker — decided alongside v0.8.0's public service API.cli.pyrestructuring — 925 lines of linear parser registration: large, not complex.Product / Architecture Decisions
main. The "run tests on every PR" alternative is recorded as partially adopted.tests/test_ci_batteries.py, which lives in thecorebattery so the guard guards itself.walk_corpuslives in core (ADR-015): it composes onlyfind_markdown_files,parse_file, andclassify; iteration is lazy and ordering is the existing sorted order, so consumer output is provably unchanged.corpus.pyis now the onlyfind_markdown_filesconsumer outsidefs.py.relationshipskeeps two item sources:_corpus_items(directory walks) and_parsed_items(single-file paths);_build_reportnow takes parsed items directly.python -m mypy/python -m ruff, not bare binaries — a PATHmypydiffering from the env's was observed during implementation.User-Facing Contract
CLI
No CLI surface changes. No commands, flags, outputs, JSON fields, or exit codes were added or modified.
Human / JSON Output
All 24 golden files are byte-identical to their pre-release state — verified by
git diffagainst the pre-implementation commit. A golden diff anywhere in this release was defined as a defect (roadmap Implementation Contract).Exit Codes
Unchanged (
0success /1validation-operational /2usage).Verification
Ran
Covered
resolvebattery fromtests.ymlfails the meta-test; restoring it passes.walk_corpusunit tests: sorted-order parity withfind_markdown_files, classification parity withclassify, unknown-type as valid outcome,recursive=Falseboundary, lazy iteration.Review Path
.github/workflows/tests.yml+tests/test_ci_batteries.py— the gap and its permanent fixrac/decisions/adr-027-ci-test-topology.md+.github/workflows/pr-checks.yml— the policy amendment and its implementationpyproject.toml— tool baselinessrc/rac/core/corpus.py+tests/test_corpus.py— the new seamconsume walk_corpusrefactor commits — mechanical, one service eachchore(lint)commit — large but behavior-neutral (formatter + annotations); goldens prove itrac/roadmaps/v0.7.x-trust/v0.7.14-audit-hardening.md, docs, CHANGELOGNotes For Reviewer
chore(lint)commit touches 58 files; the two long-line wraps incore/artifacts.pyandoutput/human.pyuse implicit string concatenation specifically to keep string contents byte-identical — worth a glance.inspect_directorynow reads type/confidence from the walk'sClassificationinstead ofbuild_inspection— identical values (both derive from the sameclassifycall), strictly less work.walk_corpusas its stable traversal seam.test_ingest.pyfailure in the dev container (brokencffiinstall, unrelated to this change) was fixed by reinstalling the package locally; CI installs fresh and is unaffected.Implementation Process
Implemented with AI assistance under the roadmap contract. Final scope, review, and acceptance decisions were made by the maintainer.