Skip to content

feat: commit shipment visibility -- report shipped vs. unconfirmed commits (#107) - #123

Merged
kenjudy merged 4 commits into
mainfrom
feat/commit-shipment-visibility-107-v2
Aug 31, 2026
Merged

kenjudy merged 4 commits into
mainfrom
feat/commit-shipment-visibility-107-v2

Conversation

@kenjudy

@kenjudy kenjudy commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds findDefaultBranch and fetchDefaultBranchShas to lib/git.js (5×MAX_COMMITS = 250 depth)
  • Classifies each analyzed commit as shipped (full_sha in default-branch Set) or unconfirmed; adds default_branch, shipped_commits_count, unconfirmed_commits_count to local_metrics_summary.json
  • Renders a shipment visibility line in the masthead detail (renderShipmentLine, lib/report-template.js)
  • Adds merged_branches_count and unmerged_branches_count to code-metrics.yml via github.rest.pulls.list per branch

Squash-merged commits appear unconfirmed (SHA ancestry cannot distinguish them from abandoned branches); the report names this explicitly. pr-metrics.yml is excluded per issue scope: shipment status is irrelevant for a PR not yet merged.

Replaces #122 (rebased onto main after #121 merged).

Test plan

  • npm test passes (806 tests across 49 suites)
  • __tests__/defaultBranch.test.js — 10 tests for findDefaultBranch and fetchDefaultBranchShas
  • __tests__/collectLocalMetrics.test.js — 3 new tests for shipment counts in summary
  • __tests__/report-template.test.js — 3 new tests for renderShipmentLine
  • __tests__/codeMetricsWorkflowShipmentVisibility.test.js — 3 new tests for workflow merged/unmerged counts

🤖 Generated with Claude Code

kenjudy and others added 4 commits August 31, 2026 16:59
…it.js

Cycle 1 of commit shipment visibility: two new functions resolve the
default branch name (symbolic-ref then main/master probe then null) and
fetch a Set of SHAs reachable from that branch up to 5xMAX_COMMITS (250)
for per-commit shipped/unconfirmed classification in Cycle 2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ocal script

Cycle 2 of commit shipment visibility: calls findDefaultBranch and
fetchDefaultBranchShas (5xMAX_COMMITS = 250), then filters metrics by
full_sha membership. Adds default_branch, shipped_commits_count, and
unconfirmed_commits_count to local_metrics_summary.json. Squash-merged
commits appear unconfirmed (SHA ancestry cannot distinguish them from
abandoned branches); the comment names this explicitly.

Also updates all 5 mockExecSequence helpers in collectLocalMetrics.test.js
with out-of-band handlers for symbolic-ref (throw) and rev-parse --verify
(throw) so findDefaultBranch returns null in tests predating this cycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cycle 3: adds renderShipmentLine to lib/report-template.js and wires it
into renderMastheadDetail. Shows shipped vs. unconfirmed counts against
the default branch; notes squash-merged commits appear unconfirmed. Returns
empty string when shipped_commits_count is absent for backward compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cycle 4: for each analyzed feature branch calls github.rest.pulls.list
(state: closed, per_page: 1) and checks merged_at. Adds merged_branches_count
and unmerged_branches_count to both the normal and empty-metrics summary paths.

Also adds pulls.list stub to makeGithubMock in all four existing workflow
test files so they do not break when the new API call runs.

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

Copy link
Copy Markdown

PR Analysis

Size: small (based on production code)
Production Code: 83 lines (4 files)
Test Code: 374 lines (8 files)
Total: 457 lines (12 files)
Test-to-Production Ratio: 4.51:1
No size or quality concerns.

Commit Analysis

Total Commits: 4
Average Commit Size: 21 production lines
Average Files per Commit: 3.0

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

Commit Details

99d6b8e Ken Judy (8/31/2026)
feat(#107): add findDefaultBranch and fetchDefaultBranchShas to lib/git.js
27 prod lines, 2 files [test+prod]

a159ccb Ken Judy (8/31/2026)
feat(#107): classify analyzed commits as shipped vs. unconfirmed in local script
18 prod lines, 2 files [test+prod]

02b4cc6 Ken Judy (8/31/2026)
feat(#107): render shipment visibility line in masthead detail
21 prod lines, 2 files [test+prod]

5046ef7 Ken Judy (8/31/2026)
feat(#107): add merged/unmerged branch counts to code-metrics.yml
17 prod lines, 6 files [sprawling, test+prod]

Test Coverage

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

DORA Capability Assessment

Archetype: mixed-signals
No clear archetype pattern. Review individual metric thresholds.

Capability Metric Value Target
Small Batches Large commit % 0% <18% (no critical band established)
Small Batches Sprawling commit % 25% <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 (4 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.

Duplicate Code

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

  • .github/workflows/code-metrics.yml:124-137 duplicates .github/workflows/code-metrics.yml:172-185 (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 f86b743 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.

1 participant