Analytical metrics about code quality for git history

draft: feat: beging phase 0 of roadmap #1

Open aaronlong.tech
targeting main from feat/phase-0-foundations
Open opened by aaronlong.tech
targeting main from feat/phase-0-foundations

Branch notes: feat/phase-0-foundations #

Scope: all changes on this branch vs main (9 commits, 17 files, +1051/−3). Status: complete and verified — 24 tests green, clippy -D warnings clean, fmt --check clean.

What changed #

Area Files Why
CLI skeleton code-crime/src/cli.rs, main.rs, lib.rs clap derive CLI with analyze --repo <path> --after <date> --format csv|json plus --db <path> for testability. Run stops cleanly at the ingest boundary (not yet built).
Error handling code-crime/src/error.rs thiserror enum CrimeError wrapping git2::Error, duckdb::Error, io, InvalidDate, RepoNotFound. No unwrap() outside tests.
DuckDB store code-crime/src/store.rs Embedded DuckDB via Store: open-or-reuse of a single .duckdb file per run (creates parent dirs), open_in_memory() for tests.
Fixture generator code-crime/fixtures/gen_fixtures.sh 5 deterministic synthetic repos (linear-notes, hotspot-sim, cochange-api, mixed-authors with .mailmap, reformat-noise). Same commit hashes on every run — the test suite depends on it.
Integration tests code-crime/tests/{cli,error,fixtures,store}.rs TDD-written, split by domain (not by milestone). Tests use generated fixtures; fixture determinism is asserted.
CI (build + test) .tangled/workflows/ci.yml Spindle workflow: fmt --check → clippy -D warnings → cargo test --all on every push/PR. Nixery engine, clang pinned (CC/CXX), cargo registry + target cached on Cargo.lock.
CI (release binary) .tangled/workflows/binaries.yml Disabled (manual-only): builds the release binary and packages a checksummed tarball as a smoke test. No publishing — artifact host not yet chosen (Cloudsmith was drafted, then removed). Header documents how to re-enable.
Memory workarounds .cargo/config.toml, .devcontainer/devcontainer.json, docs/build-crash-fix.md Build fixes for memory-limited hosts (see callouts below).
README README.md Status section updated to the current skeleton + fixture workflow instructions.

Why these choices #

  • Tests split by domain (cli / error / store / fixtures) rather than by milestone — the repo convention bans milestone naming in artifacts; every previous phase0 reference was renamed out.
  • --db flag added beyond the roadmap spec so the store can point at temp paths in tests without polluting repo-working data.
  • Deterministic fixtures instead of any random seed — fixture hashes are asserted by the test suite; nondeterminism would instantly break every history-based test.
  • Nixery + clang in CI: the duckdb crate compiles vendored C++ through the cc crate; pinning CC/CXX makes compiler selection explicit rather than image-dependent.
  • Caches keyed on Cargo.lock — dependency compile is the expensive part; the analysis crate itself is small.

Callouts #

  • Memory: the bundled DuckDB C++ compile/link spikes past 1 GB per process. Cargo job parallelism is capped at 4 (.cargo/config.toml) and [profile.dev]/[profile.test] set debug = 0 — debug-info linking OOM-killed the linker here. Devcontainer is capped at 3 GB RAM + 2 GB swap. Override with CARGO_BUILD_JOBS=N on stronger machines.
  • CI correctness fix: an earlier revision of ci.yml ran cargo from the repo root; the crate lives in code-crime/, so all steps and cache paths were corrected to the crate layout.
  • Release publishing is an open decision — binaries.yml deliberately uploads nothing. Tangled/Spindle has no native artifact/release hosting; candidates considered: Cloudsmith (free OSS plan), S3/R2, GitHub Releases on a mirror.
  • Commit history: a033f7f feat: eod commit carries several distinct changes (including the domain renames) and has no body. It is already pushed; fixing it means a rewrite — recommended only at merge/squash time.
  • Not committed / not pushed: product/ is intentionally untracked (roadmap working notes). The branch itself has not been pushed to origin yet.
  • Cargo.lock is gitignored in this repo; CI cache keys hash the lockfile, so uncommitted lock churn does not affect cache validity on CI.
  • Tooling gotchas (for future sessions): this git build rejects --pretty=format: without %; use %aE for mailmap-respecting emails; long builds must run as background processes with output capture, not foreground timeouts.
Commits 2

chore(ai): add max memory to config
feat: start on phase0
Sign up or Sign in to add to the discussion.