Researched current industry practice on code organization/maintainability (Ousterhout's deep modules and information hiding, package-by-feature vs. package-by-layer, functional-core/imperative-shell testability, tech-debt prevention via ADR-equivalent inline rationale) and wrote it into ARCHITECTURE.md as a set of concrete, project-specific rules rather than a generic essay — each principle cites a real example already in this codebase or fixed by this commit. Cross-linked from SPEC.md, which stays about product design, not code organization. Applied it to this PR's own code: - Pulled process_package/fetch_and_verify/build_and_publish/run_review/ approve out of main.rs into a new pipeline.rs. main.rs's own main() had grown to 278 lines and zero tests by treating "it's just the entry point" as an excuse to skip separating logic from wiring; now main.rs is argv dispatch only. - Extracted decide_tier_action as a pure function (verification outcome + pending-state -> what to do), replacing dispatch logic that was previously inlined into a function that also made the real network/ build calls. Four unit tests, no I/O, covering all four outcomes. - Added a `//!` module doc comment to every file touched in this branch, each stating that module's one job in a sentence, per the "deep modules" principle the spec argues for. Coverage's reported total drops (94% -> 78%) because pipeline.rs is deliberately NOT excluded from it the way main.rs is, even though it's mostly the same kind of untestable I/O orchestration — excluding it would hide decide_tier_action's real unit-test coverage along with the untested parts. Noted inline in Makefile.toml/ci.yml so the number doesn't look like a quality regression at a glance. Also added a project reference memory pointing at ARCHITECTURE.md rather than duplicating its content there, per this session's own memory-hygiene rules (architecture/conventions are derivable from the repo and shouldn't be duplicated somewhere that can go stale). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
63 lines
2 KiB
TOML
63 lines
2 KiB
TOML
[config]
|
|
default_to_workspace = false
|
|
|
|
[tasks.format]
|
|
command = "cargo"
|
|
args = ["fmt"]
|
|
|
|
[tasks.format-check]
|
|
command = "cargo"
|
|
args = ["fmt", "--check"]
|
|
|
|
[tasks.lint]
|
|
command = "cargo"
|
|
args = ["clippy", "--all-targets", "--", "-D", "warnings"]
|
|
|
|
# Cognitive complexity (clippy's nursery lint, not literal cyclomatic
|
|
# complexity — see clippy.toml for why) on the bin target only: run without
|
|
# --all-targets so #[cfg(test)] code, which naturally reads as more
|
|
# "complex" without being a maintainability signal, isn't gated on this.
|
|
[tasks.complexity]
|
|
command = "cargo"
|
|
args = ["clippy", "--bins", "--", "-D", "warnings", "-W", "clippy::cognitive_complexity"]
|
|
|
|
[tasks.test]
|
|
command = "cargo"
|
|
args = ["test"]
|
|
|
|
# Named coverage-report, not coverage: cargo-make reserves "coverage" for
|
|
# its own built-in tarpaulin/kcov-routing composite task, which clobbers a
|
|
# same-named custom one.
|
|
#
|
|
# Reports coverage only; not gated on a threshold yet — main.rs is thin
|
|
# argv dispatch exercised by the real end-to-end `cargo run`, not unit
|
|
# tests, so it's excluded here rather than dragging the number down for
|
|
# reasons unrelated to test quality. pipeline.rs is deliberately NOT
|
|
# excluded even though it's mostly network/subprocess/filesystem
|
|
# orchestration too (hence its own low number) — its one pure decision
|
|
# function (decide_tier_action) is unit tested and should stay visible in
|
|
# this report; excluding the whole file would hide that signal along with
|
|
# the untested parts. See ARCHITECTURE.md > "separate pure decision logic
|
|
# from I/O."
|
|
[tasks.coverage-report]
|
|
command = "cargo"
|
|
args = ["llvm-cov", "--ignore-filename-regex", "main\\.rs", "--summary-only"]
|
|
|
|
[tasks.audit]
|
|
command = "cargo"
|
|
args = ["audit"]
|
|
|
|
[tasks.build]
|
|
command = "cargo"
|
|
args = ["build", "--release"]
|
|
|
|
[tasks.install-hooks]
|
|
description = "One-time setup: point git at the tracked hooks in .githooks/"
|
|
command = "git"
|
|
args = ["config", "core.hooksPath", ".githooks"]
|
|
|
|
[tasks.ci]
|
|
dependencies = ["format-check", "lint", "complexity", "test", "coverage-report", "audit"]
|
|
|
|
[tasks.default]
|
|
alias = "ci"
|