Skip to content

feat(stats): add surf stats adoption metrics (#13)#34

Merged
Connorrmcd6 merged 1 commit into
mainfrom
feat/surf-stats
Jun 9, 2026
Merged

feat(stats): add surf stats adoption metrics (#13)#34
Connorrmcd6 merged 1 commit into
mainfrom
feat/surf-stats

Conversation

@Connorrmcd6

Copy link
Copy Markdown
Owner

Summary

The proposal's falsifiable success/kill criteria (§9.2) hinge on two metrics, and the rubber-stamp rate is the one that distinguishes a working gate from one being routed around. Nothing computed them. This adds surf stats.

surf stats                                       # all history
surf stats --since 2026-01-01 --format json

Metrics

  • Rubber-stamp rate — of re-stamp events (a commit changed a claim's stored hash: to a new value), the share where the claim's prose was left untouched. A rising rate is a kill signal.
  • In-place update rate — of claim-touch events (a commit changed a file a claim anchors), the share where the claim's hash was updated in the same commit.

Implementation

  • Walks each non-merge commit in the --since/--until window (one commit ≈ one PR), parsing the hub set as it existed at the commit and its parent via git ls-tree + git show, then comparing stored hashes and prose across the pair.
  • New best-effort git helpers in git.rs: log_commits, commit_files, list_files_at (same None-on-failure pattern as the existing ones).
  • JSON emits a versioned {version, since, until, commits, rubber_stamp, in_place} envelope; each rate is {n, d, rate} with rate: null when d == 0.
  • Unlike the advisory git in check, stats is a history report: it errors (non-zero) when git history is unavailable rather than printing a misleading zero.

Heuristics (surfaced, not hidden)

Documented in docs/guides/stats.md: one commit = one PR (merges excluded); claim identity is its at: site(s); the in-place denominator counts any anchored-file edit (including hash-neutral ones), so the reported in-place rate is a floor.

Verification

  • Unit tests build temp git repos exercising a rubber-stamp commit, a genuine prose+hash update, an anchored-file touch with no re-seal, the not-a-repo error path, and the versioned JSON shape; full suite green.
  • Live on this repo: surf stats returns plausible numbers (55% rubber-stamp, 47% in-place over all history).
  • Dogfood: added hubs/cli-stats.md + anchored the new git helpers in hubs/cli-git.md; surf lint/surf check stay green (CLI command-list hub updated for stats).

Closes #13.

🤖 Generated with Claude Code

Closes #13.

The proposal's success/kill criteria (§9.2) hinge on two metrics, and the
rubber-stamp rate is the one that distinguishes a working gate from one being
routed around. Nothing computed them.

- New `surf stats [--since <date>] [--until <date>] [--format human|json]`.
  Walks each non-merge commit in the window (one commit ≈ one PR), parsing the
  hub set as it existed at the commit and its parent via git ls-tree/show.
  - rubber-stamp rate: re-stamp events (a claim's stored hash changed value)
    where the claim's prose was left untouched.
  - in-place update rate: claim-touch events (a commit changed an anchored
    file) where the claim's hash was updated in the same commit.
- JSON emits a versioned `{version, since, until, commits, rubber_stamp,
  in_place}` envelope; `rate` is null when there were no events.
- Stats is a history report, not the advisory git used by `check`: it errors
  (non-zero) when git history is unavailable rather than printing a zero.
- New git helpers: log_commits, commit_files, list_files_at (all best-effort).
- Heuristic boundaries (one commit per PR, at:-site claim identity, in-place
  denominator counts any anchored-file edit) documented in docs/guides/stats.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Connorrmcd6 Connorrmcd6 merged commit 6a427a3 into main Jun 9, 2026
1 check passed
@Connorrmcd6 Connorrmcd6 deleted the feat/surf-stats branch June 9, 2026 06:36
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.

surf stats: adoption + rubber-stamp metrics

1 participant