Skip to content

chore(scripts): add build_codegen_audit.sh -- Phase 9a baseline tool (refs #298)#299

Merged
githubrobbi merged 1 commit into
mainfrom
chore/build-codegen-audit-phase-9a
May 19, 2026
Merged

chore(scripts): add build_codegen_audit.sh -- Phase 9a baseline tool (refs #298)#299
githubrobbi merged 1 commit into
mainfrom
chore/build-codegen-audit-phase-9a

Conversation

@githubrobbi
Copy link
Copy Markdown
Collaborator

Summary

Phase 9a baseline inventory tool for the workspace's build scripts, proc-macro crates, declarative macros, codegen binaries, and env-var consumption surface. Mirrors the pattern established by Phase 6a / 7a / 8a baseline scripts.

Companion to issue #298.

Output (per recon at SHA 8a672bba7)

Category Count Notes
build.rs files 1 crates/uffs-cli/build.rs, 108 LOC, MSVC-gated /DELAYLOAD + winresource
Proc-macro crates 0 Deliberate workspace posture (documented in 9c)
macro_rules! declarations 6 5 binary-read helpers + 1 letter-const generator; all uffs-mft, all pub(crate)
Codegen binaries 4 3 drift-detected (gen-hooks / gen-workflow / manifest-audit) + 1 orchestrator (ci-pipeline)
Distinct env-var names 36 4 Cargo build-time, ~7 standard runtime, ~16 UFFS_* knobs, 3 XDG, others
include_*! use sites 2 uffs-text case-fold table

Modes

  • Default (no flag): rg+awk only, ~1 s. Emits markdown to stdout.
  • --with-cargo: + cargo build --workspace --timings (~30 s warm).

Filter contract

Prod-only by default — excludes tests/, benches/, examples/, build.rs files (except in the dedicated build.rs section), and files matching tests.rs / *_tests.rs / *_test.rs / test_*.rs. Mirrors the Phase 6/7/8 audit-script pattern.

Caveats documented inline

  • Env-var detection requires names \u2265 2 chars + filters comment-prefix lines (drops X false-positive from rustdoc prose like /// env::var("X")returnsOk("") ...).
  • macro_rules! parser captures name + file:line but does NOT classify per playbook \u00a71064 (syntax shaping / impl repetition / pattern capture). Classification happens in Phase 9d.
  • Per-crate env-var count uses prod-globs (test-only vars don't inflate the per-crate count); workspace-wide list reports ALL env vars in any prod file (test-only env vars are intentionally surfaced because Phase 9f's manual review classifies them).

Rule-1 adherence

Zero #[allow] introductions; zero suppression hacks. The script is a read-only inventory tool that emits markdown to stdout. No source code modifications.

Companion plan + future PRs

  • Plan: docs/dev/architecture/code_clean/phase_9_build_scripts_macros_codegen_implementation_plan.md (local-only, 276 LOC).
  • Next: 9b (build.rs audit), 9c (proc-macro non-introduction policy), 9d (macro audit), 9e (codegen inventory), 9f (env-var registry + build_codegen_policy.md + CONTRIBUTING), 9h (closeout).

Total Phase 9 estimate: ~4-5 h.

Closes #298 only at 9h (this PR is 9a only).

…(refs #298)

Phase 9a baseline inventory tool for the workspace's build scripts,
proc-macro crates, declarative macros, codegen binaries, and env-var
consumption surface.  Mirrors the pattern established by:

- `scripts/dev/clone_alloc_audit.sh`     (Phase 6a)
- `scripts/dev/trait_generic_audit.sh`   (Phase 7a)
- `scripts/dev/feature_dep_audit.sh`     (Phase 8a)

Output (per recon at SHA `8a672bba7`):

- 1 `build.rs` (`crates/uffs-cli/build.rs`, 108 LOC, MSVC-gated)
- 0 proc-macro crates
- 6 `macro_rules!` declarations (all `uffs-mft`, `pub(crate)`)
- 4 workspace-internal codegen binaries (3 drift-detected via gates.toml,
  1 release orchestrator)
- 36 distinct env-var names consumed across workspace
- 2 `include_*!` use sites (case-fold table in `uffs-text`)

Modes:
- default: rg-only, ~1 s (prod-globs filter; tests/benches/examples excluded)
- `--with-cargo`: + cargo build --workspace --timings (~30 s warm)

Companion plan: `docs/dev/architecture/code_clean/phase_9_build_scripts_macros_codegen_implementation_plan.md` (local-only, 276 LOC).
Tracking issue: #298.

Rule-1 adherence: zero `#[allow]` introductions.  The script is a
read-only inventory tool; emits markdown to stdout.  Excludes test
files via prod-globs (matching the Phase 6/7/8 audit-script pattern).

Caveats documented inline:
- env-var detection requires names \u2265 2 chars + filters comment-prefix
  lines (drops `X` false-positive from rustdoc prose).
- macro_rules! parser captures name but does not classify per playbook
  \u00a71064 (syntax shaping / impl repetition / pattern capture);
  classification happens in Phase 9d.
@githubrobbi githubrobbi enabled auto-merge (squash) May 19, 2026 21:44
@githubrobbi githubrobbi merged commit 0433065 into main May 19, 2026
19 checks passed
@githubrobbi githubrobbi deleted the chore/build-codegen-audit-phase-9a branch May 19, 2026 21:58
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.

[playbook-phase-9] Build scripts, macros, and code generation

1 participant