#5165·gsd-core

1.15.0: progress counts shipped milestones' Progress rows (percent jumps to 100 with phases unstarted), a phase.complete re-run rewinds STATE, ship.md writes prose into status

Author: PHczCreated Oct 1, 2026Updated Oct 1, 2026
Labelsneeds-triage

Summary

Re-tested on @opengsd/gsd-core 1.15.0 (tag v1.15.0) after first measuring these defects on get-shit-done-cc 1.42.3. Several are fixed in 1.15.0 (listed at the end). Four still reproduce. Each verb exits 0 and reports success; the damage only shows in a diff. Items 1 to 3 are concrete instances of what ADR-4629 (Proposed) sets out to prevent: a write that changes things outside its declared scope (§8.3), and a milestone percentage that misleads (§8.5).

  1. Progress counters count a shipped milestone's rows, and the two percent formulas disagree. templates/roadmap.md ("Milestone-Grouped Roadmap (After v1.0 Ships)") keeps one ## Progress table with a Milestone column, shipped rows included. completed_phases counts every Complete row in that table, whatever its milestone. phase.complete then writes percent as Complete rows over all table rows. The next ordinary state write (here state.record-session) recomputes it as min(planFraction, phaseFraction) over the current milestone's phases. In the reproduction, phase.complete 4 lowers percent from 75 to 67 and sets completed_phases: 4 of total_phases: 4. The next record-session then rewrites percent and the body Progress: bar to 100%, while Phases 04.1 and 5 are not started. That breaks §8.5(a) and (b), and it is a §8.3 violation for record-session. On a larger real project (36 Progress rows over three milestones, 27 in the current one), the same sequence went 26 → 22 → 30.
  2. Re-running phase.complete on an already-complete phase rewinds STATE. phase.complete 3, run while Phase 4 is executing, sets status: planning, Plan: Not started, Status: Ready to plan, overwrites Stopped at and Last activity, changes percent, and rewrites current_phase to 04. It also re-pads the already-Complete progress row to Complete . A second consecutive run is already a no-op (only last_updated, state_head and state.json's updated_at move). The rewind happens only once STATE has moved past N, for example when transition.md runs standalone after execute-phase already completed the phase. #1526 guards that path in the workflow prose only.
  3. Every .md write reflows the whole document. Any write that touches ROADMAP.md (here phase.complete) inserts a blank line after every heading, and between a list item and the prose that follows it, in sections the verb never touched. The shape that gets rewritten (#### Phase N: immediately followed by **Goal**:) is the one templates/roadmap.md itself shows. This is the same class as #3854/#4725, which removed the before-list rule for exactly this reason; the after-heading and after-list rules still do it.
  4. ship.md writes prose into Status and drops the activity description. Step track_shipping runs state.update "Last Activity" "<date>", which removes last_activity_desc, and then state.update "Status" "Phase N shipped — PR #M". normalizeStateStatus passes unrecognised prose through verbatim. That is intended (#3873 row 26, #4186, noted in ADR-2207), so after every ship the frontmatter reads status: "Phase 4 shipped — PR #7", outside the status vocabulary, and state validate still reports valid: true. Given the documented normaliser policy, this is a workflow defect, not a normaliser defect.

Environment

macOS 27.0.1 (Darwin 27.0.0), Node 25.5.0, git 2.54. @opengsd/gsd-core 1.15.0 from npm pack, run as node <package>/gsd-core/bin/gsd-tools.cjs query <verb>, which is what the workflows' gsd_run resolves to. 1.15.0 ships no gsd-sdk bin (ADR-0174). HOME pointed at an empty scratch directory; nothing was installed.

Reproduction

A self-contained script. It builds a project in a temporary directory shaped like the template's milestone-grouped roadmap: v1.0 (Phases 1-2) shipped; v1.1 (Phases 3, 4, 04.1, 5) current; Phase 3 complete; Phase 4's only plan has its SUMMARY and a passing VERIFICATION; 04.1 scaffolded. It primes STATE.md once with a write that changes no value, so the diffs leave out gsd-core's own one-time re-derivation. Each run then gets a fresh copy, and the script prints the STATE.md diff (without last_updated, Last session and state_head) and the ROADMAP.md diff with context. C1 is a control, and it passes.

bash
#!/bin/sh
# Minimal, project-independent reproduction of the gsd-core 1.15.0 STATE/ROADMAP write defects.
# Usage: GSD="node <gsd-core package>/gsd-core/bin/gsd-tools.cjs" sh gsd-core-mini-repro.sh
#        (an installed runtime can use GSD=gsd_run)
# Builds a throwaway project shaped like templates/roadmap.md's "Milestone-Grouped Roadmap (After v1.0 Ships)":
# v1.0 (Phases 1-2) shipped, v1.1 (Phases 3, 4, 04.1, 5) current, one Progress table with a Milestone column.
# Phase 3 is complete; Phase 4's only plan has its SUMMARY and a passing VERIFICATION; 04.1 is scaffolded.
set -eu
GSD=${GSD:-gsd_run}
W=$(mktemp -d "${TMPDIR:-/tmp}/gsd-core-repro.XXXXXX")
trap 'rm -rf "$W"' EXIT
B=$W/base
P=$B/.planning/phases
mkdir -p "$P/01-one" "$P/02-two" "$P/03-three" "$P/04-four" "$P/04.1-hotfix"
cat > "$B/.planning/ROADMAP.md" <<'MD'
# Roadmap: Demo

## Milestones

- ✅ **v1.0 MVP** - Phases 1-2 (shipped 2026-09-01)
-  **v1.1 Next** - Phases 3-5 (in progress)

## Phases

<details>
<summary>✅ v1.0 MVP (Phases 1-2) - SHIPPED 2026-09-01</summary>

### Phase 1: One
**Goal**: one
**Plans**: 1 plan

### Phase 2: Two
**Goal**: two
**Plans**: 1 plan

</details>

###  v1.1 Next (In Progress)

**Milestone Goal:** next

- [x] **Phase 3: Three** - three (completed 2026-09-20)
- [ ] **Phase 4: Four** - four
- [ ] **Phase 04.1: Hotfix** - hotfix (INSERTED)
- [ ] **Phase 5: Five** - five

#### Phase 3: Three
**Goal**: three
**Plans**: 1/1 plans complete

#### Phase 4: Four
**Goal**: four
**Success Criteria**:
  1. it works
**Plans**: 1 plan

#### Phase 04.1: Hotfix (INSERTED)
**Goal**: hotfix
**Plans**: TBD

#### Phase 5: Five
**Goal**: five
**Plans**: TBD

## Progress

| Phase | Milestone | Plans Complete | Status | Completed |
|-------|-----------|----------------|--------|-----------|
| 1. One | v1.0 | 1/1 | Complete | 2026-08-20 |
| 2. Two | v1.0 | 1/1 | Complete | 2026-09-01 |
| 3. Three | v1.1 | 1/1 | Complete | 2026-09-20 |
| 4. Four | v1.1 | 0/1 | In progress | - |
| 04.1. Hotfix | v1.1 | 0/0 | Not started | - |
| 5. Five | v1.1 | 0/0 | Not started | - |
MD
cat > "$B/.planning/STATE.md" <<'MD'
---
gsd_state_version: '1.0'
milestone: v1.1
milestone_name: Next
status: executing
progress:
  total_phases: 4
  completed_phases: 1
  total_plans: 2
  completed_plans: 2
  percent: 25
---

# Project State

## Current Position

Phase: 4 of 4 (Four)
Plan: 1 of 1 in current phase
Status: In progress
Last activity: 2026-10-01 — Plan 04-01 complete

Progress: [██░░░░░░░░] 25%

## Performance Metrics

**Velocity:**
- Total plans completed: 1

**By Phase:**

| Phase | Plans | Total | Avg/Plan |
|-------|-------|-------|----------|
| 3 | 1 | - | - |

## Accumulated Context

### Decisions

- [Phase 3]: example

## Session Continuity

Last session: 2026-10-01T00:00:00.000Z
Stopped at: Plan 04-01 complete
Resume file: None
MD
fm() { printf -- '---\nphase: %s\nplan: 01\n---\n# x\n' "$1"; }
for d in 01-one:01 02-two:02 03-three:03 04-four:04; do
  dir=${d%%:*}; n=${d##*:}
  fm "$n" > "$P/$dir/$n-01-PLAN.md"; fm "$n" > "$P/$dir/$n-01-SUMMARY.md"
done
for n in 03-three:03 04-four:04; do
  printf -- '---\nphase: %s\nstatus: passed\n---\n# Verification\n' "${n##*:}" > "$P/${n%%:*}/${n##*:}-VERIFICATION.md"
done
printf '# context\n' > "$P/04.1-hotfix/04.1-CONTEXT.md"
# gc.auto=0 / maintenance.auto=false: git >= 2.47 runs auto-maintenance detached after a commit, which can repack
# .git while the next cp -R copies it.
commit() { git add -A && git -c gc.auto=0 -c maintenance.auto=false -c user.email=r@localhost -c user.name=r commit -qm "$1"; }
(cd "$B" && git init -q && commit base)
# Prime once with a write that changes no value, so STATE.md is in gsd-core's own derived and normalised form.
(cd "$B" && $GSD query state.record-session --stopped-at "Plan 04-01 complete" --resume-file None >/dev/null && commit primed)
show() { # dir: print the uncommitted STATE.md diff (without timestamps and state_head), then ROADMAP.md's with context
  (cd "$1" && git --no-pager diff -U0 -- .planning/STATE.md | grep '^[-+]' \
    | grep -v '^+++ \|^--- \|last_updated\|Last session\|state_head' || echo "    (STATE.md: no change)")
  (cd "$1" && if git diff --quiet -- .planning/ROADMAP.md; then echo "    (ROADMAP.md: no change)"; else
    echo "    --- ROADMAP.md:"; git --no-pager diff -U1 -- .planning/ROADMAP.md | grep -v '^diff \|^index \|^+++ \|^--- '; fi)
}
run() { # label, base, verb...: run on a fresh copy of base, print the diff
  label=$1; base=$2; shift 2
  rm -rf "$W/run"; cp -R "$base" "$W/run"
  (cd "$W/run" && $GSD query "$@" >/dev/null 2>"$W/err" || { echo "=== $label: FAILED"; cat "$W/err"; })
  echo "=== $label: gsd_run query $*"; show "$W/run"
}
step() { # dir, verb...: run in place and commit (builds a sequence)
  d=$1; shift
  (cd "$d" && $GSD query "$@" >/dev/null && commit "$*")
}
run "C1 control: record-session on the primed tree" "$B" state.record-session --stopped-at X --resume-file Y
run "R1a phase.complete 4 (items 1 and 3)" "$B" phase.complete 4
run "R2 phase.complete 3 again, while Phase 4 is executing (items 2 and 3)" "$B" phase.complete 3
S=$W/seq; cp -R "$B" "$S"; step "$S" phase.complete 4
run "R1b the next ordinary write after R1a: record-session (item 1)" "$S" state.record-session --stopped-at X --resume-file Y
run "R4a ship.md track_shipping, first call (item 4)" "$S" state.update "Last Activity" "2026-10-01"
H=$W/ship; cp -R "$S" "$H"; step "$H" state.update "Last Activity" "2026-10-01"
run "R4b ship.md track_shipping, second call (item 4)" "$H" state.update "Status" "Phase 4 shipped — PR #7"
step "$H" state.update "Status" "Phase 4 shipped — PR #7"
echo "=== R4c state validate after R4b"; (cd "$H" && $GSD query state.validate)
echo
echo "=== R4d frontmatter after R4b"; sed -n '/^status:/p;/^last_activity/p' "$H/.planning/STATE.md"

Output with 1.15.0 (GSD="node <package>/gsd-core/bin/gsd-tools.cjs" sh repro.sh; dates are the run date; three runs were identical):

=== C1 control: record-session on the primed tree: gsd_run query state.record-session --stopped-at X --resume-file Y
-stopped_at: Plan 04-01 complete
+stopped_at: X
-Stopped at: Plan 04-01 complete
-Resume file: None
+Stopped at: X
+Resume file: Y
    (ROADMAP.md: no change)
=== R1a phase.complete 4 (items 1 and 3): gsd_run query phase.complete 4
-current_phase: 4
-current_phase_name: Four
-status: executing
-stopped_at: Plan 04-01 complete
+current_phase: "04.1"
+current_phase_name: Hotfix
+status: planning
+stopped_at: Phase 4 complete, ready to plan Phase 04.1
-last_activity_desc: Plan 04-01 complete
+last_activity_desc: Phase 4 complete, transitioned to Phase 04.1
-  completed_phases: 3
+  completed_phases: 4
-  percent: 75
+  percent: 67
-Phase: 4 of 4 (Four)
-Plan: 1 of 1 in current phase
-Status: In progress
-Last activity: 2026-10-01 — Plan 04-01 complete
+Phase: 04.1 of 4 (Hotfix)
+Plan: Not started
+Status: Ready to plan
+Last activity: 2026-10-01 — Phase 4 complete, transitioned to Phase 04.1
-Progress: [████████░░] 75%
+Progress: [███████░░░] 67%
-- Total plans completed: 1
+- Total plans completed: 2
+| 4 | 1 | - | - |
-Stopped at: Plan 04-01 complete
+Stopped at: Phase 4 complete, ready to plan Phase 04.1
    --- ROADMAP.md:
@@ -13,2 +13,3 @@
 ### Phase 1: One
+
 **Goal**: one
@@ -17,2 +18,3 @@
 ### Phase 2: Two
+
 **Goal**: two
@@ -27,3 +29,3 @@
 - [x] **Phase 3: Three** - three (completed 2026-09-20)
-- [ ] **Phase 4: Four** - four
+- [x] **Phase 4: Four** - four (completed 2026-10-01)
 - [ ] **Phase 04.1: Hotfix** - hotfix (INSERTED)
@@ -32,2 +34,3 @@
 #### Phase 3: Three
+
 **Goal**: three
@@ -36,2 +39,3 @@
 #### Phase 4: Four
+
 **Goal**: four
@@ -39,5 +43,7 @@
   1. it works
-**Plans**: 1 plan
+
+**Plans**: 1/1 plans complete
 
 #### Phase 04.1: Hotfix (INSERTED)
+
 **Goal**: hotfix
@@ -46,2 +52,3 @@
 #### Phase 5: Five
+
 **Goal**: five
@@ -56,3 +63,3 @@
 | 3. Three | v1.1 | 1/1 | Complete | 2026-09-20 |
-| 4. Four | v1.1 | 0/1 | In progress | - |
+| 4. Four | v1.1 | 1/1 | Complete    | 2026-10-01 |
 | 04.1. Hotfix | v1.1 | 0/0 | Not started | - |
=== R2 phase.complete 3 again, while Phase 4 is executing (items 2 and 3): gsd_run query phase.complete 3
-current_phase: 4
+current_phase: 04
-status: executing
-stopped_at: Plan 04-01 complete
+status: planning
+stopped_at: Phase 3 complete, ready to plan Phase 04
-last_activity_desc: Plan 04-01 complete
+last_activity_desc: Phase 3 complete, transitioned to Phase 04
-  percent: 75
+  percent: 50
-Phase: 4 of 4 (Four)
-Plan: 1 of 1 in current phase
-Status: In progress
-Last activity: 2026-10-01 — Plan 04-01 complete
+Phase: 04 of 4 (Four)
+Plan: Not started
+Status: Ready to plan
+Last activity: 2026-10-01 — Phase 3 complete, transitioned to Phase 04
-Progress: [████████░░] 75%
+Progress: [█████░░░░░] 50%
-Stopped at: Plan 04-01 complete
+Stopped at: Phase 3 complete, ready to plan Phase 04
    --- ROADMAP.md:
@@ -13,2 +13,3 @@
 ### Phase 1: One
+
 **Goal**: one
@@ -17,2 +18,3 @@
 ### Phase 2: Two
+
 **Goal**: two
@@ -32,2 +34,3 @@
 #### Phase 3: Three
+
 **Goal**: three
@@ -36,2 +39,3 @@
 #### Phase 4: Four
+
 **Goal**: four
@@ -39,2 +43,3 @@
   1. it works
+
 **Plans**: 1 plan
@@ -42,2 +47,3 @@
 #### Phase 04.1: Hotfix (INSERTED)
+
 **Goal**: hotfix
@@ -46,2 +52,3 @@
 #### Phase 5: Five
+
 **Goal**: five
@@ -55,3 +62,3 @@
 | 2. Two | v1.0 | 1/1 | Complete | 2026-09-01 |
-| 3. Three | v1.1 | 1/1 | Complete | 2026-09-20 |
+| 3. Three | v1.1 | 1/1 | Complete    | 2026-09-20 |
 | 4. Four | v1.1 | 0/1 | In progress | - |
=== R1b the next ordinary write after R1a: record-session (item 1): gsd_run query state.record-session --stopped-at X --resume-file Y
-stopped_at: Phase 4 complete, ready to plan Phase 04.1
+stopped_at: X
-  percent: 67
+  percent: 100
-Progress: [███████░░░] 67%
+Progress: [██████████] 100%
-Stopped at: Phase 4 complete, ready to plan Phase 04.1
-Resume file: None
+Stopped at: X
+Resume file: Y
    (ROADMAP.md: no change)
=== R4a ship.md track_shipping, first call (item 4): gsd_run query state.update Last Activity 2026-10-01
-last_activity_desc: Phase 4 complete, transitioned to Phase 04.1
-Last activity: 2026-10-01 — Phase 4 complete, transitioned to Phase 04.1
+Last activity: 2026-10-01
    (ROADMAP.md: no change)
=== R4b ship.md track_shipping, second call (item 4): gsd_run query state.update Status Phase 4 shipped — PR #7
-status: planning
+status: "Phase 4 shipped — PR #7"
-Status: Ready to plan
+Status: Phase 4 shipped — PR #7
    (ROADMAP.md: no change)
=== R4c state validate after R4b
{
  "valid": true,
  "warnings": [],
  "scope": "complete"
}
=== R4d frontmatter after R4b
status: "Phase 4 shipped — PR #7"
last_activity: 2026-10-01

Expected:

  • R1a: completed_phases: 2 (Phases 3 and 4 of v1.1) and one percent value that the next write keeps. With the two v1.0 rows deleted from the Progress table, 1.15.0 does exactly that: completed_phases: 2, percent: 50 before and after phase.complete 4, and R1b leaves both alone.
  • R1a ROADMAP: only the Phase 4 checkbox, Plans line and progress row change.
  • R1b: only the session lines and stopped_at change, as in C1.
  • R2: nothing changes. Phase 3 is already complete and STATE is past it.
  • R4: the activity line keeps a description; frontmatter status stays in the vocabulary.

Root causes (v1.15.0 sources, by symbol)

  1. deriveProgressFromRoadmap (src/phase-lifecycle.cts) counts the rows of the table locateProgressTable finds whose Status is Complete, and takes totalPhases from every data row. It never reads the Milestone column. The text it is given comes from extractCurrentMilestone (src/roadmap-parser.cts). For a milestone-grouped roadmap, that scope still contains the trailing ## Progress table with every milestone's rows, so scoping the ROADMAP does not scope the table. Two consumers then compose different percentages:

    • buildStateFrontmatter (src/state.cts) sets completed_phases = max(disk count, table count) and total_phases from the current milestone. computeProgressPercent (src/state-document.cts) then returns min(planFraction, phaseFraction) over those values.
    • cmdPhaseComplete (src/phase.cts) builds authoritativeProgress with percent = clampPercent(table completed, table rows), a phase-only fraction over all milestones, outside computeProgressPercent, which ADR-4629 §8.5 names as the composition owner.

    The two denominators differ, so the next resyncing write moves percent, and the body bar with it, away from what phase.complete wrote.

  2. cmdPhaseComplete (src/phase.cts) calls transitionCore with kind: 'completePhase' whenever verification passed. completePhaseCore (src/state-transition.cts) rewrites Current Phase, Status, Plan, Last Activity and Stopped At to "Phase N complete, next phase" without checking whether STATE's current phase is already past N. Inside cmdPhaseComplete, mutateMilestonePhase writes ' Complete ' into the Status cell even when the cell already reads Complete.

  3. platformWriteSync → normalizeContent → _normalizeMd (src/shell-command-projection.cts) runs over the entire document on every .md write. Its after-heading rule and its list-then-prose rule insert blank lines wherever the author had none. Because this happens at the I/O seam, every verb that writes ROADMAP.md or STATE.md inherits it, whatever scope it declares.

  4. gsd-core/workflows/ship.md, step track_shipping, makes the two state.update calls quoted in item 4.

Suggested direction

  1. When the Progress table has a Milestone column, count only the current milestone's rows in deriveProgressFromRoadmap (or filter before calling it). Have cmdPhaseComplete take its percent from computeProgressPercent over the same counts buildStateFrontmatter uses, so that one owner composes it (§8.5).
  2. In cmdPhaseComplete, skip the completePhase transition when STATE's current phase already compares greater than N. Leave a Status cell that already reads Complete untouched.
  3. Normalise only the regions a write changed, or retire the after-heading and list-then-prose rules as #4725 did for the before-list rule.
  4. In ship.md's track_shipping, write one activity line with its description and no Status. At ship time the Current Position block already describes the next phase. On 1.15.0, the call below changes only Last activity, last_activity_desc, last_updated and state_head:
diff
 <step name="track_shipping">
-Update STATE.md to reflect the shipping action:
+Update STATE.md to reflect the shipping action. Write the activity line only, with its description; do not write `Status`. At ship time the Current Position block already describes the next phase, and `Status` feeds the frontmatter `status` field, so a free-text value such as "Phase N shipped" does not belong there.

 ```bash
-gsd_run query state.update "Last Activity" "$(date +%Y-%m-%d)"
-gsd_run query state.update "Status" "Phase ${PHASE_NUMBER} shipped — PR #${PR_NUMBER}"
+gsd_run query state.update "Last Activity" "$(date +%Y-%m-%d) -- Phase ${PHASE_NUMBER} shipped as PR #${PR_NUMBER}"
 ```

Already fixed in 1.15.0 (measured, for context)

The original report was written against get-shit-done-cc 1.42.3 (the now-archived gsd-build/get-shit-done repository), driven by the workflows of @opengsd/get-shit-done-redux 1.1.0. Re-run on 1.15.0, these no longer reproduce:

  • append-style verbs (record-session, add-decision, record-metric, add-roadmap-evolution) no