The user wants help operationalizing a "trunk-based delivery scorecard."
The request covers specific areas:
- Branching policy metrics: How do we measure if people are actually doing trunk-based development (TBD)?
- Integration frequency tracking: How often are we merging?
- Deployment health signals: How healthy are the releases/pipelines?
- Developer education loops: How do we teach people to get better at this?
- Retrospective rituals: How do we inspect and adapt the process?
- Stakeholder reporting: How do we show value to management?
Goal: Create a practical, actionable guide/framework to build this scorecard.
Phase 1: Deconstruct the concept of TBD.
- Core principle: Everyone commits to 'main' (trunk).
- Short-lived branches (feature flags).
- Fast CI/CD.
- If you aren't doing these, you aren't doing TBD.
Phase 2: Address each section requested.
-
1. Branching Policy Metrics (The "Compliance" Layer)
- Metric ideas: Branch lifespan (needs to be short), branch count (too many open branches implies stale work), commits per branch (too many implies a long-lived branch), "Revert" frequency (sign of instability), Commit distance (divergence from trunk).
- Operationalization: GitHub/GitLab APIs, scripts to scrape data, visualization tools (like经开aggregators).
-
2. Integration Frequency Tracking (The "Flow" Layer)
- Metric ideas: Deployment frequency (DORA), Merge request (PR/MR) throughput, Time to merge (from creation), Batch size (lines of code/files changed).
- Key concept: The goal is continuous integration. If I commit once a week, that's bad.
-
3. Deployment Health Signals (The "Stability" Layer)
- Metric ideas: Change Failure Rate (DORA), Mean Time to Recovery (MTTR), Build times (CI duration), Test flake rates (unreliable tests block fast merges).
- Feature Flags: Critical for TBD. Need to track flag lifecycle (stale flags).
-
4. Developer Education Loops (The "Culture" Layer)
- How to operationalize: Office hours, Pair programming (enforcing small batches), "Demo" days (showing off the process, not just the product), Internal documentation (Runbooks).
- Metric: Onboarding time, PR review time (social aspect), sentiment surveys (do devs like TBD?).
-
5. Retrospective Rituals (The "Improvement" Layer)
- How to operationalize: Specific "Pipeline Retros," Blameless post-mortems (essential for high deployment freq), The "Red/Green" build culture (fix the build immediately).
-
6. Stakeholder Reporting (The "Value" Layer)
- How to operationalize: Don't show git graphs to executives. Show Lead Time for Changes. Show "Value delivered."
- Visuals: DORA metrics dashboard, Flow efficiency.
Phase 3: Structure the output.
I should structure this as a "Scorecard Blueprint." I'll use a table or bulleted lists for clarity, categorized by the user's requested topics. I need to define:
- The Metric/Signal: What is it?
- The Target: What does "good" look like in TBD?
- The Tool/Method: How do we measure it?
Refining the content:
- Branching: Emphasize "Branch Age." If a branch is > 1 day old, it's a violation.
- Integration: Focus on "Commits to Trunk" vs "Merge Commits."
- Deployment: Link to Feature Flags. You can't do TBD without them (usually). The "health" is about the pipeline stability.
- Education: Needs to be actionable. Not just "read a book," but "do pairing."
- Reporting: Focus on the outcome (speed/stability), not the mechanism (branching strategy).
Self-Correction/Critique during drafting:
- Initial thought: Suggest measuring lines of code. Correction: No, that's a vanity metric. Measure batch size (number of files) or PR size.
- Initial thought: Focus heavily on tools. Correction: Focus on behaviors. The tool just enforces the behavior.
- Tone: Needs to be prescriptive but realistic. Moving to TBD is hard.
Drafting the Response (Mental Outline):
- Introduction: Define the philosophy (Fast flow, small batches).
- Pillar 1: Branching & Policy (The Gatekeepers)
- Metric: Branch Lifespan (< 24h).
- Metric: Code Distance (divergence).
- Pillar 2: Integration Frequency (The Pulse)
- Metric: Commits per day.
- Metric: Batch size.
- Pillar 3: Deployment Health (The Safety Net)
- Metric: Change Failure Rate.
- Metric: Pipeline Duration.
- Pillar 4: Education & Rituals (The Human Element)
- Rituals: Fix it forward, Mob programming.
- Pillar 5: Stakeholder Reporting
- The "Dashboard" view: Summarize what the visual scorecard looks like.
Final Polish: Ensure terms like "DORA Metrics" are mentioned as they are the industry standard for this. Mention Feature Flags as a prerequisite.
Let's write it out. I will create a structured operational guide.
Specific check on "Branching Policy Metrics":
How to enforce? Branch protection rules. Allow specific patterns. Ban long-lived branches.
Metric: "Zombie Branches" (branches never merged).
Specific check on "Education Loops":
How to track? Maybe "time to first commit" for new hires. Or "number of broken builds fixed by non-authors" (shows collective ownership).
Specific check on "Stakeholder Reporting":
Stakeholders care about "When can I have it?" -> Lead Time. They care about "Is it broken?" -> Availability.
Let's assemble.
To operationalize a Trunk-Based Development (TBD) scorecard, you need to move beyond "feeling" like you are agile to proving that small batches and continuous integration are actually happening.
Here is a blueprint for building this scorecard, organized into the six layers you requested.
1. Branching Policy Metrics (The Compliance Layer)
In TBD, the branch is the waste. The goal is to minimize the lifespan and number of branches.
- Branch Lifespan (Age):
- Metric: Average time from branch creation to merge/delete.
- Target: < 1 day (ideally < 4 hours). If branches live for days, you are doing feature branching, not TBD.
- Active Branch Count:
- Metric: Number of open branches per developer.
- Target: Ideally 0 or 1 open short-lived branch per active developer at any given time.
- "Revert" Rate:
- Metric: Percentage of merges that require a revert.
- Insight: In TBD, reverting should be cheap and instant. A healthy scorecard shows a non-zero revert rate (meaning people are trying things) but a rapid recovery time (see section 3).
- Operational Check:
- Gate: Are branch protection rules enforced? (e.g., "Require linear history," "Delete head branch after merge").
2. Integration Frequency Tracking (The Pulse)
This measures how "continuous" your Continuous Integration actually is.
- Commits-to-Trunk Frequency:
- Metric: Number of merges/commits to
main per developer per day.
- Target: The DORA elite metric is "on-demand" (multiple times per day). If a developer merges once a week, the batch size is too large.
- Batch Size (Files per PR):
- Metric: Average number of lines of code (LOC) or files changed per merge.
- Target: Small. < 400 LOC is a good benchmark. Large batches kill TBD velocity.
- Code Distance (Divergence):
- Metric: How far behind the branch is from the trunk at the time of merge.
- Target: 0 or 1 commit behind. This proves they are pulling from trunk frequently.
3. Deployment Health Signals (The Safety Net)
You cannot do TBD without a safety net. Speed without stability is reckless.
- CI Pipeline Latency (The Feedback Loop):
- Metric: Time from commit to "Pass/Fail" signal.
- Target: < 10 minutes. If tests take an hour, developers won't merge frequently.
- Mean Time to Recovery (MTTR):
- Metric: Time between a production failure and the fix (via revert or patch).
- Target: < 1 hour. In TBD, you fix trunk by reverting the offending commit instantly, then fix the bug offline.
- Change Fail Rate:
- Metric: % of deployments causing a production incident.
- Target: < 15%. If this is high, your pre-merge testing is insufficient for the speed you are attempting.
- Feature Flag Hygiene:
- Metric: Count of active feature flags vs. cleaned up flags.
- Insight: TBD relies on flags to decouple deployment from release. An accumulation of old flags is technical debt.
4. Developer Education Loops (The Culture Layer)
How do you teach developers to work in small batches?
- Pair Programming / Mobbing Rate:
- Metric: % of code changed via paired commits (or qualitative surveys).
- Insight: TBD is easiest when code is reviewed instantly by a partner.
- Review Latency (The "Blocking" Metric):
- Metric: Average time for a PR to receive a review.
- Target: < 2 hours. If reviews take 24 hours, developers will bundle changes into massive PRs to avoid context switching.
- Onboarding Velocity:
- Metric: Time for a new hire to commit to trunk on their first day.
- Ritual: "First Day Commit" ceremony.
5. Retrospective Rituals (The Improvement Layer)
You cannot improve what you do not inspect. TBD requires specific rituals.
- The "Broken Main" Retro:
- Trigger: Every time the trunk build breaks for more than 30 minutes.
- Action: A 5-minute standup discussion: "Why did our pre-commit hooks not catch this?"
- Batch Size Review:
- Frequency: Monthly.
- Action: Look at the largest PRs of the month. Ask the team: "What structural issue prevented this from being broken into three smaller PRs?"
- Deployment Post-Mortems:
- Focus: Not just on "who broke it," but "did we revert fast enough?" and "did our feature flags work as intended?"
6. Stakeholder Reporting (The Executive Layer)
Stakeholders care about value, not git graphs. You must translate TBD metrics into business language.
- Lead Time for Changes:
- Definition: Commit to running in production.
- Value: "How fast can we pivot based on market feedback?"
- Release Frequency vs. Deployment Frequency:
- Visual: Show a graph where Deployments (many) >>> Releases (few).
- Value: Demonstrates that we can deploy safely anytime, but we choose to release to customers when business is ready (enabled by flags).
- Flow Efficiency:
- Metric: Active work time vs. Wait time.
- Value: High flow efficiency means money is being spent on coding, not waiting for approvals.
Summary Dashboard View
If you were building a JSON payload or a dashboard for this scorecard, it might look like this:
| Category | Metric | Current Status | Target Status | Score (1-5) |
|---|
| Flow | Avg. Branch Age | 18 hours | < 4 hours | 🔴 2 |
| Flow | Merge Frequency | 2 per dev/day | > 3 per dev/day | 🟢 4 |
| Health | CI Duration | 12 mins | < 10 mins | 🟡 3 |
| Health | MTTR | 45 mins | < 60 mins | 🟢 5 |
| Risk | Feature Flags (Old) | 14 active | < 5 active | 🔴 1 |
| Culture | PR Review Time | 8 hours | < 2 hours | 🟡 3 |
Operationalizing Steps
- Instrumentation: Hook into your VCS (GitHub/GitLab) API to scrape Branch Age and Merge Frequency automatically.
- Visualization: Build a simple "Trunk Health" dashboard on a TV screen.
- Gamification: If Branch Age goes > 24 hours, turn the dashboard red. Celebrate a "Green Week" where trunk never stayed broken.