* fix(#1882): distinguish unterminated frontmatter from absent frontmatter
extractFrontmatter returned {} both for a document with no frontmatter and for
one whose fence was opened and never closed, so a file truncated mid-write was
byte-identical to a legitimate no-metadata file. Verified live through
`gsd-tools frontmatter get`: both printed {} with exit 0 and nothing on stderr.
Per ADR-1411's "corrupt is not absent" amendment the {} return is preserved
exactly -- no caller may break -- and the cause is surfaced out-of-band as a
deduplicated, unconditional stderr diagnostic. That mechanism lands as a shared
leaf module rather than a per-site copy because three sibling findings in the
same epic need it identically; four hand-rolled copies of one behaviour is the
generative-fix-divergence defect class.
The discriminator is deliberately not "opened but never closed". A Markdown
document whose first line is a thematic break takes that exact branch, so
flagging on the missing fence alone reports corruption on good Markdown -- the
failure mode this class of check has shipped with before. The unterminated
region is instead run through extractFrontmatter's own parser (extracted as
parseYamlRegion so the probe and the real parse can never diverge) and reported
only when it yields at least one key.
Also folds an inline defect found while working: src/config-loader.cts carried
two NUL bytes in the JSDoc added by this epic's Phase 1 (3eb1cede2), making it
the only non-text file under src. file(1) reported it as data and text tools
silently skipped it, defeating the audit rule that says to search the authored
source; tsc passed because the bytes sat inside a comment, so no gate caught it.
It is live on next.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(#1882): pin unterminated-frontmatter detection and its negative space
Covers the discriminator on both sides. The positive rows are the issue's own
repro (LF and CRLF) plus the key-count boundary 0/1/2 around the ">= 1 parsed
key" threshold. The negative rows are the documents that reach the same branch
and must stay silent -- above all a Markdown thematic break at byte 0, which is
how this class of check has previously shipped a false positive on valid
Markdown.
Deduplication is tested on both halves of the composite key: a repeat of the
same (path, cause) is suppressed, a genuine second failure in a different file
is not, and a Windows and POSIX spelling of one path resolve to a single key.
The reset seam is asserted to actually clear -- #2674 is the precedent where a
reset that silently failed to clear made every later dedup assertion a vacuous
pass, and the cases only passed because each happened to pick an unused key, so
every case here uses a path unique to itself.
Assertions are on typed surfaces throughout -- the frozen reason enum and the
dedup-set size -- never on diagnostic prose. The one CLI-level case asserts a
differential between two runs (whether stderr is empty) rather than matching a
message, and is the wired user-reachable surface for this fix. Stream failure is
injected by overriding process.stderr.write and restoring it, never chmod 0o000,
which root bypasses.
Two properties guard the ~50 call sites of the changed function: the new
optional path argument is inert with respect to the parsed value, and LF/CRLF
spellings of a document still parse identically.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(#1882): raise the truncation threshold and repair the dedup key
Isolated adversarial review found the one-key discriminator false-positives on
ordinary Markdown: a thematic break above a single labelled line -- `Note:`,
`Author:`, `TODO:`, `See:` -- parses as exactly one key and was reported as
corruption, which is the precise failure the design claimed to prevent and the
changeset promised was fixed. The threshold is now two keys. A file truncated
after exactly one key becomes a false negative; that is the same
precision-over-recall direction already taken at zero keys, and every GSD
artefact this guards carries two or more frontmatter keys.
Three dedup-key defects, each of which could silently swallow a real diagnostic:
- Backslash normalization is removed. A backslash is a legal filename character
on Linux and macOS, so folding it to a forward slash made two genuinely
different files share one key. Two spellings of one Windows path may now
report twice; two distinct files can never silence each other. Lost signal is
the worse failure.
- The key namespaces are tagged so a file literally named like the unnamed
digest fallback can no longer collide with a path-less caller whose content
hashes to that digest -- computable for any predictable content, no brute
force needed.
- The source identity is computed once rather than hashed twice per emission.
Corrects the previous commit. The two NUL bytes in src/config-loader.cts were
NOT in a JSDoc comment as that message claimed; they were deliberate separators
in the live dedup key, and stripping them degraded it to bare concatenation.
They are restored as escape sequences -- byte-identical runtime string, and the
file is text again so grep can see it. The diagnostic script that misled me
indexed a character-offset string with a byte offset.
Also threads sourcePath through the STATE.md and PLAN.md readers so the two
artefacts epic #1879 is actually about name their file rather than reporting
under a content digest.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(#1882): correct fixtures and assertions left behind by the review fixes
The previous commit changed two behaviours deliberately and the suite still
encoded the old ones, so gsd-test came back red with six failures across both
lanes -- all of them mine.
Fixtures carrying a single frontmatter key no longer clear the two-key
truncation threshold, so the CLI differential and the two path-less dedup cases
were asserting a diagnostic that is now correctly withheld. They now carry two
keys, which is what a real interrupted write of a GSD artefact looks like.
The Windows/POSIX case asserted that two spellings of one path collapse to a
single key -- the exact folding that was removed because it also collapsed
genuinely distinct POSIX files whose names contain a backslash. Inverted to
assert they now report separately, with the reasoning recorded inline so the
trade is not silently reversed later: mild duplicate noise on one Windows path
is acceptable, a swallowed diagnostic is not.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(#1882): name the file at every read site, and report each file once
The diagnostic reached only the four frontmatter CLI verbs, so ~47 of 53 call
sites reported a truncated file under an anonymous content digest instead of
naming it. Since naming the file is the whole point -- it is what an operator
can act on -- that was a gap in the deliverable, not a scoping choice. 43 of 53
sites now pass the resolved path.
Closing it surfaced a defect the original design missed. A single truncated
STATE.md is parsed twice in a normal run: once by the read wrapper, which holds
the path, and again by a pure core downstream, which is handed only the string
and cannot know it. Those two parses keyed separately, so one file produced two
diagnostics -- and wiring more sites made the collision more likely, not less.
Every emission now registers both identities the input could be known by and
checks both before writing, so whichever caller arrives first speaks and the
other is suppressed. Distinct files with distinct content still report
separately, which is the property ADR-1411 actually requires; two files whose
truncated content is byte-identical collapse to one report, which stays the
documented limit.
Ten call sites deliberately keep no path. Two are frontmatter's own round-trip
checks during set and merge, where passing a path would report on every write.
The other eight are the state-transition pure cores, which ADR-1769 defines as
(content, intent, deps) -> newContent with injected I/O; threading a path
through them would contradict that recorded decision, so it is surfaced rather
than taken unilaterally. With the widened key they no longer double-report, and
in the normal flow the named parse runs first, so the file is still named.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(#1882): inject the STATE.md path into the transition cores
The six state-transition cores parsed STATE.md frontmatter without knowing
which file it came from, so a truncated STATE.md reached the operator as an
anonymous content digest on exactly the artefact epic #1879 is named for.
ADR-1769 section 3 shapes these as (content, intent, deps) -> newContent with
injected deps, and deps is the seam for precisely this: something the core
cannot derive without doing I/O. It already carries roadmapProvider and a
phase-inventory provider on that basis, each documented as injected rather than
imported so the core stays pure and testable without disk access. A resolved
path is data, not I/O, so an optional sourcePath member extends the established
pattern rather than contradicting it, and every existing stub keeps compiling
because the member is optional.
updateCore and reconcileCurrentPosition take no deps and are left alone. With
the widened dedup key they cannot double-report, and in the normal flow the read
wrapper has already named the file by the time they run.
Also regenerates gsd-core/bin/lib/state-transition.cjs. That artifact is tracked
rather than gitignored, unlike most of its siblings, so leaving it stale would
have shipped a runtime without this change to anyone reading the repo without
building. tsc had skipped the re-emit because its incremental build info still
recorded an emit that had since been reverted, so the stale output survived a
clean build; clearing tsconfig.build.tsbuildinfo forced it. The
compiled-artifact-sync gate is what surfaced the drift and now reports all nine
tracked artifacts matching their source.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(#1882): stop the widened dedup key from hiding a second file
The previous commit widened the dedup guard so one file parsed twice -- once by
a read wrapper holding the path, once by a pure core holding only the string --
reported once instead of twice. It did that by checking BOTH keys before
emitting, which silently traded one defect for a worse one: two DIFFERENT files
whose truncated content happened to be byte-identical now collided on the shared
content digest, and the second file's diagnostic was swallowed. That is the
over-coarse keying ADR-1411 explicitly forbids, reintroduced while fixing
something else.
The guard now checks only the key matching what the caller actually knows -- a
named read checks its path key, a path-less read checks its digest key -- while
still recording every key the input could later be identified by. The redundant
path-less re-parse of an already-named file stays silent, and two distinct files
always both report.
Verified across all six orderings: same file named-then-anonymous reports once;
two different files with identical content report twice; two different files
with different content report twice; the same path twice reports once; two
path-less parses of identical content report once; two path-less parses of
different content report twice.
The suite caught this -- twenty failures, all in the unusable-input tests that
reuse one truncated fixture across different paths. The local probe written
alongside the broken change did not, because it compared two files with
different content and could therefore only confirm the expected behaviour.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(#1882): count diagnostics emitted, not identities interned
The suite measured the size of the dedup set as a stand-in for "how many
diagnostics were emitted". That held only while one emission recorded exactly
one key. Once an emission began recording every identity the input could later
be matched by -- a path key and a content key for the same file -- the set grew
by two per write and twenty assertions read 2 where they expected 1.
The production behaviour was correct throughout; the proxy was not. Set size
counts identities, which is an implementation detail of the guard. The
behavioural claim these tests exist to make is how many diagnostics an operator
actually saw, so the module now exposes that directly as an emission counter and
the suite asserts on it. The set-size accessor stays for assertions genuinely
about key shape.
The local probe written alongside the change did not catch this because it
counted process.stderr.write calls -- the right thing -- while the suite counted
set growth. Verification now asserts both and requires them to agree, so a
future divergence between the counter and real writes fails immediately rather
than being discovered a bench run later.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(#1882): retire two assertions that outlived the behaviour they described
Both tests encoded assumptions the dedup fix invalidated, and both were caught
by the suite rather than by the probe written alongside the change.
The forged-path case asserted that a file named like the anonymous digest
fallback must not suppress a later path-less report. That premise is gone: an
emission now records every identity its input could be matched by, so ANY named
report of some content silences the anonymous re-parse of that same content --
which is the same-file guard working as intended, and has nothing to do with the
crafted name. The property still worth defending is that a crafted filename can
never silence a real file reported under its own path, so that is what the test
now asserts, with the deliberate suppression documented beside it.
The reset-seam case ended by reading the size of the dedup set and expecting 1.
Set size counts interned identities, not diagnostics written, and one emission
now interns two. It asserts the emission counter for the event and keeps a
weaker set-size check for the interning.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(#1882): close the review findings on the discriminator, dry-run and counter
Three orthogonal review passes ran against the final diff. Their findings:
A labelled preamble under a leading rule was still misreported. Raising the key
threshold to two only moved the boundary, because two colon-labelled lines are
as common in ordinary prose as one -- a document opening with a rule over an
Author and a Reviewed-by line, then prose, was called corrupt. Key count alone
cannot separate the two. What does is what follows: a write interrupted part way
through a frontmatter block ends mid-block, so every line of the region is still
frontmatter-shaped, whereas a document merely opening with a rule goes on to
prose. Both conditions are now required, and each closes a false-positive class
the other leaves open. Nested list values and indented continuations stay
frontmatter-shaped, so legitimate truncations are unaffected.
`state rebuild --dry-run` reported a truncated STATE.md anonymously. The write
path is named only because readModifyWriteStateMd parses with the path first;
the dry-run branch reads the file directly and never did. Dry-run is the
read-only mode an operator reaches for first when they suspect corruption, so it
is the one that most needed to name the file. reconcileCurrentPosition takes the
path as an optional argument now and rebuildCore passes it down. That function
was previously left alone on the grounds that a read wrapper always names the
file first -- this is the flow that disproves it.
The emission counter counted write attempts rather than writes, so on a broken
stderr it claimed a diagnostic had reached the operator when nothing had. It is
incremented only after a write that completed, and the broken-stderr test now
asserts the count as well as the return value.
Two documentation defects. The module described a guarantee it does not keep:
one file yields one diagnostic only when the named read comes first. The reverse
ordering emits twice, and that is deliberate -- a path-less caller cannot
identify its file, so suppressing the later named report would also suppress a
genuine second failure in a different file whenever two files share identical
truncated bytes, which ADR-1411 ranks the worse failure. The comment now states
the asymmetric guarantee and a test pins it. Separately, the CONTEXT.md glossary
entry still described backslash normalization that a later commit removed, and
asserted the opposite of what the tests pin; no lint checks prose against code,
so nothing caught it.
Also converts three body-level try/finally blocks to t.after(), per
CONTRIBUTING.md's rule that try/finally belongs only in helpers with no test
context -- the file's own emissionsDuring helper already did this correctly.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(#1882): tell the operator what the truncated-frontmatter warning means
A user who has just seen the new warning is acting, not studying, so this lands
in the How-To quadrant beside the other "if you see X" branches in
debug-a-failed-execution, not in reference or explanation. It gives them what
the warning means for this run, three steps to restore the file, and the fact
that the warning changes no return value or exit code.
It also states the case that matters more than the warning itself: silence does
not prove the file is intact. GSD says nothing when the partial block carries
fewer than two fields or reads as prose, because a Markdown document opening
with a horizontal rule is indistinguishable from one of those. A reader chasing
missing metadata needs to know not to treat quiet as clean. Why that threshold
exists is explanation and deliberately stays out of a how-to.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore(#1882): backfill changeset pr number to 2712
* test(#1882): constrain each branch of the frontmatter-shape check
CI's mutation gate came in at 61.56 against a threshold of 62, and the surviving
mutants were concentrated in isFrontmatterShaped -- the function added last, in
response to review, and the only one never given tests of its own. It was
exercised solely through extractFrontmatter, which covers the composite decision
but leaves each branch of the predicate unconstrained: drop the blank-line
filter, or any one of the three shape alternatives, and every existing assertion
still passed.
Four cases now pin the halves independently. A blank line inside an interrupted
block must not disqualify it, which constrains the filter and its comparison. An
unindented list item and an indented folded-scalar continuation each exercise one
shape alternative that no other case reaches on its own -- the folded line is
neither a key nor a list item, so it is the only input that distinguishes the
indented branch. And two keys followed by prose must stay silent, which is the
negative half: it fails if the predicate is ever mutated to accept everything,
and it is the case that proves key count alone was never sufficient.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(#1882): register the unusable-input suite with the frontmatter mutation shard
The mutation gate reported an identical 61.56 across two runs whose only
difference was four added tests. That is the tell: the tests were never
executed. The frontmatter shard runs a fixed file list in stryker.config.mjs and
scripts/mutation-matrix.cjs, and tests/unusable-input.test.cjs was in neither, so
the entire suite covering the new unterminated-fence branch was invisible to the
gate while passing perfectly well in the normal run.
So the score was not measuring weak tests, it was measuring absent ones: #1882
added mutants to frontmatter.cjs and no test in the shard covered them. Both
lists gain the file; the config already notes they must stay in sync.
This is a registration ripple a new test file carries when it covers a
mutation-tracked module, alongside the .gitignore, eslint, inventory, glossary
and size-baseline ripples a new module carries. Nothing warned about it, which
is why two runs were spent before the identical score gave it away.
Refs #1879
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
5
.changeset/plucky-jays-rally.md
Normal file
5
.changeset/plucky-jays-rally.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
type: Fixed
|
||||||
|
pr: 2712
|
||||||
|
---
|
||||||
|
**A truncated or half-written frontmatter file is no longer silently read as "no metadata"** — a document whose `---` fence was opened and never closed used to return exactly the same empty result as a file that legitimately has no frontmatter, so a crash mid-write left every phase/state reader proceeding with empty contracts and no signal. GSD now names the offending file on stderr while returning the same value as before, so nothing that consumed the old result changes. A Markdown horizontal rule at the top of a document — including one above a labelled line such as `Note:` or `Author:` — is not mistaken for a truncated fence. (#1882)
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -177,6 +177,7 @@ build/
|
|||||||
/gsd-core/bin/lib/phase-id.cjs
|
/gsd-core/bin/lib/phase-id.cjs
|
||||||
/gsd-core/bin/lib/normalize-test-command.cjs
|
/gsd-core/bin/lib/normalize-test-command.cjs
|
||||||
/gsd-core/bin/lib/config-loader.cjs
|
/gsd-core/bin/lib/config-loader.cjs
|
||||||
|
/gsd-core/bin/lib/unusable-input.cjs
|
||||||
/gsd-core/bin/lib/model-resolver.cjs
|
/gsd-core/bin/lib/model-resolver.cjs
|
||||||
/gsd-core/bin/lib/loop-resolver.cjs
|
/gsd-core/bin/lib/loop-resolver.cjs
|
||||||
/gsd-core/bin/lib/capability-state.cjs
|
/gsd-core/bin/lib/capability-state.cjs
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ Cross-seam principle (ADR-1411, epic #1411): context resolution — config loadi
|
|||||||
### Resolution Convention
|
### Resolution Convention
|
||||||
Diagnostic-output convention for the Resolution Provenance principle (ADR-1411 P3, #1416). Config-interpreting read verbs expose `Resolution<T> { value, configured, reason, warnings }` (`src/resolution.cts`); agent-skills is the first adopter, where `value = { block, skills_count }` and `source`/`degraded` remain config-provenance extras outside the envelope. Other read verbs expose at least `warnings[]` (e.g. capability-state `{ runtimeConfigDir, capabilities, warnings? }`) without `configured`/`reason`, which are meaningful only for config-interpreting verbs. Mutation verbs expose `warnings[]` (advisory) PLUS `errors[]` (operation-not-applied), e.g. capability-writer `{ capabilities, warnings, errors }`. The shared seam across all shapes is `warnings: string[]`; a single generic `Resolution<T>` across read+write verbs was rejected by the deletion test (`configured`/`reason` are meaningless for capability verbs; `errors[]` cannot fold into `warnings[]`) — ADR-1411 P3 amendment. Recurrence prevention is delivered by P4's CI guard (a configured input resolving empty must carry a `reason`), not by a shared envelope. A CI guard (`scripts/lint-resolution-provenance.cjs`, wired into `lint:ci`) enforces that every registered config-interpreting read verb keeps a `configured_empty`/`not_configured` contract test; the registry in that script is the registration point for future verbs (ADR-1411 P4 / #1417).
|
Diagnostic-output convention for the Resolution Provenance principle (ADR-1411 P3, #1416). Config-interpreting read verbs expose `Resolution<T> { value, configured, reason, warnings }` (`src/resolution.cts`); agent-skills is the first adopter, where `value = { block, skills_count }` and `source`/`degraded` remain config-provenance extras outside the envelope. Other read verbs expose at least `warnings[]` (e.g. capability-state `{ runtimeConfigDir, capabilities, warnings? }`) without `configured`/`reason`, which are meaningful only for config-interpreting verbs. Mutation verbs expose `warnings[]` (advisory) PLUS `errors[]` (operation-not-applied), e.g. capability-writer `{ capabilities, warnings, errors }`. The shared seam across all shapes is `warnings: string[]`; a single generic `Resolution<T>` across read+write verbs was rejected by the deletion test (`configured`/`reason` are meaningless for capability verbs; `errors[]` cannot fold into `warnings[]`) — ADR-1411 P3 amendment. Recurrence prevention is delivered by P4's CI guard (a configured input resolving empty must carry a `reason`), not by a shared envelope. A CI guard (`scripts/lint-resolution-provenance.cjs`, wired into `lint:ci`) enforces that every registered config-interpreting read verb keeps a `configured_empty`/`not_configured` contract test; the registry in that script is the registration point for future verbs (ADR-1411 P4 / #1417).
|
||||||
|
|
||||||
|
### Unusable Input Diagnostic Module
|
||||||
|
Leaf module owning the **out-of-band** half of ADR-1411's "corrupt is not absent" amendment (epic #1879). Where a read already returns a provenance envelope the cause is named in-band (`ConfigResolution.reason`, #1880); where a read returns a bare sentinel or a plausible default it cannot extend, the return value is preserved exactly and the cause is surfaced here instead. Interface: `UNUSABLE_REASON` (frozen reason enum — one entry per condition that has an emitting call site; adding a reason is three coordinated changes: enum + call site + the test locking `Object.keys(...).sort()`), `warnUnusableInput({reason, source?, content?}) → boolean` (returns whether this call actually wrote, so tests assert emission *counts* on a typed surface rather than scraping stderr), plus the `_resetUnusableInputWarningsForTests` / `_unusableInputWarningCountForTests` seams. Dedup key is `<normalized source>\0<reason>` — **both halves are load-bearing**: keying on the path alone would let a second, different fault on the same file go unreported, and keying on message prose would couple the guard to wording (ADR-1411 dedup clause). Path separators are deliberately **not** normalized: an earlier revision folded backslashes to `/` so two spellings of one Windows path would not double-report, but a backslash is a legal filename character on Linux and macOS, so that folding collapsed two genuinely distinct POSIX files onto one key and swallowed the second file's diagnostic. The trade is now one-directional — two spellings of one Windows path may report twice (noise), but two distinct files can never silence each other (lost signal), and ADR-1411 ranks the swallow the worse failure; ASCII control characters are stripped from the source before it is keyed or written, because the key separator is NUL (a crafted path could otherwise forge a collision) and because a path carrying ANSI escapes would replay into the operator's terminal. Callers with no path (in-memory content) fall back to a short content digest so *different* bad inputs still key differently. The diagnostic is **unconditional** — a deliberate divergence from ADR-227's never-implemented `GSD_DEBUG` opt-in, since "an opt-in nobody sets is indistinguishable from the silence #1879 is about" — and **never throws**: a failed stderr write is swallowed so a degraded read is never escalated into a crash. First adopter is `extractFrontmatter` (#1882); `roadmap-parser` (#1881) and `planning-workspace`/`verify` (#1883) follow. Exists as a shared seam rather than a per-site copy because four sites need identical behavior and four hand-rolled copies is `DEFECT.GENERATIVE-FIX` by construction. Source of truth: `gsd-core/bin/lib/unusable-input.cjs` (generated from `src/unusable-input.cts`). Test anchor: `tests/unusable-input.test.cjs`. See Resolution Provenance, Config Loader Module.
|
||||||
|
|
||||||
### Worktree Safety Policy Module
|
### Worktree Safety Policy Module
|
||||||
CJS Module owning worktree lifecycle safety policy for the GSD orchestration layer. Interface: `resolveWorktreeContext(cwd, deps) → WorktreeContext` (linked-worktree root mapping), `parseWorktreePorcelain(output) → WorktreeEntry[]` (porcelain parser, skips detached HEAD), `planWorktreePrune(repoRoot, opts, deps) → PrunePlan` (metadata-prune plan, never destructive by default), `executeWorktreePrunePlan(plan, deps) → PruneResult` (executes prune; degrades gracefully on git timeout), `listLinkedWorktreePaths(repoRoot, deps) → LinkedPathsResult`, `inspectWorktreeHealth(repoRoot, opts, deps) → HealthResult` (orphan + stale detection), `snapshotWorktreeInventory(repoRoot, opts, deps) → InventoryResult`, `planWorktreeWaveCleanup(repoRoot, manifest) → CleanupPlan` (manifest-scoped, fail-closed), `executeWorktreeWaveCleanupPlan(plan, deps) → CleanupResult`, `planWorktreeRecordAgent(manifestRaw, fields) → RecordAgentPlan` (write-strict per-agent manifest append; validates each field at write time via the same `normalizeCleanupManifestEntry` rules the reader enforces; fail-closed on a missing/garbled field or a duplicate `(worktree_path, branch)` the reader would dedup away), `cmdWorktreeRecordAgent(cwd, args, deps) → RecordAgentCmdResult` (thin deps-injectable IO wrapper for the `worktree record-agent` verb), `planWorktreeCreate(fields) → WorktreeCreatePlan` (write-strict `worktree create` planner — same missing-field-hint and `normalizeCleanupManifestEntry` validation as `planWorktreeRecordAgent`, pure/no-git), `executeWorktreeCreatePlan(plan, repoRoot, deps) → WorktreeCreateResult` (bounded `git rev-parse --verify` base check THEN `git worktree add -b <branch> <path> <base>`; fail-closed `base_unresolved`/`git_timeout`/`worktree_add_failed`; returns `cwd` — the working directory an executor spawn would use), `cmdWorktreeCreate(cwd, args, deps) → WorktreeCreateCmdResult` (CLI verb: plans, creates the worktree, then appends the manifest entry so it is immediately manageable by cleanup-wave/reap-orphans; dedupes by `(worktree_path, branch)`). #2584 ADR-1239 Codex-binding amendment, Phase 2: `worktree create` is the git-worktree-creation primitive for `dispatch.isolation: orchestrator-worktree` hosts — declared and testable but UNCONSUMED (no scheduler calls it yet; Phase 3 wires it). Source of truth: `gsd-core/bin/lib/worktree-safety.cjs`. Timeout path: all git subprocess calls are bounded; callers receive `ok:false, reason:'git_timed_out'` rather than a thrown exception. Test anchor: `tests/worktree-safety.test.cjs`. The `core.cjs` re-export spine was retired in epic #1267: this module absorbed the two thin compositional wrappers that squatted in Core — `resolveWorktreeRoot(cwd, deps)` (a projection over `resolveWorktreeContext`) and `pruneOrphanedWorktrees(...)` (sequences `planWorktreePrune` + `executeWorktreePrunePlan` with a timeout warning) — so callers reach this single worktree-lifecycle seam directly. `gitWorktreeInfoInternal` did NOT move here — worktree-info detection belongs to the Git Query Module.
|
CJS Module owning worktree lifecycle safety policy for the GSD orchestration layer. Interface: `resolveWorktreeContext(cwd, deps) → WorktreeContext` (linked-worktree root mapping), `parseWorktreePorcelain(output) → WorktreeEntry[]` (porcelain parser, skips detached HEAD), `planWorktreePrune(repoRoot, opts, deps) → PrunePlan` (metadata-prune plan, never destructive by default), `executeWorktreePrunePlan(plan, deps) → PruneResult` (executes prune; degrades gracefully on git timeout), `listLinkedWorktreePaths(repoRoot, deps) → LinkedPathsResult`, `inspectWorktreeHealth(repoRoot, opts, deps) → HealthResult` (orphan + stale detection), `snapshotWorktreeInventory(repoRoot, opts, deps) → InventoryResult`, `planWorktreeWaveCleanup(repoRoot, manifest) → CleanupPlan` (manifest-scoped, fail-closed), `executeWorktreeWaveCleanupPlan(plan, deps) → CleanupResult`, `planWorktreeRecordAgent(manifestRaw, fields) → RecordAgentPlan` (write-strict per-agent manifest append; validates each field at write time via the same `normalizeCleanupManifestEntry` rules the reader enforces; fail-closed on a missing/garbled field or a duplicate `(worktree_path, branch)` the reader would dedup away), `cmdWorktreeRecordAgent(cwd, args, deps) → RecordAgentCmdResult` (thin deps-injectable IO wrapper for the `worktree record-agent` verb), `planWorktreeCreate(fields) → WorktreeCreatePlan` (write-strict `worktree create` planner — same missing-field-hint and `normalizeCleanupManifestEntry` validation as `planWorktreeRecordAgent`, pure/no-git), `executeWorktreeCreatePlan(plan, repoRoot, deps) → WorktreeCreateResult` (bounded `git rev-parse --verify` base check THEN `git worktree add -b <branch> <path> <base>`; fail-closed `base_unresolved`/`git_timeout`/`worktree_add_failed`; returns `cwd` — the working directory an executor spawn would use), `cmdWorktreeCreate(cwd, args, deps) → WorktreeCreateCmdResult` (CLI verb: plans, creates the worktree, then appends the manifest entry so it is immediately manageable by cleanup-wave/reap-orphans; dedupes by `(worktree_path, branch)`). #2584 ADR-1239 Codex-binding amendment, Phase 2: `worktree create` is the git-worktree-creation primitive for `dispatch.isolation: orchestrator-worktree` hosts — declared and testable but UNCONSUMED (no scheduler calls it yet; Phase 3 wires it). Source of truth: `gsd-core/bin/lib/worktree-safety.cjs`. Timeout path: all git subprocess calls are bounded; callers receive `ok:false, reason:'git_timed_out'` rather than a thrown exception. Test anchor: `tests/worktree-safety.test.cjs`. The `core.cjs` re-export spine was retired in epic #1267: this module absorbed the two thin compositional wrappers that squatted in Core — `resolveWorktreeRoot(cwd, deps)` (a projection over `resolveWorktreeContext`) and `pruneOrphanedWorktrees(...)` (sequences `planWorktreePrune` + `executeWorktreePrunePlan` with a timeout warning) — so callers reach this single worktree-lifecycle seam directly. `gitWorktreeInfoInternal` did NOT move here — worktree-info detection belongs to the Git Query Module.
|
||||||
|
|
||||||
|
|||||||
@@ -453,6 +453,7 @@
|
|||||||
"uat.cjs",
|
"uat.cjs",
|
||||||
"ui-consideration-probe.cjs",
|
"ui-consideration-probe.cjs",
|
||||||
"ui-safety-gate.cjs",
|
"ui-safety-gate.cjs",
|
||||||
|
"unusable-input.cjs",
|
||||||
"update-context.cjs",
|
"update-context.cjs",
|
||||||
"validate-command-router.cjs",
|
"validate-command-router.cjs",
|
||||||
"validate.cjs",
|
"validate.cjs",
|
||||||
|
|||||||
@@ -40,6 +40,32 @@ GSD detects this at the next run and surfaces a safe-resume gate with three opti
|
|||||||
- **Re-execute from scratch** — revert or supersede the partial commits before dispatching a new executor.
|
- **Re-execute from scratch** — revert or supersede the partial commits before dispatching a new executor.
|
||||||
- **Mark-and-skip** — record the anomaly and continue, only with your explicit confirmation.
|
- **Mark-and-skip** — record the anomaly and continue, only with your explicit confirmation.
|
||||||
|
|
||||||
|
### If you see a "frontmatter opens with `---` but never closes" warning
|
||||||
|
|
||||||
|
```
|
||||||
|
gsd: warning — /path/.planning/STATE.md: frontmatter opens with "---" but never closes; metadata was NOT applied. (#1879)
|
||||||
|
```
|
||||||
|
|
||||||
|
The named file was written only partly — typically a crash, a full disk, or a killed process
|
||||||
|
between the opening fence and the closing one. GSD read it as having **no** metadata and carried
|
||||||
|
on, so any phase, plan, or state value that file was supposed to supply is missing from this run.
|
||||||
|
|
||||||
|
1. Open the named file and check whether its frontmatter block is closed by a `---` line of its
|
||||||
|
own.
|
||||||
|
2. If it is truncated, restore it — `git checkout -- <file>` if the file is tracked and the good
|
||||||
|
version is committed, or re-add the missing fields and the closing `---` by hand.
|
||||||
|
3. Re-run the command that produced the warning. The warning is reported once per file per run,
|
||||||
|
so a silent re-run means the file now reads cleanly.
|
||||||
|
|
||||||
|
The warning cannot be turned off, and it never changes what a command returns or its exit code —
|
||||||
|
it only tells you a file could not be used.
|
||||||
|
|
||||||
|
**A file can still be truncated without this warning.** GSD stays silent when the partial block
|
||||||
|
carries fewer than two fields, or when the text after the opening `---` reads as prose rather than
|
||||||
|
frontmatter, because a Markdown document that opens with a horizontal rule is indistinguishable
|
||||||
|
from one of those. If a run behaves as though metadata is missing and you see no warning, inspect
|
||||||
|
the file anyway.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Diagnose the root cause
|
## Diagnose the root cause
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export default tseslint.config(
|
|||||||
'gsd-core/bin/lib/capability-consent.cjs',
|
'gsd-core/bin/lib/capability-consent.cjs',
|
||||||
'gsd-core/bin/lib/capability-lock.cjs',
|
'gsd-core/bin/lib/capability-lock.cjs',
|
||||||
'gsd-core/bin/lib/resolution.cjs',
|
'gsd-core/bin/lib/resolution.cjs',
|
||||||
|
'gsd-core/bin/lib/unusable-input.cjs',
|
||||||
'gsd-core/bin/lib/plan-drift-guard.cjs',
|
'gsd-core/bin/lib/plan-drift-guard.cjs',
|
||||||
'gsd-core/bin/lib/cli-exit.cjs',
|
'gsd-core/bin/lib/cli-exit.cjs',
|
||||||
'gsd-core/bin/lib/external-job.cjs',
|
'gsd-core/bin/lib/external-job.cjs',
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ function beginPhaseCore(content, intent, deps) {
|
|||||||
// #1255: body-field replacements operate on body only (frontmatter stripped),
|
// #1255: body-field replacements operate on body only (frontmatter stripped),
|
||||||
// not on the full content. The YAML `status:` key matches `^Status:\s*`
|
// not on the full content. The YAML `status:` key matches `^Status:\s*`
|
||||||
// before the body pipe-table row if full content is passed.
|
// before the body pipe-table row if full content is passed.
|
||||||
const existingFm = extractFrontmatter(content);
|
const existingFm = extractFrontmatter(content, deps.sourcePath);
|
||||||
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
||||||
let body = stripFrontmatter(content);
|
let body = stripFrontmatter(content);
|
||||||
const reassemble = (b) => hasFrontmatter
|
const reassemble = (b) => hasFrontmatter
|
||||||
@@ -523,7 +523,7 @@ function advancePlanCore(content, deps) {
|
|||||||
// not on the full content. The YAML `status:` key matches `^Status:\s*`
|
// not on the full content. The YAML `status:` key matches `^Status:\s*`
|
||||||
// before the body field if full content is passed (codex Phase 2 review:
|
// before the body field if full content is passed (codex Phase 2 review:
|
||||||
// HIGH blocking finding — same pattern beginPhaseCore already handles).
|
// HIGH blocking finding — same pattern beginPhaseCore already handles).
|
||||||
const existingFm = extractFrontmatter(content);
|
const existingFm = extractFrontmatter(content, deps.sourcePath);
|
||||||
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
||||||
let body = stripFrontmatter(content);
|
let body = stripFrontmatter(content);
|
||||||
const reassemble = (b) => hasFrontmatter
|
const reassemble = (b) => hasFrontmatter
|
||||||
@@ -645,7 +645,7 @@ function completePhaseCore(content, intent, deps) {
|
|||||||
}
|
}
|
||||||
// #1255: body-field replacements operate on body only (frontmatter stripped),
|
// #1255: body-field replacements operate on body only (frontmatter stripped),
|
||||||
// so the YAML `status:` / `current_phase:` keys cannot shadow the body fields.
|
// so the YAML `status:` / `current_phase:` keys cannot shadow the body fields.
|
||||||
const existingFm = extractFrontmatter(content);
|
const existingFm = extractFrontmatter(content, deps.sourcePath);
|
||||||
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
||||||
let body = stripFrontmatter(content);
|
let body = stripFrontmatter(content);
|
||||||
const reassemble = (b) => hasFrontmatter
|
const reassemble = (b) => hasFrontmatter
|
||||||
@@ -789,7 +789,7 @@ function plannedPhaseCore(content, intent, deps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #1255: body-field replacements operate on body only.
|
// #1255: body-field replacements operate on body only.
|
||||||
const existingFm = extractFrontmatter(content);
|
const existingFm = extractFrontmatter(content, deps.sourcePath);
|
||||||
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
||||||
let body = stripFrontmatter(content);
|
let body = stripFrontmatter(content);
|
||||||
const reassemble = (b) => hasFrontmatter
|
const reassemble = (b) => hasFrontmatter
|
||||||
@@ -880,7 +880,7 @@ function milestoneSwitchCore(content, intent, deps) {
|
|||||||
'progress',
|
'progress',
|
||||||
'Current Position',
|
'Current Position',
|
||||||
];
|
];
|
||||||
const existingFm = extractFrontmatter(content);
|
const existingFm = extractFrontmatter(content, deps.sourcePath);
|
||||||
const body = stripFrontmatter(content);
|
const body = stripFrontmatter(content);
|
||||||
const resolvedName = (intent.name && intent.name.trim()) || 'milestone';
|
const resolvedName = (intent.name && intent.name.trim()) || 'milestone';
|
||||||
// ## Current Position reset body (mirrors state.cts:2371-2375).
|
// ## Current Position reset body (mirrors state.cts:2371-2375).
|
||||||
@@ -1025,7 +1025,7 @@ function milestoneCompleteCore(content, intent, deps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #1255: body-field replacements operate on body only.
|
// #1255: body-field replacements operate on body only.
|
||||||
const existingFm = extractFrontmatter(content);
|
const existingFm = extractFrontmatter(content, deps.sourcePath);
|
||||||
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
const hasFrontmatter = Object.keys(existingFm).length > 0;
|
||||||
let body = stripFrontmatter(content);
|
let body = stripFrontmatter(content);
|
||||||
const reassemble = (b) => hasFrontmatter
|
const reassemble = (b) => hasFrontmatter
|
||||||
@@ -1351,7 +1351,9 @@ function rebuildCore(content, _intent, deps) {
|
|||||||
let modified = content;
|
let modified = content;
|
||||||
// §2 Decision: re-derive derived sections, preserve others. Order is
|
// §2 Decision: re-derive derived sections, preserve others. Order is
|
||||||
// oldest-section-first so log entries appear in body order.
|
// oldest-section-first so log entries appear in body order.
|
||||||
modified = reconcileCurrentPosition(modified, timestamp, log);
|
// sourcePath threaded so `state rebuild --dry-run` names the file: that branch reads STATE.md
|
||||||
|
// directly rather than through readModifyWriteStateMd, so nothing upstream has named it yet.
|
||||||
|
modified = reconcileCurrentPosition(modified, timestamp, log, deps.sourcePath);
|
||||||
modified = reconcileByPhaseTable(modified, deps, timestamp, log);
|
modified = reconcileByPhaseTable(modified, deps, timestamp, log);
|
||||||
modified = stripTemplatePlaceholders(modified, timestamp, log);
|
modified = stripTemplatePlaceholders(modified, timestamp, log);
|
||||||
modified = deduplicateSessionArchive(modified, timestamp, log);
|
modified = deduplicateSessionArchive(modified, timestamp, log);
|
||||||
@@ -1385,8 +1387,8 @@ function rebuildCore(content, _intent, deps) {
|
|||||||
* the key (Leaky-Abstractions guard — don't synthesize values the canonical
|
* the key (Leaky-Abstractions guard — don't synthesize values the canonical
|
||||||
* source doesn't have).
|
* source doesn't have).
|
||||||
*/
|
*/
|
||||||
function reconcileCurrentPosition(content, timestamp, log) {
|
function reconcileCurrentPosition(content, timestamp, log, sourcePath) {
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, sourcePath);
|
||||||
if (!fm || typeof fm !== 'object')
|
if (!fm || typeof fm !== 'object')
|
||||||
return content;
|
return content;
|
||||||
let modified = content;
|
let modified = content;
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ const COVERED = {
|
|||||||
tests: [
|
tests: [
|
||||||
'tests/frontmatter.property.test.cjs',
|
'tests/frontmatter.property.test.cjs',
|
||||||
'tests/frontmatter.unit.test.cjs',
|
'tests/frontmatter.unit.test.cjs',
|
||||||
|
// #1882 added the unterminated-fence detection to frontmatter.cjs, and the tests that
|
||||||
|
// constrain it live here. Without this entry the mutants in that branch are covered by
|
||||||
|
// no test in the shard, so the module's score drops even though the behaviour is tested.
|
||||||
|
'tests/unusable-input.test.cjs',
|
||||||
],
|
],
|
||||||
minScore: 62,
|
minScore: 62,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ function scanDebugSessions(planDir: string): DebugSessionItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
const status = ((fm.status as string) || 'unknown').toLowerCase();
|
const status = ((fm.status as string) || 'unknown').toLowerCase();
|
||||||
if (status === 'resolved' || status === 'complete') continue;
|
if (status === 'resolved' || status === 'complete') continue;
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ function scanQuickTasks(planDir: string): QuickTaskItem[] {
|
|||||||
if (content === null) {
|
if (content === null) {
|
||||||
status = 'unreadable';
|
status = 'unreadable';
|
||||||
} else {
|
} else {
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeSum);
|
||||||
status = ((fm.status as string) || 'unknown').toLowerCase();
|
status = ((fm.status as string) || 'unknown').toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ function scanThreads(planDir: string): ThreadItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
let status = ((fm.status as string) || '').toLowerCase().trim();
|
let status = ((fm.status as string) || '').toLowerCase().trim();
|
||||||
|
|
||||||
// Fall back to scanning body for ## Status: OPEN / IN PROGRESS
|
// Fall back to scanning body for ## Status: OPEN / IN PROGRESS
|
||||||
@@ -378,7 +378,7 @@ function scanTodos(planDir: string): TodoItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
|
|
||||||
// Extract first line of body after frontmatter
|
// Extract first line of body after frontmatter
|
||||||
const bodyMatch = content.replace(/^---[\s\S]*?---\n?/, '');
|
const bodyMatch = content.replace(/^---[\s\S]*?---\n?/, '');
|
||||||
@@ -436,7 +436,7 @@ function scanSeeds(planDir: string): SeedItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
const status = ((fm.status as string) || 'dormant').toLowerCase();
|
const status = ((fm.status as string) || 'dormant').toLowerCase();
|
||||||
|
|
||||||
if (!unimplementedStatuses.has(status)) continue;
|
if (!unimplementedStatuses.has(status)) continue;
|
||||||
@@ -509,7 +509,7 @@ function scanUatGaps(planDir: string): UatGapItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
const status = ((fm.status as string) || 'unknown').toLowerCase();
|
const status = ((fm.status as string) || 'unknown').toLowerCase();
|
||||||
const result = ((fm.result as string) || '').toLowerCase();
|
const result = ((fm.result as string) || '').toLowerCase();
|
||||||
|
|
||||||
@@ -579,7 +579,7 @@ function scanVerificationGaps(planDir: string): VerificationGapItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
const status = ((fm.status as string) || 'unknown').toLowerCase();
|
const status = ((fm.status as string) || 'unknown').toLowerCase();
|
||||||
|
|
||||||
if (status !== 'gaps_found' && status !== 'human_needed') continue;
|
if (status !== 'gaps_found' && status !== 'human_needed') continue;
|
||||||
@@ -641,7 +641,7 @@ function scanContextQuestions(planDir: string): ContextQuestionItem[] {
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content);
|
const fm = extractFrontmatter(content, safeFilePath);
|
||||||
|
|
||||||
// Check frontmatter open_questions field
|
// Check frontmatter open_questions field
|
||||||
let questions: string[] = [];
|
let questions: string[] = [];
|
||||||
|
|||||||
@@ -149,12 +149,13 @@ function determinePhaseStatus(plans: number, summaries: number, phaseDir: string
|
|||||||
const files = fs.readdirSync(phaseDir);
|
const files = fs.readdirSync(phaseDir);
|
||||||
const verificationFile = files.find(f => f === 'VERIFICATION.md' || f.endsWith('-VERIFICATION.md'));
|
const verificationFile = files.find(f => f === 'VERIFICATION.md' || f.endsWith('-VERIFICATION.md'));
|
||||||
if (verificationFile) {
|
if (verificationFile) {
|
||||||
const content = platformReadSync(path.join(phaseDir, verificationFile)) || '';
|
const verificationFilePath = path.join(phaseDir, verificationFile);
|
||||||
|
const content = platformReadSync(verificationFilePath) || '';
|
||||||
// #1159 (Defect A): read ONLY the frontmatter `status` key to avoid false
|
// #1159 (Defect A): read ONLY the frontmatter `status` key to avoid false
|
||||||
// matches from historical body metadata such as `previous_status: gaps_found`.
|
// matches from historical body metadata such as `previous_status: gaps_found`.
|
||||||
// Full-text regexes like /status:\s*gaps_found/ match the substring inside
|
// Full-text regexes like /status:\s*gaps_found/ match the substring inside
|
||||||
// `previous_status: gaps_found`, producing incorrect phase status labels.
|
// `previous_status: gaps_found`, producing incorrect phase status labels.
|
||||||
const fm = extractFrontmatter(content) as Record<string, unknown>;
|
const fm = extractFrontmatter(content, verificationFilePath) as Record<string, unknown>;
|
||||||
// Normalise to lower-case to preserve the prior case-insensitive behaviour
|
// Normalise to lower-case to preserve the prior case-insensitive behaviour
|
||||||
// while reading only the frontmatter `status` key (not the full body text).
|
// while reading only the frontmatter `status` key (not the full body text).
|
||||||
const fmStatus = typeof fm['status'] === 'string' ? fm['status'].trim().toLowerCase() : '';
|
const fmStatus = typeof fm['status'] === 'string' ? fm['status'].trim().toLowerCase() : '';
|
||||||
@@ -319,7 +320,7 @@ function cmdListSeeds(cwd: string, statusFilter: string | undefined, raw: boolea
|
|||||||
const content = platformReadSync(safeFilePath);
|
const content = platformReadSync(safeFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
|
|
||||||
const fm = extractFrontmatter(content) as Record<string, unknown>;
|
const fm = extractFrontmatter(content, safeFilePath) as Record<string, unknown>;
|
||||||
const status = (fmStr(fm.status) || 'dormant').toLowerCase().trim() || 'dormant';
|
const status = (fmStr(fm.status) || 'dormant').toLowerCase().trim() || 'dormant';
|
||||||
|
|
||||||
// Match on the raw lowercased status (both sides already normalized);
|
// Match on the raw lowercased status (both sides already normalized);
|
||||||
@@ -423,10 +424,11 @@ function cmdHistoryDigest(cwd: string, raw: boolean): void {
|
|||||||
const summaries = fs.readdirSync(dirPath).filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
|
const summaries = fs.readdirSync(dirPath).filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
|
||||||
|
|
||||||
for (const summary of summaries) {
|
for (const summary of summaries) {
|
||||||
const content = platformReadSync(path.join(dirPath, summary));
|
const summaryFilePath = path.join(dirPath, summary);
|
||||||
|
const content = platformReadSync(summaryFilePath);
|
||||||
if (content === null) continue;
|
if (content === null) continue;
|
||||||
try {
|
try {
|
||||||
const fm = extractFrontmatter(content) as Record<string, unknown>;
|
const fm = extractFrontmatter(content, summaryFilePath) as Record<string, unknown>;
|
||||||
|
|
||||||
const phaseNum = (fm['phase'] as string) || dir.split('-')[0];
|
const phaseNum = (fm['phase'] as string) || dir.split('-')[0];
|
||||||
|
|
||||||
@@ -1365,7 +1367,7 @@ function cmdSummaryExtract(cwd: string, summaryPath: string | undefined, fields:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const content = fs.readFileSync(fullPath, 'utf-8');
|
const content = fs.readFileSync(fullPath, 'utf-8');
|
||||||
const fm = extractFrontmatter(content) as Record<string, unknown>;
|
const fm = extractFrontmatter(content, fullPath) as Record<string, unknown>;
|
||||||
|
|
||||||
// Parse key-decisions into structured format
|
// Parse key-decisions into structured format
|
||||||
const parseDecisions = (decisionsList: unknown) => {
|
const parseDecisions = (decisionsList: unknown) => {
|
||||||
|
|||||||
@@ -530,7 +530,13 @@ const _warnedUnusableConfig = new Set<string>();
|
|||||||
* silently discarded still gets no signal. That was the whole defect in #1880.
|
* silently discarded still gets no signal. That was the whole defect in #1880.
|
||||||
*/
|
*/
|
||||||
function _warnUnusableConfig(fault: ConfigFault): void {
|
function _warnUnusableConfig(fault: ConfigFault): void {
|
||||||
const key = `${fault.path} | |||||||