Repository navigation
Description
Summary
verify.schema-drift extracts its file list from plan frontmatter with a regex that only matches an inline array. Plans written with a YAML block sequence — which is what gsd-planner itself emits — never match, so the gate inspects zero files and returns block: false without checking anything.
The gate is declared blocking: true at execute:wave:post, so this is a silent pass on a gate that is meant to stop a wave.
The code
bin/lib/verify.cjs, in cmdVerifySchemaDrift (~line 1959):
const fmMatch = content.match(/files_modified:\s*\[([^\]]{0,8000})\]/);The \[ requires an inline array:
files_modified: [a.py, b.py] # matchesBut a block sequence has no [:
files_modified: # does NOT match
- backend/app/models/job.py
- backend/app/services/queue.pyfmMatch is null, nothing is pushed to allFiles, and checkSchemaDrift([], executionLog) early-returns at schema-detect.cjs:86 on detectSchemaFiles([]).detected === false — before the loop that reads executionLog. So neither of the function's two inputs is consulted.
Reproduction
On a phase whose plans use block-sequence files_modified:
$ gsd-tools query check verify.schema-drift 01 --raw
{
"block": false,
"drift_detected": false,
"blocking": false,
"schema_files": [],
"orms": [],
"unpushed_orms": [],
"message": "",
"skipped": false
}
Matching the regex against every plan in the phase directly:
plans whose files_modified the regex MATCHED: 0
plans whose files_modified it MISSED: 12
The empty schema_files / orms are the only tell that the gate did no work — the verdict alone is indistinguishable from a real pass.
Why this is likely to be widespread
gsd-planner emits block-sequence files_modified. Every plan in the affected project was produced by GSD's own planner, so any project on that default format has a permanently green blocking gate. phase-plan-index parses the same field correctly, so the two disagree about what a plan declares.
Suggested fix
Accept both forms where files_modified is read, ideally via one shared parser rather than a second regex. A block-sequence branch:
const block = content.match(/^files_modified:[ \t]*\n((?:[ \t]+-[ \t]*.+\n)+)/m);Separate note — not part of this bug
After fixing the parse locally and feeding the gate 135 correctly-parsed entries, it still returns schemaFiles: []. SCHEMA_PATTERNS (schema-detect.cjs:17-28) covers five JS/TS ORMs — payload, prisma, drizzle, supabase, typeorm — and no Python ORM at all, so SQLAlchemy/Alembic projects get no coverage either way. That is a feature gap rather than a defect and is not what this issue asks you to fix; flagging it only so the parse fix is not mistaken for full coverage on a Python backend.
Found on @opengsd/gsd-core 1.13.0.
Activity
trek-e commentedon Sep 9, 2026
Diagnosis
Reproduced: yes — wrote a throwaway plan frontmatter fixture with
files_modifiedas a YAML block sequence (files_modified:\n - a\n - b) and ran the exact regex fromcmdVerifySchemaDriftagainst it:content.match(/files_modified:\s*\[([^\]]{0,8000})\]/)returnsnull. The reporter's suggested fix regex (/^files_modified:[ \t]*\n((?:[ \t]+-[ \t]*.+\n)+)/m) matched correctly against the same fixture.Root cause: inline-array-only regex never matches a YAML block sequence, in
src/verify.cts:2195(cmdVerifySchemaDrift).allFilesstays empty, andcheckSchemaDrift([], executionLog)early-returnsdriftDetected: falseatsrc/schema-detect.cts:128(if (!detection.detected) return {...}) beforeexecutionLogis ever consulted. Confirmed the two parsers disagree:cmdPhasePlanIndex(src/phase.cts:814, viaRawPlan.filesModified) reads frontmatter throughfrontmatter.cts'sparseGuardedYamlRegion, which parses through a real vendoredjs-yamlengine that handles inline arrays and block sequences identically — only the drift gate's hand-rolled regex is inline-only. The canonical schema docdocs/reference/plan-md.md:34-37(titled "PLAN.md schema reference", stating plans are produced bygsd-planner) documents the real annotated example as a block sequence, confirming this is the format actually produced in practice, matching the reporter's live 0/12 evidence.Introduced by: long-standing, not a recent regression —
get_timelineoncmdVerifySchemaDriftshows the identical inline-onlyfmMatchregex present in all 24 recorded versions from 2026-07-30 through current HEAD. No recorded decision (recall_decision) ties this to a deliberate inline-only constraint.Blast radius: LOW graph radius (
get_impactupstream: onlyrouteVerifyCommand/routeCheckCommand, the CLI dispatch wiring), but functionally significant — this is a silent false-negative gate atexecute:wave:post(blocking: true) that never fires for any plan using block-sequencefiles_modified.Coupled (must not miss):
src/verify-command-router.ctsandsrc/check-command-router.cts(both route to this function;check-command-router.cts:32is a re-export alias, not a second regex copy — confirmed no duplicate inline-only regex exists elsewhere).tests/bugs-1656-1657.test.cjsco-changes with this function (6 shared commits/30d) and should be checked for assumptions pinned to the old regex. Any fix should reuse the real-YAML parsing path (frontmatter.cts'sparseGuardedYamlRegion) thatphase-plan-indexalready uses, rather than hand-rolling a third regex variant.Regression test: add a case to
tests/schema-drift.test.cjswith a plan file whosefiles_modifiedfrontmatter is a YAML block sequence pointing at aSCHEMA_PATTERNSpath (e.g.prisma/schema.prisma) with no push-command evidence in the execution/git log. Today this assertsdriftDetected: false(wrong); after the fix it must assertdriftDetected: true,blocking: true. Add a companion case confirming the existing inline-array form still matches, and a single-element block-sequence boundary case.trek-e commentedon Sep 9, 2026
Agent Brief
Category: bug
Summary: The schema-drift gate's
files_modifiedfrontmatter parser only recognizes an inline YAML array and silently treats a block-sequence list as empty, so the gate never fires for plans written that way.Current behavior: When a plan's
files_modifiedfrontmatter field is written as a YAML block sequence (one- pathper line under the key) rather than an inline[a, b]array, the schema-drift check extracts zero files from that plan, short-circuits its detection with no schema files found, and reports no drift regardless of whether a schema file was actually touched or whether the corresponding push command ran.Desired behavior: The schema-drift check must extract
files_modifiedcorrectly regardless of whether the plan author (orgsd-planner) wrote it as an inline array or a YAML block sequence, matching the same field the phase-plan-index parser already reads correctly. Existing inline-array plans must continue to work unchanged.Key interfaces: the
files_modifiedfrontmatter contract shared bygsd-planner-authored plans, theverify schema-drift/check schema-driftCLI gate (execute:wave:post,blocking: true), and the existing frontmatter YAML-parsing path already used to read the same field elsewhere in the codebase.Acceptance criteria: A plan whose
files_modifiedis a YAML block sequence and which lists a schema-relevant file (matching one of the existing ORM detection patterns) with no corresponding push-command evidence in the execution/git log is correctly flagged as drift (driftDetected: true,blocking: true). A plan using the existing inline-array form continues to behave exactly as before (no regression). A single-item block-sequence list and a multi-item block-sequence list are both handled. A regression test demonstrating the original failure exists and passes after the fix.Out of scope: Python/SQLAlchemy ORM detection coverage (separate feature gap, not part of this fix).
github-actions commentedon Sep 9, 2026
Branch
fix/4562-bug-verify-schema-drift-parses-files-modcreated.git fetch origin && git checkout fix/4562-bug-verify-schema-drift-parses-files-modtrek-e commentedon Sep 11, 2026
Closing as a duplicate of #4631 — consolidating at the seam rather than fixing per-symptom.
This is not a dismissal of the report. Your specifics are preserved verbatim in that epic's Absorbed issues table, and its Done when checklist requires a failing-first regression test for this exact defect before the epic can close.
Why it is being consolidated: a scan of all 69 open
confirmed-bugissues (2026-09-11) found this one shares a single root cause with seven other open issues — a gate hand-rolls a narrow derivation of what it should evaluate, the derivation comes back empty, and "empty" is reported as "pass". Fixing each occurrence where it was found leaves the remaining call sites carrying the same bug, which is the pattern that produced this cluster in the first place.The epic delivers one
resolveEvaluationScope(), evidence read through the existing document seams instead of per-gate regex, and anEvidencetype that distinguishes "none" from "could not read" so a gate can no longer pass vacuously, plus a machine-enforced anti-divergence ratchet so a new hand-written copy cannot be introduced — the approach that worked for #1372 (markdown sectionizer), #2143 (table + bounded mutation) and #2121 (phase-id), each of which closed its bug class structurally.Track the fix at #4631.
fix(#5170): schema-drift reads files_modified through the Frontmatter…
fix(#5170): schema-drift reads files_modified through the Frontmatter…
refactor(#5170): typed gate evidence and a verdict-driven exit status…