Skip to content

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

@githubrobbi

Description

@githubrobbi

Goal

Execute Phase 9 of world_class_rust_workspace_refactor_playbook.md (\u00a71013-1078, local-only): reduce hidden magic, keep builds deterministic and portable, isolate complicated compile-time behavior.

Recon (at SHA 8a672bba7, post-Phase-8e + #297 closeout)

  • build.rs files: 1 (crates/uffs-cli/build.rs, 108 LOC, MSVC-gated /DELAYLOAD + winresource).
  • Proc-macro crates: 0 (no proc-macro = true anywhere).
  • Declarative macro_rules!: 6 across 2 files (5 in uffs-mft::index::storage::deserialize + 1 in uffs-mft::platform::drive_letter), all pub(crate)-scoped or function-local.
  • Workspace-internal codegen binaries: 4 (scripts/ci/{gen-hooks, gen-workflow, manifest-audit} + scripts/ci-pipeline). 3 of 4 have drift detectors wired into pre-push + pr-fast.yml.
  • Env vars consumed: ~26 distinct (4 Cargo build-time, ~7 standard runtime, ~16 UFFS_* knobs).
  • include_bytes! / include_str!: 6 use-sites, all leaf-data (no codegen-pipeline magic).

Phase 9 is

A predominantly verification + documentation + audit-tool phase (mirroring Phase 6 / 7 / 8 patterns for UFFS). The existing posture is already textbook-clean by construction; Phase 9's value is the per-site justification record + the policy doc + the audit tool that catches future drift.

Sub-phase plan (~4-5 h total)

# Sub-phase Est. Deliverable
9a Plan doc + baseline tool (scripts/dev/build_codegen_audit.sh) 45 min PR
9b build.rs audit 30 min Findings-only OR drift PR
9c Proc-macro non-introduction policy 20 min Folded into 9f
9d Declarative macro audit 30 min Findings-only OR drift PR
9e Codegen binary inventory 20 min Folded into 9f
9f Env-var inventory + # Environment rustdoc + build_codegen_policy.md + CONTRIBUTING 1.5 h + 30 min PR
9h Final report + closeout 30 min Doc-only (local) + issue closure

Acceptance (23 criteria, full table in local plan \u00a72)

Key ones:

  • Every build.rs justifies itself per playbook \u00a71041-1046.
  • Every macro_rules! justifies itself per playbook \u00a71062-1064.
  • Every codegen step has a drift detector OR a documented one-shot rationale.
  • Every env var carries a registry entry (name / scope / type / default / where read / semver class).
  • All existing CI gates green: lint-ci, lint-ci-no-default (Phase 8e), tests, cargo-machete, cargo-deny.
  • New build_codegen_policy.md landed in docs/architecture/code-quality/ + CONTRIBUTING.md cross-link.
  • New scripts/dev/build_codegen_audit.sh landed.

Companion docs

  • Plan: docs/dev/architecture/code_clean/phase_9_build_scripts_macros_codegen_implementation_plan.md (local-only \u2014 276 LOC).
  • Playbook source: docs/dev/architecture/code_clean/world_class_rust_workspace_refactor_playbook.md \u00a71013-1078 (local-only).
  • Predecessor: phase_8_* plan + final report (Phase 8e closeout 2026-05-19).
  • Sibling policies: panic_policy.md (5e), allocation_policy.md (6f), trait_policy.md (7g), dependency_policy.md (8c).

Rule-1 adherence

Zero #[allow] introductions; zero suppression hacks. The single #[allow(clippy::expect_used)] in crates/uffs-cli/build.rs is the documented exception per panic_policy.md \u00a71 (build scripts are out of scope of the runtime panic policy). Phase 9 confirms the rationale is current; does not relax it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    playbookWorld-class Rust workspace refactor playbook phase trackingrefactorRefactor work tracked by the world_class_rust_workspace_refactor_playbook

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions