Skip to content

feat(#125): COSMIC FP approximation in local script, squashed history only - #127

Merged
kenjudy merged 2 commits into
mainfrom
feat/cfp-local-125
Aug 31, 2026
Merged

kenjudy merged 2 commits into
mainfrom
feat/cfp-local-125

Conversation

@kenjudy

@kenjudy kenjudy commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cherry-picks analyzeCfpWithClaude from feat: COSMIC FP approximation in pr-metrics.yml #124 (not yet merged; this PR depends on it)
  • Gates CFP estimation on historyGranularity === 'squashed' and a non-null Anthropic client in local-code-metrics.js; runs on first AI_ANALYSIS_MAX_COMMITS commits, each diff passed as a single file entry
  • Adds cfp_results to local_metrics_summary.json (array of per-commit E/X/R/W data) when the gate opens; field is absent when it does not
  • Adds renderCfpSection(summary) to lib/report-template.js: renders an Estimated Functional Size table when cfp_results is present, wired into renderReportHtml after deployment frequency
  • Label in rendered report: "squashed history only, COSMIC-inspired approximation, informational"

Test plan

  • __tests__/collectLocalMetrics.test.js -- 3 new tests: squashed+client runs CFP, granular skips, null client skips
  • __tests__/report-template.test.js -- 4 new tests: renders total and breakdown, absent on missing/empty cfp_results, label check
  • 819/819 tests pass on this branch

Generated with Claude Code

@github-actions

Copy link
Copy Markdown

PR Analysis

Size: large (based on production code)
Production Code: 103 lines (3 files)
Test Code: 161 lines (3 files)
Total: 264 lines (6 files)
Test-to-Production Ratio: 1.56:1
No size or quality concerns.

Commit Analysis

Total Commits: 3
Average Commit Size: 34 production lines
Average Files per Commit: 2.0

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

Commit Details

d8dbf84 Ken Judy (8/31/2026)
test(#124): RED/GREEN analyzeCfpWithClaude — COSMIC FP estimation from PR diff
59 prod lines, 2 files [test+prod]

9384daa Ken Judy (8/31/2026)
feat(#125): CFP estimation in local-code-metrics.js gated on squashed history
25 prod lines, 2 files [test+prod]

a0e0a7e Ken Judy (8/31/2026)
feat(#125): render CFP section in local drift report
19 prod lines, 2 files [test+prod]

Test Coverage

Test-to-Production Ratio: 1.56: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 100% >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
Sample size (3 commits) is below the 5-commit convention for a rate verdict (code-quality-metrics-w9f): large-commit %, sprawling-commit % and test/prod co-change rate are reported below without a pass/fail judgement.
Automated by Code Metrics Workflow

kenjudy and others added 2 commits August 31, 2026 17:29
… history

Call analyzeCfpWithClaude on the first AI_ANALYSIS_MAX_COMMITS squashed
commits when ANTHROPIC_API_KEY is set. Each commit diff is passed as a single
file entry. cfp_results is present in local_metrics_summary.json only when
historyGranularity is squashed and a client is available; absent otherwise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add renderCfpSection(summary) to lib/report-template.js: renders an
Estimated Functional Size section with per-commit E/X/R/W breakdown when
cfp_results is present in the summary. Returns empty string when absent
or empty. Wired into renderReportHtml after the deployment frequency section.
Labeled as squashed-history only, COSMIC-inspired approximation, informational.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kenjudy
kenjudy force-pushed the feat/cfp-local-125 branch from a0e0a7e to 2e8a014 Compare August 31, 2026 21:30
@kenjudy
kenjudy merged commit 545aad6 into main Aug 31, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

PR Analysis

Size: small (based on production code)
Production Code: 44 lines (2 files)
Test Code: 97 lines (2 files)
Total: 141 lines (4 files)
Test-to-Production Ratio: 2.20:1
No size or quality concerns.

Commit Analysis

Total Commits: 2
Average Commit Size: 22 production lines
Average Files per Commit: 2.0

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

Commit Details

95c8f6d Ken Judy (8/31/2026)
feat(#125): CFP estimation in local-code-metrics.js gated on squashed history
25 prod lines, 2 files [test+prod]

2e8a014 Ken Judy (8/31/2026)
feat(#125): render CFP section in local drift report
19 prod lines, 2 files [test+prod]

Test Coverage

Test-to-Production Ratio: 2.20: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 100% >23% (no critical band established)
Version Control Message quality 100% no band, see spec
AI Risk Signal Net additions ratio (median) 0.94 no band, see spec
Sample size (2 commits) is below the 5-commit convention for a rate verdict (code-quality-metrics-w9f): large-commit %, sprawling-commit % and test/prod co-change rate are reported below without a pass/fail judgement.
Automated by Code Metrics Workflow

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.

1 participant