Skip to content

feat: deployment frequency floor detection (GitHub #65) - #121

Merged
kenjudy merged 8 commits into
mainfrom
feat/deployment-frequency-65
Aug 31, 2026
Merged

kenjudy merged 8 commits into
mainfrom
feat/deployment-frequency-65

Conversation

@kenjudy

@kenjudy kenjudy commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cycle 1: Recognize releaseTagPattern, stagingTagPattern, releaseCommitSubjectPattern as META_KEYS in lib/repoConfig.js (validated string-or-null; not merged into CONFIG)
  • Cycle 2: detectDeploymentFrequency() and findUnmatchedVersionShapedRefs() in lib/metrics.js
  • Cycle 3: fetchReleaseTags() in lib/git.js -- calls execSync directly (not runGitCommand) so error handling stays in the function
  • Cycle 4: findReleaseCommitsFromSubjects() commit-subject fallback in lib/metrics.js
  • Cycle 5: Integration in local-code-metrics.js -- reads patterns from config sources, calls tag/subject detection, adds deployment_frequency_floor to summary JSON
  • Cycle 6: Integration in .github/workflows/code-metrics.yml -- reads .codemetrics.json, uses GitHub API tag listing, same detection logic
  • Cycle 7: Coverage map updated: type:'gap' → type:'partial' for deployment frequency entry
  • Cycle 8: renderDeploymentFrequency() tile in lib/report-template.js -- rendered only when deployment_frequency_floor is present

Both local and workflow scripts kept in sync. Feature is off by default; opt in via .codemetrics.json:

{ "releaseTagPattern": "^v\\d+" }

Test plan

  • 787 tests passing (npm test)
  • All new functions tested in isolation before integration
  • Guard tests: staging tags never counted as production, null pattern never calls execSync
  • Workflow integration tested via extracted inline script harness
  • Report template tested for present/absent cases

Closes #65

🤖 Generated with Claude Code

kenjudy and others added 8 commits August 31, 2026 16:10
…cycle 1)

Add releaseTagPattern, stagingTagPattern, and releaseCommitSubjectPattern to
META_KEYS in lib/repoConfig.js. All three are validated as string-or-null (the
string is used as a RegExp source); they are recorded in sources but never merged
into effective CONFIG, matching lifecycle's own shape. Callers read them back from
sources to opt into deployment frequency detection.

Four new repoConfig tests cover recognition, multi-key coexistence, type rejection,
and coexistence with a class A override. Total tests: 750 → 754.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… lib/metrics.js (GitHub #65, cycle 2)

detectDeploymentFrequency: given sorted [{name,date}] release events and an asOf
timestamp, returns release_count, median_interval_days, mean_interval_days, and
days_since_last (all whole days). Returns null when events is empty. Single-event
histories report count=1 with null intervals (no pair to compute from).

findUnmatchedVersionShapedRefs: given a list of tag/ref names and the configured
release/staging patterns, returns names that look version-shaped (contain vN.N)
but match neither pattern. Returns [] when releaseTagPattern is null (feature off).
A [guard] test asserts staging-prefixed version tags are never returned as unmatched
when stagingTagPattern is configured.

Both functions are in lib/metrics.js so code-metrics.yml can require() them.
Total tests: 754 → 764.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Calls execSync directly so error handling stays inside the function
rather than being swallowed by runGitCommand's own catch block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
, Cycle 4)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… (GitHub #65, Cycle 5)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…65, Cycle 6)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Cycle 7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cle 8)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

PR Analysis

Size: large (based on production code)
Production Code: 260 lines (7 files)
Test Code: 548 lines (9 files)
Total: 808 lines (16 files)
Test-to-Production Ratio: 2.11:1
No size or quality concerns.

Strengths

  • High test/prod co-change rate across commits

Commit Analysis

Total Commits: 8
Average Commit Size: 33 production lines
Average Files per Commit: 2.3

Metric Value
Large commits (>100 prod lines) 0/8 (0%)
Sprawling commits (>5 files) 0/8 (0%)
Test/prod co-change rate 7/8 (88%)
Message quality 8/8 (100%)
Median net additions ratio 0.96
Test-only commits 0
Production-only commits 1

Commit Details

906fe8f Ken Judy (8/31/2026)
feat: recognize release pattern META_KEYS in repoConfig (GitHub #65, cycle 1)
12 prod lines, 2 files [test+prod]

ff07699 Ken Judy (8/31/2026)
feat: detectDeploymentFrequency and findUnmatchedVersionShapedRefs in lib/metrics.js (GitHub #65, cycle 2)
76 prod lines, 2 files [test+prod]

c562658 Ken Judy (8/31/2026)
feat: add fetchReleaseTags to lib/git.js (GitHub #65, Cycle 3)
41 prod lines, 2 files [test+prod]

b8f5e10 Ken Judy (8/31/2026)
feat: findReleaseCommitsFromSubjects commit-subject fallback (GitHub #65, Cycle 4)
10 prod lines, 2 files [test+prod]

accade4 Ken Judy (8/31/2026)
feat: integrate deployment_frequency_floor into local-code-metrics.js (GitHub #65, Cycle 5)
35 prod lines, 2 files [test+prod]

7b12a91 Ken Judy (8/31/2026)
feat: deployment_frequency_floor in code-metrics.yml workflow (GitHub #65, Cycle 6)
53 prod lines, 5 files [test+prod]

f4e4ce8 Ken Judy (8/31/2026)
docs: deployment frequency coverage map: gap -> partial (GitHub #65, Cycle 7)
2 prod lines, 1 files

041ed57 Ken Judy (8/31/2026)
feat: deployment frequency tile in report-template.js (GitHub #65, Cycle 8)
33 prod lines, 2 files [test+prod]

Test Coverage

Test-to-Production Ratio: 2.11:1 (no calibrated target for this ratio; reported descriptively)

DORA Capability Assessment

Archetype: harmonious-high-achiever
Strong batch discipline, test coverage, and message quality. AI tools likely amplifying positive outcomes.

Capability Metric Value Target
Small Batches Large commit % 0% <18% (no critical band established)
Small Batches Sprawling commit % 0% <18% (no critical band established)
Version Control Test/prod co-change rate 88% >23% (no critical band established)
Version Control Message quality 100% no band, see spec
AI Risk Signal Net additions ratio (median) 0.96 no band, see spec

Duplicate Code

Found 1 duplicate block(s) across the changed files:

  • .github/workflows/code-metrics.yml:111-124 duplicates .github/workflows/code-metrics.yml:159-172 (14 lines, 102 tokens)
    Layer 1 (static) ran. Set ANTHROPIC_API_KEY to enable semantic analysis.
    Automated by Code Metrics Workflow

@kenjudy
kenjudy merged commit 875fdbc into main Aug 31, 2026
1 check passed
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.

Derive deployment frequency from git release events (repo-level, opt-in, reported as a floor)

1 participant