chore(scripts): add trait_generic_audit.sh — Phase 7a baseline tool (refs #287)#288
Merged
Merged
Conversation
…refs #287) New script `scripts/dev/trait_generic_audit.sh` — prod-only trait / generic / dispatch inventory for the UFFS workspace. Mirrors `scripts/dev/clone_alloc_audit.sh` (Phase 6a) and `scripts/dev/risk_markers_prod.sh` (Phase 5a) in shape. Counts per crate: * pub trait / pub(crate) trait / private trait definitions * generic fn signatures (incl. inherent methods) * dyn Trait sites * where-clause density * impl Trait sugar (AsRef, Iterator, Fn, …) Per-trait inventory: * file:line, visibility, and prod-impl count workspace-wide (a trait defined in crate A can be implemented by a struct in crate B — e.g. FileReader in uffs-core impl-d by DaemonFileReader in uffs-daemon) Dispatch site inventory: * every `dyn <Trait>` site with file:line for Phase 7d classification (D1-PLUGIN / D2-HETERO / D3-NOOP / D4-VTBL-COST) Sealed-trait pattern detection: * canonical `mod private { pub trait Sealed {} }` shape for Phase 7e seal/open decisions Annotation tally: * existing `#[expect(clippy::type_complexity)]` / `#[expect(clippy::too_many_arguments)]` / `#[expect(clippy::wrong_self_convention)]` / `#[expect(clippy::trait_duplication_in_bounds)]` sites for Phase 7f bound-rationalization Optional `--with-clippy` flag for clippy-JSON cross-check against the 6 Phase-7-relevant clippy lints. Excludes the same paths as Phase 6 baseline (tests/, benches/, examples/, build.rs, *_tests.rs, *_test.rs, test_*.rs). Companion to (local-only): * docs/dev/architecture/code_clean/phase_7_traits_generics_dispatch_implementation_plan.md * docs/dev/baseline/2026-05-19/phase_7_trait_generic_baseline.md * docs/dev/baseline/2026-05-19/phase_7_starting_sha.txt Refs: #287
This was referenced May 19, 2026
Merged
githubrobbi
added a commit
that referenced
this pull request
May 19, 2026
The Phase 7g decisions-log row in `trait_policy.md:194` read 'this PR' at the time of authoring (when PR #290 was open). After PR #290 merged the placeholder needed backfilling to '#290' to match the surrounding rows (#288/#289/#291). Companion to Phase 8e (PR #296), which already backfilled the sibling 'TBD' placeholder on row 193 (Phase 7f -> #291). This 1-line edit completes the decisions-log hygiene pass for Phase 7.
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.
Phase 7a — adds the prod-only trait / generic / dispatch inventory tool for the Phase 7 refactor (issue #287).
Mirrors
scripts/dev/clone_alloc_audit.sh(Phase 6a, PR #281) andscripts/dev/risk_markers_prod.sh(Phase 5a) in shape.What it does
pub trait/pub(crate) trait/ private trait definitions, generic fn signatures,dyn Traitsites,where-clause density,impl Traitsugar.FileReaderinuffs-coreis implemented byDaemonFileReaderinuffs-daemon).dyn <Trait>site with file:line for Phase 7d.#[expect(clippy::*)]against the 4 Phase-7-relevant lints.--with-clippyflag for clippy-JSON cross-check.Why it ships pre-empty-finding
Like Phase 5a / Phase 6a tools, this is the prerequisite for the per-sub-phase audits. The script generates the authoritative baseline that 7b–7h consume. Zero-finding pre-validation is expected (strict-clippy is already green on
main); the audit value is the per-site classification + the per-trait justification log.Snapshot (executed locally on
d2d533021)pub trait(workspace)pub(crate) trait(workspace)dyn Traitsites (workspace)whereclauses (workspace)impl Traitsugar (workspace)(The Phase 7 plan §1.1 had advisory counts of
pub trait=4,dyn=15; the script is the authoritative source — the deltas come from the script catching inherent methods + tokio-bounddyn Futureetc. Phase 7d / 7e re-classify each.)13 traits in the per-trait inventory match exactly the plan §1.2 candidate list.
Validation
lint-pre-pushpassed (69 s) — includes lint-fast + sec + smoke + lint-ci-windows.clone_alloc_audit.sh).3628BD817A687030E83025A8E406D32B4736D09F).Local-only artifacts (not in this PR, per
.gitignore /docs/dev/)docs/dev/architecture/code_clean/phase_7_traits_generics_dispatch_implementation_plan.mddocs/dev/baseline/2026-05-19/phase_7_starting_sha.txtdocs/dev/baseline/2026-05-19/phase_7_trait_generic_baseline.mdNext: 7b — trait justification audit per playbook §879-886 (J1/J2/J3/J4 taxonomy).
Refs: #287