Skip to content

test(#4107): golden fixture for the git-history and spec-alignment equations - #4118

Merged
squid-protocol merged 2 commits into
mainfrom
fix/4107-history-golden
Oct 2, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/4107-history-golden

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4107.

Problem

The crucible golden scans with git history ablated (GITGALAXY_DISABLE_GIT_HISTORY=1, deliberately, #2985/#2976) and without spec alignment (opt-in, #3111). Seven fields were therefore constant on every crucible file, and their equations were never regression-tested:

  • Architect
  • Authorship Centralization
  • Ownership Entropy
  • Raw Churn Frequency
  • Instability Exposure
  • Volatility Exposure
  • Specification Exposure

What this adds

A scripted-history fixture (tests/history_golden.py):

  • It builds a 5-file repo (python and JS) with 14 commits by 4 authors. Every input is pinned: author and committer names, emails and dates (UTC epochs), branch main, no merges, and an isolated git config (GIT_CONFIG_NOSYSTEM, GIT_CONFIG_GLOBAL, HOME).
  • It scans the repo with history on and --spec-alignment (one [SPEC-1] tag across three functions), then snapshots those 7 fields per file into tests/history_golden_baseline.json.
  • tests/test_history_golden.py diffs the scan against the snapshot. It takes about 2 s, runs in the default suite, and skips without git.
  • To re-bless: python tests/history_golden.py --bless.

One engine hook, opt-in.

  • The chronometer's history window (git log --since=1.year) is measured against today's date, so the same pinned history would drift as the calendar moves. That was the only wall-clock dependency found: nothing reads the user's git identity, the timezone or absolute paths.
  • GITGALAXY_HISTORY_NOW=<epoch> pins "today" (--since=@<now − 365 days>). When it's unset, every scan is unchanged.

Proof that the pin is honoured. One commit is dated more than a year before the pinned "now". The test asserts it's excluded: engine/core.py counts 6 of its 7 commits.

Verification

  • The snapshot is identical across repeated runs and under TZ=America/Los_Angeles.
  • It exercises real values: entropy 0 / 29.39 / 46.69, centralization 50 / 66.7 / 100%, specification exposure 66.67% on the tagged module.
  • audit_check is all clear, and the changed files compile on Python 3.9.

Follow-ups (not here)

  • The history window's time bounds are repo-wide (git log -1 at HEAD / root commit), so a subdirectory scan's stability ratio depends on the whole repo. That's documented in the investigation, not changed.
  • A shallow clone yields a fake root commit, which moves repo_min.

🤖 Generated with Claude Code

…uations

The crucible golden scans with git history ablated (#2985) and without spec
alignment (opt-in, #3111), so Authorship Centralization, Ownership Entropy,
Raw Churn Frequency, Instability / Volatility / Specification Exposure and the
Architect were constant there and nothing regression-tested them.

- tests/history_golden.py builds a small repo with a SCRIPTED history (4
  authors, fixed UTC epoch dates, branch main, no merges, isolated git config),
  scans it with history on and --spec-alignment, and snapshots those 7 fields
  per file into tests/history_golden_baseline.json (re-bless: --bless).
- Engine hook: chronometer's history window ("--since=1.year") was measured
  against today's date, so a pinned history drifted with the calendar.
  GITGALAXY_HISTORY_NOW=<epoch> pins "today" (--since=@<now - 365d>); unset,
  every real scan is byte-identical to before.
- One commit is dated > 1 year before the pinned now; the test asserts it is
  excluded (engine/core.py counts 6 of its 7 commits), proving the pin.

Deterministic: identical across repeated runs and under a different TZ.
About 2 s; runs in the default suite (skips without git).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@squid-protocol squid-protocol added data-integrity Issues relating to RAM state or SQLite database fidelity testing Unit, integration, and E2E pipeline verification labels Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 78624fa into main Oct 2, 2026
41 checks passed
@squid-protocol
squid-protocol deleted the fix/4107-history-golden branch October 2, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data-integrity Issues relating to RAM state or SQLite database fidelity testing Unit, integration, and E2E pipeline verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Golden master never exercises history-dependent risk (churn/ownership/instability/volatility) or spec alignment

1 participant