* test(01-01): add failing protected-branch warning coverage - pin configured, absent, and malformed branch-list behavior - require opposite CLI and execute warning outcomes * feat(01-01): warn on configured protected branches - resolve the base branch union configured protected branch names - expose exact boolean CLI comparison output for workflow callers - keep execute-phase warning advisory and within its byte budget * test(01-01): add failing protected branch config coverage - cover valid list persistence and null unset - reject hostile shapes while preserving the prior value * feat(01-01): validate protected branch configuration - register git.protected_branches as a canonical config key - require a non-empty array of non-blank branch names * test(01-02): add failing ship protected-branch controls - Execute both workflow warning blocks with exact predicate arguments - Require true and false results to produce opposite warning outcomes - Preserve the none-strategy feature-branch offer contract * feat(01-02): warn at ship on protected branches - Reuse the typed protected-branch predicate in ship preflight - Keep raw base resolution for PR targeting and advisory branch creation - Prove execute and ship warning blocks with opposite-result controls * test(01-02): add failing protected-branch docs parity - Require the canonical schema key in both English config references - Pin the non-empty string-array type and absent default - Require synchronized multi-branch examples and advisory semantics * feat(01-02): publish protected branch configuration contract - Document the optional non-empty string-array field in both references - Explain resolved-base union and absent-field compatibility - Keep execute and ship warnings advisory under branching_strategy none * fix(01): CR-01 honor active workstream branch policy * fix(01): WR-01 assert protected config path selection * docs: add changeset fragment for #3648 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CteVPJt4BkPmroMPGajYx * fix(#3648): resolve base_branch precedence inversion and round-1 findings Blocker 1/2: production config resolution was flat-first, so a project that migrated to git.base_branch but still carried a stale flat base_branch got the old value back. Add base_branch to normalizeLegacyKeys (mirrors the existing branching_strategy/sub_repos pattern: canonical nested wins) and route readEffectiveGitConfig's test seam through the same normalization so it can't silently diverge from production again. Adds a regression test with both keys set that fails without the fix. Blocker 3/4/5: restore the handle_branching case-selector prose and "none" contract sentence that #3389's tests anchor on, and revert the unrelated prose/comment compaction in the same step — both were drive-by edits outside #3552's scope. Also addresses review majors/minors: delete readConfigBaseBranch and readConfigProtectedBranches (dead in production, only self-tested); --is-protected now fails closed (reports protected) instead of silently answering false when the base branch can't be verified; trim configured protected-branch names; fix HOME-without-USERPROFILE vacuous isolation on Windows; correct the drift-ack's byte accounting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S44stkuQbhD3jTCtKzte5N * test(#3648): add failing legacy-key hoist safety coverage Round-2 review found normalizeLegacyKeys block 5 records a normalization carrying the DISCARDED flat value on the canonical-wins branch. Probing that turned up a second, unreported defect in the same helper shape: blocks 1, 2 and 5 all spread result['git'] / result['planning'] with no object guard, so a config whose section key holds a string is spread into index keys — {"git":"main","base_branch":"release"} -> {"git":{"0":"m","1":"a","2":"i","3":"n","base_branch":"release"}} The resolved value is accidentally still correct, so nothing fails and no diagnostic fires. But normalizations.length > 0 sets configDirty, and config-loader then serializes that shape back into the user's config.json — a read that silently corrupts config. The deleted #3057 W3 suite covered {"git":"main","base_branch":"release"} explicitly; this is the input it would have caught. Covers both defects across blocks 1 and 5, with object/array/null negative controls that must stay green in both phases, and a fast-check property over arbitrary `git` values. * test(#3648): pin fail-closed handling of malformed protected_branches Replaces the test that pinned the fail-OPEN behaviour. The old assertion — ['develop', 42] yields isProtected === false for 'develop' — locked in the exact failure #3552 exists to close: config-set validation is bypassable by a direct edit of .planning/config.json, so a user who believes 'develop' is protected got a silent false and no warning. It was also inconsistent with the fail-CLOSED direction twelve lines away, where an unverified base reports protected and writes a diagnostic. A protection predicate must not have two opposite failure directions depending on which input is bad (#3648 review Blocker 3). New coverage: a bad element drops only itself, a non-array contributes no names, an empty list is well-formed rather than malformed, and --is-protected surfaces the rejection. Both negative controls — a clean list reports nothing rejected and writes no diagnostic — must stay green in either phase, so the reject channel cannot fire unconditionally. * fix(#3648): drop only invalid protected_branches and report them Partition git.protected_branches instead of discarding the whole list on one bad element, and carry the rejections out through ProtectedBranchStatus so --is-protected can name them on stderr. Valid names keep protecting; the user finds out the rest were ignored. A non-array value still contributes no names — a bare string is not a list of branch names — but is now reported rather than swallowed. An empty array stays silent: declaring no extra protected branches is a valid choice, not a misconfiguration. writeDiagnostic is hoisted out of the unverified-base branch since both arms now use it. * test(#3648): prove the predicate diagnostic survives both call sites The workflow bash stub now emits a stderr diagnostic the way the real command does, which is what makes a swallowed `2>/dev/null` visible to a test — previously the stub was silent on stderr, so discarding it changed no observable behaviour and the call sites could drop the explanation undetected. Adds the Minor 2 binding check as well: ship must expose the predicate result as IS_PROTECTED rather than only echoing a warning, asserted by running the extracted bash and reading the bound value, not by grepping the workflow source. Both tests carry opposite-outcome controls — an empty diagnostic must leave the text absent, and a false predicate must bind false. * fix(#3648): surface the predicate diagnostic and bind ship's result Drop `2>/dev/null` from the --is-protected call at both call sites. The fail-closed explanation and the new rejected-entry warning both go to stderr, so discarding it left the user with a bare "protected branch" warning on a branch that is not protected and no way to tell a real match from a degraded-git guess. `git branch --show-current` keeps its own redirect — that one is genuine noise. ship.md binds IS_PROTECTED and its prose now branches on the variable, so the following steps have evaluable state instead of having to infer it from warning text in tool output. execute-phase.md byte accounting refreshed: 92326 -> 92645, net growth 319 bytes (was 331 before the redirect came out). Baseline re-verified against the current rebase base by blob id; the ceiling check passes with 755 bytes of margin. * test(#3648): restore negative space for the readFile config seam The #3057 W3 suite was deleted with readConfigBaseBranch, but every arm it pinned survives verbatim in readEffectiveGitConfig's readFile branch — the JSON.parse catch, the non-object guard, the git-section object guard, .trim() and blank-string rejection — and the four surviving readFile injections were positive-path only. protected_branches was never driven through this seam at all. Restores nine cases against the seam, including protected_branches partitioning, plus a control proving loadConfig still wins when both seams are supplied. Records honestly what the suite pins. Mutating the built lib shows .trim() is KILLED, while the non-object guard and the blank-string rejection SURVIVE — both are unreachable through this entry point for the same reasons the deleted suite documented against its own equivalents: a JSON-parsed non-object carries no relevant own-property either way, and a blank value is rejected a second time downstream by the resolver's truthiness check. They stay as defence-in-depth and are labelled known-unkillable rather than left looking like coverage this suite does not provide. * test(#3648): distinguish detached HEAD from a missing branch argument `args[1] ?? ''` collapsed two different situations into one: a detached HEAD, where `git branch --show-current` legitimately prints nothing, and the flag being called with no argument at all. Both answered false, so the right outcome arrived by an unintentional path and a caller bug was indistinguishable from normal operation. Asserts the detached case stays silent and the missing-argument case reports, with a control that the two diagnostics differ. * fix(#3648): report a missing --is-protected branch argument Answer false either way, but say so when the flag arrives with no argument. A detached HEAD passes an explicit empty string and stays silent, since that is a normal state rather than a misconfiguration. * docs(#3648): state exact-name matching and per-entry rejection isProtected is exact string equality, so a git-flow project must enumerate every release/* and hotfix/* by name. #3552 only asked for an integration-branch field, so the implementation satisfies the letter of the issue while leaving its git-flow motivation partly unserved — say so where users will meet it rather than leaving them to discover it. Also documents the Blocker 3 behaviour change: an invalid entry is ignored with a warning naming it and the remaining names still apply. Both statements land in docs/CONFIGURATION.md and gsd-core/references/planning-config.md, and the config-field-docs parity test asserts each in both so the two cannot drift. * refactor(#3648): extract isValidProtectedBranches for cross-surface pinning The `git.protected_branches` check inside `cmdConfigSet` and the resolver's per-entry filter in `git-base-branch.cts` are deliberately different shapes — all-or-nothing on write, per-entry on read, so a hand-edited config.json cannot fail the guard open. Nothing structural keeps their two definitions of "usable branch name" in step. Lifting the write-side check into a named, exported predicate lets a property test ask both surfaces about the same value and assert they agree, which is the fast-check gap the round-2 review flagged. No behaviour change: the predicate is the same expression, called from the same place. * fix(#3648): stop --is-protected rewriting the config it is asking about `gsd_run query git.base-branch --is-protected` runs on every execute-phase and every ship. It resolved config through `loadConfig`, whose normalize-then-write path rewrites `.planning/config.json` whenever any legacy key normalizes — so a boolean question was silently editing the user's checked-in config. This PR had widened the trigger by adding a fifth normalization block (top-level `base_branch` -> `git.base_branch`), making it fire for exactly the projects the feature targets. `loadConfigResolved` gains `options.persist` (opt-OUT, default true): resolution is unchanged, only the two write-back side effects are suppressed. The predicate passes `persist: false`; the ~30 other callers are untouched, so a legacy config is still migrated by ordinary use. Asserted on BYTES rather than parsed shape, because the rewrite reorders keys and reflows whitespace even when the values are equivalent. Three tests, each with its own control: the end-to-end CLI leaves the file byte-identical while still answering `true` from the legacy key (proving the config WAS read); an ordinary persisting load of the same fixture DOES change the bytes (proving the fixture is live rather than inert); and `persist:false` vs default over one directory returns deep-equal config while differing on the write. Reverting the one-line `persist: false` fails the first of those and only that one. Also from the review: - `readEffectiveGitConfig`'s comment claimed the readFile branch routed "through the same precedence authority production uses". It does not, and cannot — it reproduces two of production's steps over a single file. The comment now names what the seam covers and what it does NOT (root/workstream deep merge, builtin and global defaults, federated merge), and the seam now applies production's flat-then-nested lookup so it stops disagreeing about a surviving flat key. - The missing-argument diagnostic promised "answering false", which the fail-closed guard on the same call can contradict by printing `true`. It now states what it did with the argument and leaves the answer to stdout. * test(#3648): re-pin block 5 on #3760's refusal contract #3767 landed on next while this PR was in review and fixed the non-object config-section defect properly: a present-but-non-object section now BLOCKS its own migration — value preserved, no Normalization pushed, refusal reported via `skipped[]` — rather than being rebuilt from a plain-object view. That supersedes this branch's round-2 `hoistLegacyKey`, which prevented the character-key spread but still dropped the section value silently, and which the round-3 review correctly called out as destruction in place of corruption. The rebase drops that commit and routes block 5 through the upstream helper. This file's tests asserted the superseded design, so they are rewritten to pin block 5 — `base_branch` -> `git.base_branch`, which did not exist when #3760's suite was written — against the contract that now governs it: ordinary hoist into an absent/null/object section, canonical-nested-wins, and refusal for each of string/number/boolean/array sections with the exact `skipped` entry. Two controls keep it from passing vacuously: the refusal must be scoped to block 5 (an unrelated block still normalizes in the same call), and a property over arbitrary `git` values asserts hoist and refusal are exhaustive AND mutually exclusive per key, that a refusal leaves both the section and the legacy key untouched, and that a hoist manufactures no index key the input did not carry. * docs(#3648): correct the Git Query and Config Loader module contracts CONTEXT.md's Git Query Module still described base-branch tier 1 as a direct `.planning/config.json` read. Since this PR it is the EFFECTIVE configuration resolved by the Config Loader — a materially different authority, carrying the root/workstream deep merge, flat-then-nested lookup and builtin/federated defaults. The `--is-protected` predicate, `git.protected_branches`, and the two invariants that distinguish the predicate from the plain query (fails closed on an unverified base; must not write) were undocumented entirely. The Config Loader entry now states that loading is not side-effect-free by default and documents `options.persist`. docs/INVENTORY.md's `git-base-branch.cjs` row carried the same stale ladder and no mention of the predicate. `node scripts/gen-inventory-manifest.cjs --write` was run and produced no diff: the manifest indexes roster NAMES, not row prose, so a description edit cannot move it. Also closes the global-defaults minor: `git.protected_branches` is inert in `~/.gsd/defaults.json`, but so is every other `git.*` key — no branch-policy key appears in `_globalBaseCfg` or `GLOBAL_DEFAULTS_RESOLUTION_KEYS`. That is section-wide and predates this PR, so the fix is to state the scope where users meet it rather than to quietly extend the resolution set for two new keys. * fix(#3648): close four defects found by the round-4 external review Two external reviewers (codex, antigravity/Gemini 3.1 Pro) were run adversarially against this branch. Four findings reproduced against source; each is fixed with a failing-first test and a control, and each fix was verified by reverting it and watching exactly the intended test fail. 1. `persist:false` was DROPPED by the workstream fallback (codex). Blocker 1 was only half closed. `loadConfigResolved` re-enters itself with a bare `{ workstream: null }` when a workstream has no config.json of its own, and that literal discarded every other option — so the recursive pass ran at the DEFAULT persistence and rewrote the ROOT config. Reproduced: with GSD_WORKSTREAM=alpha and a legacy flat `base_branch`, `--is-protected` rewrote `.planning/config.json` despite `persist:false`. Both recursions now forward `options` and override only `workstream`; the explicit override still wins the hasOwnProperty check, so spreading cannot let `workstreamContext` reintroduce a workstream. 2. Both workflow call sites failed OPEN, and aborted under `set -e` (both reviewers, independently). `IS_PROTECTED=$(gsd_run ...)` yields an empty string when the query fails, so `[ "$X" = true ]` was simply false: no warning, no trace — a silent hole in the guard whose only job is to warn. The bare assignment also aborted the step under `set -e`. Both sites now degrade VISIBLY: `|| IS_PROTECTED=""`, then an explicit empty-string arm that says the check did not run. Deliberately not fail-closed — claiming "protected" on no evidence would warn on every branch whenever gsd-tools is unavailable. 3. `isValidProtectedBranches` and the resolver disagreed on a sparse array (antigravity). `.every()` skips holes; the resolver's `for...of` yields `undefined` for them, so `["main", , "develop"]` was accepted by config-set and rejected by the resolver. The cross-surface property passed only because `fc.array` cannot generate a hole. The predicate now indexes, and the generator punches holes so that axis is actually falsifiable. JSON cannot express a hole, so this is unreachable in production — but two definitions of one predicate must not contradict each other. 4. A top-level `protected_branches` silently outranked `git.protected_branches` (antigravity). Routing the key through `get(key, {section, field})` gave it flat-then-nested precedence, which is back-compat for keys `normalizeLegacyKeys` migrates. `protected_branches` is new in #3552 and has no legacy form, so that invented an undocumented alias. It now resolves nested-only through a new `getNested`, in production and in the test seam. `base_branch` keeps flat-then-nested — it HAS a legacy spelling that #3760's refusal path can leave behind — and a control pins that distinction. Also narrows a CONTEXT.md claim this round introduced. The predicate fails closed only when a git query TIMED OUT or could not be spawned (#3057 B4's `verified`); a git command that runs and exits non-zero counts as a clean negative, so a cwd that is not a repository answers `false`, not `true`. Verified pre-existing on next @738f42f4, so the documentation was over-claiming rather than the code regressing — but an over-broad contract is exactly what the module docs must not carry. Both workflow byte figures re-derived after the call-site change: execute-phase.md 92356 -> 92865 (+509), ship.md 36784 -> 37227 (+443). * test(#3648): pin git config read parity * docs(#3648): document git query contracts * fix(#3648): expose protected branch default * test(#3648): snapshot planning tree for read-only query * test(#3648): pin planning snapshot stray-write detection * fix(#3648): resolve merge conflict from #3078's ack-fragment sweep next swept the fully-spent 2818/3003 ack fragments this branch had appended to (#3078,a84f7563). Rebased onto upstream/next and took the deletions on both, then moved the #3552 append into a new fragment of its own. Rebasing onto the current base also left execute-phase.md only 34 bytes under the frozen ADR-857 Phase 6 margin ceiling (93400 bytes) — intervening next PRs consumed the rest while this PR was in review. Extracted the "none" arm's protected-branch-warning bash block into gsd-core/workflows/execute-phase/steps/protected-branch.md (content unchanged, matching the existing steps/ extraction pattern used elsewhere in this file) so the inline growth is a one-line pointer instead of the full block. 93366 -> 93385 bytes (+19), 15 bytes inside the ceiling. * fix(#3648): drop stale ack entry for the new step file The extracted execute-phase/steps/protected-branch.md needed no acknowledgment of its own — the differential-attribution check flagged the entry as stale once the build ran, so removed it and kept the two growth entries (execute-phase.md, ship.md) that actually needed one. * fix(#3648): follow the step-file reference in the bash-extraction test helper extractProtectedBranchWarningBash() read the "none" arm's bash block directly out of execute-phase.md. That block now lives in execute-phase/steps/protected-branch.md (byte-ceiling extraction); the helper follows the step-file reference and extracts from there when no inline block is found, so the three execute-phase tests that execute this bash for real keep exercising the actual behavior. * fix(#3648): regenerate INVENTORY-MANIFEST.json and satisfy the CRLF-fragile lint rule - gen-inventory-manifest.cjs --write to pick up the new execute-phase/steps/protected-branch.md entry (already covered by docs/INVENTORY.md's generic workflow_steps wildcard row, so no INVENTORY.md edit is needed). - Reworked the step-file-reference lookup in extractProtectedBranchWarningBash() to avoid a bare-\n regex split on file content (local/no-crlf-fragile-split), using the same line-array scan the function already uses elsewhere. * fix(#3648): regenerate golden install-tree fixtures for the new step file npm run gen:install-tree, adding gsd-core/workflows/execute-phase/ steps/protected-branch.md to all 19 runtime install-tree fixtures. CI's tests/golden-install-tree.test.cjs caught this on push — I'd verified the differential-attribution and INVENTORY-MANIFEST checks but missed this separate golden-fixture check for the new file. * fix(#3648): add the canonical gsd_run preamble to the new step file CI's runtime-launcher-parity suite requires exactly one canonical resolver preamble in every workflow .md that calls gsd_run. The inline "none"-arm block never needed one (execute-phase.md already carried a preamble elsewhere in the same file), but the extracted execute-phase/steps/protected-branch.md is now its own file with no preamble of its own. Ran node scripts/sync-runtime-launcher.cjs to insert it (execute-phase.md itself is untouched — still 93385 bytes, inside the ADR-857 ceiling). That preamble defines its own gsd_run(), which shadows the mock tests/git-base-branch.test.cjs injects for the three #3648 tests that execute this bash for real — without stripping it, those tests reached the real gsd-tools.cjs on the machine running them instead of the test's fixture. Preamble correctness is already covered by tests/runtime-launcher-parity.test.cjs, so extractProtectedBranchWarningBash() now strips the preamble line before handing the block to the harness; it only needs to exercise the #3552 warning logic. * fix(#3552): address PR 3648 review feedback on protected branch warnings - Fix execute-phase handle_branching branching_strategy=none instruction to "Read and execute execute-phase/steps/protected-branch.md" - Use io.error(..., ERROR_REASON.USAGE) for cmdGitBaseBranch usage errors - Align git.protected_branches schema default to (none) without fallback [] - Relocate CONTEXT.md forward-referencing sentence into module body - Sanitize control and ANSI characters in renderRejected diagnostics - Clean up out-of-scope whitespace hunks in gsd-tools.cjs Emitted-Drift-Ack-Growth: execute-phase.md — #3552: execute-phase handle_branching adds a pointer to execute-phase/steps/protected-branch.md for branching_strategy=none so the protected-branch check executes while keeping execute-phase.md within the ADR-857 Phase 6 margin ceiling (93400 bytes). 93392 bytes, 8 bytes inside the ceiling. Emitted-Drift-Ack-Growth: ship.md — #3552: ship preflight step 3 now asks the same typed git.base-branch --is-protected predicate as execute-phase, binding IS_PROTECTED and warning without refusing execution or blocking the branching_strategy=none feature-branch offer; it degrades visibly (rather than silently reading an empty result as "not protected") when the query itself fails to run. 36841 bytes, well inside the XL cap (98304, tests/workflow-size-budget.test.cjs). --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
633 lines
25 KiB
JavaScript
633 lines
25 KiB
JavaScript
// allow-test-rule: docs-parity
|
|
// allow-test-rule: source-text-is-the-product — settings-advanced.md prompt text is the deployed contract (#1216)
|
|
// Extracts CONFIG_DEFAULTS keys from config-loader.cjs source to verify planning-config.md
|
|
// stays in sync. The canonical list of defaults lives in source; there is no runtime
|
|
// API to enumerate them. Source inspection is the only practical parity check here.
|
|
// CONFIG_DEFAULTS was extracted from core.cjs into config-loader.cjs by ADR-857 phase 2e.
|
|
|
|
/**
|
|
* Verify planning-config.md documents all config fields from source code.
|
|
*/
|
|
|
|
const { describe, test, before } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { splitTableRow } = require('../gsd-core/bin/lib/markdown-table.cjs');
|
|
|
|
const REFERENCE_PATH = path.join(__dirname, '..', 'gsd-core', 'references', 'planning-config.md');
|
|
const CORE_PATH = path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'config-loader.cjs');
|
|
const DOCS_CONFIG_PATH = path.join(__dirname, '..', 'docs', 'CONFIGURATION.md');
|
|
const CONFIG_SCHEMA_MANIFEST_PATH = path.join(
|
|
__dirname,
|
|
'..',
|
|
'gsd-core',
|
|
'bin',
|
|
'shared',
|
|
'config-schema.manifest.json',
|
|
);
|
|
|
|
/** Find the markdown table row whose first cell is `` `key` `` and return its cells. */
|
|
function tableRowForKey(content, key) {
|
|
const target = `\`${key}\``;
|
|
for (const line of content.split(/\r?\n/)) {
|
|
const trimmed = line.trim();
|
|
if (!trimmed.startsWith('|')) continue;
|
|
const cells = splitTableRow(line);
|
|
if (cells[0] === target) return cells;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
describe('config-field-docs', () => {
|
|
let content;
|
|
|
|
before(() => {
|
|
content = fs.readFileSync(REFERENCE_PATH, 'utf-8');
|
|
});
|
|
|
|
test('contains Complete Field Reference section', () => {
|
|
assert.ok(
|
|
content.includes('## Complete Field Reference'),
|
|
'planning-config.md must contain a "Complete Field Reference" heading'
|
|
);
|
|
});
|
|
|
|
test('documents at least 15 config fields in tables', () => {
|
|
// Count table rows that start with | `<key>` (field rows, not header/separator)
|
|
const fieldRows = content.match(/^\| `[a-z_][a-z0-9_.]*` \|/gm);
|
|
assert.ok(fieldRows, 'Expected markdown table rows with backtick-quoted keys');
|
|
assert.ok(
|
|
fieldRows.length >= 15,
|
|
`Expected at least 15 documented fields, found ${fieldRows.length}`
|
|
);
|
|
});
|
|
|
|
test('contains example configurations', () => {
|
|
assert.ok(
|
|
content.includes('## Example Configurations'),
|
|
'planning-config.md must contain an "Example Configurations" section'
|
|
);
|
|
// Verify at least one JSON code block with a model_profile key
|
|
assert.ok(
|
|
content.includes('"model_profile"'),
|
|
'Example configurations must include model_profile'
|
|
);
|
|
});
|
|
|
|
test('contains field interactions section', () => {
|
|
assert.ok(
|
|
content.includes('## Field Interactions'),
|
|
'planning-config.md must contain a "Field Interactions" section'
|
|
);
|
|
});
|
|
|
|
test('every CONFIG_DEFAULTS key appears in the doc', () => {
|
|
// Extract CONFIG_DEFAULTS keys from config-loader.cjs source (moved from core.cjs by ADR-857 phase 2e)
|
|
const coreSource = fs.readFileSync(CORE_PATH, 'utf-8');
|
|
const defaultsMatch = coreSource.match(
|
|
// eslint-disable-next-line local/no-unbounded-quantifier -- parses this repo's own config-loader.cjs source, fixed-size author-controlled content
|
|
/const CONFIG_DEFAULTS\s*=\s*\{([\s\S]*?)\r?\n\};/
|
|
);
|
|
assert.ok(defaultsMatch, 'Could not find CONFIG_DEFAULTS in config-loader.cjs');
|
|
|
|
const body = defaultsMatch[1];
|
|
// Match property keys (word characters before the colon)
|
|
const keys = [...body.matchAll(/^\s*(\w+)\s*:/gm)].map(m => m[1]);
|
|
assert.ok(keys.length > 0, 'Could not extract any keys from CONFIG_DEFAULTS');
|
|
|
|
// CONFIG_DEFAULTS uses flat keys; the doc may use namespaced equivalents.
|
|
// Map flat keys to the namespace forms used in config.json and the doc.
|
|
const NAMESPACE_MAP = {
|
|
research: 'workflow.research',
|
|
plan_checker: 'workflow.plan_check',
|
|
verifier: 'workflow.verifier',
|
|
nyquist_validation: 'workflow.nyquist_validation',
|
|
ai_integration_phase: 'workflow.ai_integration_phase',
|
|
api_coverage_gate: 'workflow.api_coverage_gate',
|
|
text_mode: 'workflow.text_mode',
|
|
subagent_timeout: 'workflow.subagent_timeout',
|
|
branching_strategy: 'git.branching_strategy',
|
|
phase_branch_template: 'git.phase_branch_template',
|
|
milestone_branch_template: 'git.milestone_branch_template',
|
|
quick_branch_template: 'git.quick_branch_template',
|
|
security_enforcement: 'workflow.security_enforcement',
|
|
security_asvs_level: 'workflow.security_asvs_level',
|
|
security_block_on: 'workflow.security_block_on',
|
|
inline_plan_threshold: 'workflow.inline_plan_threshold', // #3801
|
|
};
|
|
|
|
const missing = keys.filter(k => {
|
|
// Check both bare key and namespaced form
|
|
if (content.includes(`\`${k}\``)) return false;
|
|
const ns = NAMESPACE_MAP[k];
|
|
if (ns && content.includes(`\`${ns}\``)) return false;
|
|
return true;
|
|
});
|
|
assert.deepStrictEqual(
|
|
missing,
|
|
[],
|
|
`CONFIG_DEFAULTS keys missing from planning-config.md: ${missing.join(', ')}`
|
|
);
|
|
});
|
|
|
|
test('documents workflow namespace fields', () => {
|
|
const workflowFields = [
|
|
'workflow.research',
|
|
'workflow.plan_check',
|
|
'workflow.verifier',
|
|
'workflow.nyquist_validation',
|
|
'workflow.use_worktrees',
|
|
'workflow.subagent_timeout',
|
|
'workflow.text_mode',
|
|
];
|
|
const missing = workflowFields.filter(f => !content.includes(`\`${f}\``));
|
|
assert.deepStrictEqual(
|
|
missing,
|
|
[],
|
|
`Workflow fields missing from planning-config.md: ${missing.join(', ')}`
|
|
);
|
|
});
|
|
|
|
test('documents git namespace fields', () => {
|
|
const gitFields = [
|
|
'git.branching_strategy',
|
|
'git.base_branch',
|
|
'git.phase_branch_template',
|
|
'git.milestone_branch_template',
|
|
];
|
|
const missing = gitFields.filter(f => !content.includes(`\`${f}\``));
|
|
assert.deepStrictEqual(
|
|
missing,
|
|
[],
|
|
`Git fields missing from planning-config.md: ${missing.join(', ')}`
|
|
);
|
|
});
|
|
|
|
test('git.protected_branches canonical field has synchronized type and examples', () => {
|
|
const manifest = JSON.parse(fs.readFileSync(CONFIG_SCHEMA_MANIFEST_PATH, 'utf-8'));
|
|
assert.ok(
|
|
manifest.validKeys.includes('git.protected_branches'),
|
|
'config schema manifest must register git.protected_branches',
|
|
);
|
|
|
|
const publicDocs = fs.readFileSync(DOCS_CONFIG_PATH, 'utf-8');
|
|
const references = [
|
|
['docs/CONFIGURATION.md', publicDocs],
|
|
['gsd-core/references/planning-config.md', content],
|
|
];
|
|
const example = /"protected_branches"\s*:\s*\[\s*"develop"\s*,\s*"staging"\s*\]/;
|
|
|
|
for (const [name, reference] of references) {
|
|
const row = reference
|
|
.split(/\r?\n/)
|
|
.find((line) => line.startsWith('| `git.protected_branches` |'));
|
|
assert.ok(row, `${name} must document the canonical git.protected_branches key`);
|
|
assert.match(row, /array of non-empty strings/i,
|
|
`${name} must document the non-empty string-array contract`);
|
|
assert.match(row, /\| \(none\) \|/,
|
|
`${name} must document that the optional field has no persisted default`);
|
|
assert.match(reference, example,
|
|
`${name} must show the synchronized multi-branch JSON example`);
|
|
assert.match(reference, /extends the resolved base branch/i,
|
|
`${name} must state that configured names extend the resolved base`);
|
|
assert.match(reference, /execute-phase and ship/i,
|
|
`${name} must name both advisory warning boundaries`);
|
|
assert.match(reference, /does not\s+change\s+`git\.branching_strategy: "none"`/i,
|
|
`${name} must preserve branching_strategy none behavior`);
|
|
assert.match(reference, /exact branch name/i,
|
|
`${name} must state that matching is by exact name`);
|
|
assert.match(reference, /no glob or prefix/i,
|
|
`${name} must say globs and prefixes are unsupported, so git-flow layouts enumerate`);
|
|
assert.match(reference, /remaining names\s+still apply/i,
|
|
`${name} must state that an invalid entry drops only itself`);
|
|
}
|
|
});
|
|
|
|
test('documents KNOWN_TOP_LEVEL internal fields not in CONFIG_DEFAULTS', () => {
|
|
// These fields are in KNOWN_TOP_LEVEL (core.cjs) and read by loadConfig()
|
|
// but not in CONFIG_DEFAULTS, so the CONFIG_DEFAULTS test doesn't cover them.
|
|
const internalFields = [
|
|
'model_overrides',
|
|
'agent_skills',
|
|
];
|
|
const missing = internalFields.filter(f => !content.includes(`\`${f}\``));
|
|
assert.deepStrictEqual(
|
|
missing,
|
|
[],
|
|
`KNOWN_TOP_LEVEL internal fields missing from planning-config.md: ${missing.join(', ')}`
|
|
);
|
|
});
|
|
|
|
test('documents sub_repos field (CONFIG_DEFAULTS, no namespace form)', () => {
|
|
// sub_repos is in CONFIG_DEFAULTS but has no NAMESPACE_MAP entry
|
|
// (it uses a planning.sub_repos nested lookup but is documented as a
|
|
// top-level field). Verify it explicitly since the NAMESPACE_MAP path
|
|
// would silently skip it.
|
|
assert.ok(
|
|
content.includes('`sub_repos`'),
|
|
'planning-config.md must document the sub_repos field'
|
|
);
|
|
});
|
|
|
|
test('documents features.thinking_partner field', () => {
|
|
// features.thinking_partner is in VALID_CONFIG_KEYS (config.cjs) and
|
|
// used by discuss-phase.md and plan-phase.md for conditional extended
|
|
// thinking at workflow decision points.
|
|
assert.ok(
|
|
content.includes('`features.thinking_partner`'),
|
|
'planning-config.md must document the features.thinking_partner field'
|
|
);
|
|
});
|
|
|
|
test('mode field documents correct allowed values', () => {
|
|
// mode values are "interactive" and "yolo" per templates/config.json
|
|
// and workflows/new-project.md — NOT "code-first"/"plan-first"/"hybrid"
|
|
assert.ok(
|
|
content.includes('"interactive"') && content.includes('"yolo"'),
|
|
'mode field must document "interactive" and "yolo" as allowed values'
|
|
);
|
|
assert.ok(
|
|
!content.includes('"code-first"'),
|
|
'mode field must NOT document non-existent "code-first" value'
|
|
);
|
|
});
|
|
|
|
test('discuss_mode field documents correct allowed values', () => {
|
|
// discuss_mode values are "discuss" and "assumptions" per workflows/settings.md
|
|
// NOT "auto" or "analyze" (those are CLI flags, not config values)
|
|
assert.ok(
|
|
content.includes('"assumptions"'),
|
|
'discuss_mode must document "assumptions" as an allowed value'
|
|
);
|
|
});
|
|
|
|
test('documents plan_checker alias for workflow.plan_check', () => {
|
|
// plan_checker is the flat-key form in CONFIG_DEFAULTS; workflow.plan_check
|
|
// is the canonical namespaced form. The doc should mention the alias.
|
|
assert.ok(
|
|
content.includes('`workflow.plan_check`'),
|
|
'planning-config.md must document workflow.plan_check'
|
|
);
|
|
assert.ok(
|
|
content.includes('plan_checker'),
|
|
'planning-config.md must mention the plan_checker flat-key alias'
|
|
);
|
|
});
|
|
|
|
test('workflow.test_command is documented in planning-config.md (#1216)', () => {
|
|
assert.ok(
|
|
content.includes('`workflow.test_command`'),
|
|
'planning-config.md must document workflow.test_command'
|
|
);
|
|
// Must appear specifically in the Complete Field Reference section
|
|
const completeRefSection = content.slice(content.indexOf('## Complete Field Reference'));
|
|
assert.ok(
|
|
completeRefSection.includes('`workflow.test_command`'),
|
|
'planning-config.md Complete Field Reference must include workflow.test_command'
|
|
);
|
|
});
|
|
|
|
test('workflow.build_command is documented in planning-config.md (#1216)', () => {
|
|
assert.ok(
|
|
content.includes('`workflow.build_command`'),
|
|
'planning-config.md must document workflow.build_command'
|
|
);
|
|
// Must appear specifically in the Complete Field Reference section
|
|
const completeRefSection = content.slice(content.indexOf('## Complete Field Reference'));
|
|
assert.ok(
|
|
completeRefSection.includes('`workflow.build_command`'),
|
|
'planning-config.md Complete Field Reference must include workflow.build_command'
|
|
);
|
|
});
|
|
});
|
|
|
|
// ─── Capability-enum doc parity (#3303) ─────────────────────────────────────
|
|
|
|
describe('capability-enum doc parity (#3303)', () => {
|
|
const CAPABILITY_PATH = path.join(
|
|
__dirname, '..', 'capabilities', 'code-review', 'capability.json'
|
|
);
|
|
|
|
let docContent;
|
|
let capability;
|
|
|
|
before(() => {
|
|
docContent = fs.readFileSync(REFERENCE_PATH, 'utf-8');
|
|
capability = JSON.parse(fs.readFileSync(CAPABILITY_PATH, 'utf-8'));
|
|
});
|
|
|
|
/**
|
|
* Extract a single Complete-Field-Reference table row by key and split it into
|
|
* trimmed cells: ['', '`key`', type, default, allowedValues, description, ''].
|
|
* Row-scoping keeps unrelated wording elsewhere in the doc from satisfying
|
|
* (or breaking) the parity assertions.
|
|
*/
|
|
function docRow(key) {
|
|
const line = docContent
|
|
.split(/\r?\n/)
|
|
.find(l => l.startsWith(`| \`${key}\` |`));
|
|
assert.ok(line, `planning-config.md must have a table row for \`${key}\``);
|
|
return line.split('|').map(c => c.trim());
|
|
}
|
|
|
|
test('workflow.code_review_depth allowed values match the capability registry (#3303)', () => {
|
|
const spec = capability.config && capability.config['workflow.code_review_depth'];
|
|
assert.ok(
|
|
spec && Array.isArray(spec.values),
|
|
'capabilities/code-review/capability.json must declare workflow.code_review_depth values'
|
|
);
|
|
|
|
const allowedCell = docRow('workflow.code_review_depth')[4];
|
|
const docValues = [...allowedCell.matchAll(/"([^"]+)"/g)].map(m => m[1]);
|
|
assert.ok(
|
|
docValues.length > 0,
|
|
`workflow.code_review_depth Allowed-Values cell must list quoted values, got: ${allowedCell}`
|
|
);
|
|
assert.deepStrictEqual(
|
|
[...docValues].sort(),
|
|
[...spec.values].sort(),
|
|
`planning-config.md workflow.code_review_depth allowed values (${docValues.join(', ')}) ` +
|
|
`must exactly match what config-set accepts per capability.json (${spec.values.join(', ')})`
|
|
);
|
|
});
|
|
|
|
test('workflow.code_review_depth default matches the capability registry (#3303)', () => {
|
|
const spec = capability.config && capability.config['workflow.code_review_depth'];
|
|
assert.ok(spec, 'capability.json must declare workflow.code_review_depth');
|
|
const defaultCell = docRow('workflow.code_review_depth')[3];
|
|
const [docDefault] = [...defaultCell.matchAll(/"([^"]+)"/g)].map(m => m[1]);
|
|
assert.strictEqual(
|
|
docDefault,
|
|
spec.default,
|
|
`planning-config.md workflow.code_review_depth default must match capability.json default (${spec.default})`
|
|
);
|
|
});
|
|
|
|
test('agent_skills row documents the array-of-strings form (#3303)', () => {
|
|
const cells = docRow('agent_skills');
|
|
const allowedCell = cells[4];
|
|
assert.ok(
|
|
/\[\s*"<skill-set>"\s*,/.test(allowedCell),
|
|
`agent_skills Allowed-Values cell must show the array-of-strings form, got: ${allowedCell}`
|
|
);
|
|
assert.ok(
|
|
/array/i.test(cells[5]),
|
|
'agent_skills description must explain the array form assigns multiple skill sets to one agent type'
|
|
);
|
|
});
|
|
});
|
|
|
|
// ─── CONFIGURATION.md parity (#1216) ────────────────────────────────────────
|
|
|
|
describe('CONFIGURATION.md parity (#1216)', () => {
|
|
const DOCS_CONFIG_PATH = path.join(__dirname, '..', 'docs', 'CONFIGURATION.md');
|
|
const SETTINGS_ADVANCED_PATH = path.join(
|
|
__dirname,
|
|
'..',
|
|
'gsd-core',
|
|
'workflows',
|
|
'settings-advanced.md',
|
|
);
|
|
|
|
let docsContent;
|
|
let settingsAdvancedContent;
|
|
|
|
before(() => {
|
|
docsContent = fs.readFileSync(DOCS_CONFIG_PATH, 'utf-8');
|
|
settingsAdvancedContent = fs.readFileSync(SETTINGS_ADVANCED_PATH, 'utf-8');
|
|
});
|
|
|
|
test('CONFIGURATION.md workflow.subagent_timeout describes milliseconds, not seconds (#1216)', () => {
|
|
assert.ok(
|
|
docsContent.includes('millisecond') || docsContent.includes('milliseconds'),
|
|
'CONFIGURATION.md workflow.subagent_timeout must use the word "millisecond(s)"'
|
|
);
|
|
const row = tableRowForKey(docsContent, 'workflow.subagent_timeout');
|
|
assert.ok(row, 'CONFIGURATION.md must have a table row for workflow.subagent_timeout');
|
|
assert.notEqual(
|
|
row[2].replace(/`/g, ''),
|
|
'600',
|
|
'CONFIGURATION.md workflow.subagent_timeout default must not be 600 (that was the seconds default)'
|
|
);
|
|
});
|
|
|
|
test('CONFIGURATION.md workflow.subagent_timeout default is 300000 (#1216)', () => {
|
|
// Row-scoped: the actual table row for workflow.subagent_timeout must contain 300000
|
|
const row = tableRowForKey(docsContent, 'workflow.subagent_timeout');
|
|
assert.ok(row, 'CONFIGURATION.md must have a table row for workflow.subagent_timeout');
|
|
assert.equal(
|
|
row[2].replace(/`/g, ''),
|
|
'300000',
|
|
'CONFIGURATION.md workflow.subagent_timeout table row must have default 300000'
|
|
);
|
|
});
|
|
|
|
test('settings-advanced.md subagent_timeout prompt says milliseconds, not seconds (#1216)', () => {
|
|
assert.ok(
|
|
settingsAdvancedContent.includes('millisecond') ||
|
|
settingsAdvancedContent.includes('milliseconds'),
|
|
'settings-advanced.md subagent_timeout prompt must use "millisecond(s)"'
|
|
);
|
|
assert.ok(
|
|
!settingsAdvancedContent.includes('Integer number of seconds'),
|
|
'settings-advanced.md must NOT say "Integer number of seconds" for subagent_timeout'
|
|
);
|
|
});
|
|
|
|
test('settings-advanced.md subagent_timeout prompt default is 300000 not 600 (#1216)', () => {
|
|
assert.ok(
|
|
!settingsAdvancedContent.match(/value or 600/),
|
|
'settings-advanced.md must NOT show 600 as the subagent_timeout default'
|
|
);
|
|
assert.ok(
|
|
settingsAdvancedContent.includes('300000'),
|
|
'settings-advanced.md must show 300000 as the subagent_timeout default'
|
|
);
|
|
});
|
|
|
|
test('settings-advanced.md parse-default list must NOT show subagent_timeout default 600 (#1216)', () => {
|
|
// Line 53 regression: the parse-default list item must use 300000, not 600
|
|
assert.ok(
|
|
!(/`workflow\.subagent_timeout`[^\r\n]*default:[^\n]*`?600`?/.test(settingsAdvancedContent)),
|
|
'settings-advanced.md must NOT list subagent_timeout default as 600 (stale seconds default)'
|
|
);
|
|
});
|
|
|
|
test('settings-advanced.md confirmation table must NOT label subagent_timeout as {seconds} (#1216)', () => {
|
|
// Line 754 regression: the confirmation table row must say {milliseconds}, not {seconds}
|
|
assert.ok(
|
|
!(/workflow\.subagent_timeout\s*\|\s*\{seconds\}/.test(settingsAdvancedContent)),
|
|
'settings-advanced.md confirmation table must NOT label subagent_timeout as {seconds}'
|
|
);
|
|
});
|
|
|
|
test('settings-advanced.md bash example must NOT use subagent_timeout 900 (#1216)', () => {
|
|
// Line 501 regression: the bash example must not show the stale 900 value
|
|
assert.ok(
|
|
!(/subagent_timeout 900\b/.test(settingsAdvancedContent)),
|
|
'settings-advanced.md bash example must NOT set subagent_timeout to 900 (stale seconds value)'
|
|
);
|
|
});
|
|
|
|
test('CONFIGURATION.md review.models rows do not show shell command examples (#1216)', () => {
|
|
// The Integration Settings section (around line 195-202) used to have
|
|
// shell-command examples like "codex exec --model gpt-5". After the fix
|
|
// those rows must describe model ids, not full commands.
|
|
assert.ok(
|
|
!docsContent.includes('"codex exec --model'),
|
|
'CONFIGURATION.md must NOT contain "codex exec --model" shell command example'
|
|
);
|
|
assert.ok(
|
|
!docsContent.includes('"opencode run --model'),
|
|
'CONFIGURATION.md must NOT contain "opencode run --model" shell command example'
|
|
);
|
|
assert.ok(
|
|
!docsContent.includes('"gemini -m gemini'),
|
|
'CONFIGURATION.md must NOT contain "gemini -m gemini..." shell command example'
|
|
);
|
|
});
|
|
|
|
test('workflow.test_command is documented in CONFIGURATION.md (#1216)', () => {
|
|
assert.ok(
|
|
docsContent.includes('`workflow.test_command`'),
|
|
'CONFIGURATION.md must document workflow.test_command'
|
|
);
|
|
});
|
|
|
|
test('workflow.build_command is documented in CONFIGURATION.md (#1216)', () => {
|
|
assert.ok(
|
|
docsContent.includes('`workflow.build_command`'),
|
|
'CONFIGURATION.md must document workflow.build_command'
|
|
);
|
|
});
|
|
});
|
|
|
|
|
|
// ────────────────────────────────────────────────────────────────────────
|
|
// Folded from tests/enh-1494-workflow-config-key-docs.test.cjs — consolidation epic #1969 (B3 #1972)
|
|
// ────────────────────────────────────────────────────────────────────────
|
|
{
|
|
const { describe: __foldDescribe } = require('node:test');
|
|
__foldDescribe("folded:enh-1494-workflow-config-key-docs (consolidation epic #1969 B3 #1972)", () => {
|
|
'use strict';
|
|
|
|
/**
|
|
* Parity assertions for #1494: workflow config keys that are consumed by
|
|
* planning-pipeline code must be (a) accepted by VALID_CONFIG_KEYS and
|
|
* (b) documented in references/planning-config.md.
|
|
*
|
|
* Per DEFECT.GENERATIVE-FIX: a shared constant / key-list that spans two
|
|
* surfaces requires a parity assertion that fails when the surfaces diverge.
|
|
*/
|
|
|
|
const { describe, test, before, afterEach } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const { createTempProject, cleanup, runGsdTools } = require('./helpers.cjs');
|
|
|
|
const CONFIG_SCHEMA_PATH = path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'config-schema.cjs');
|
|
const PLANNING_CONFIG_PATH = path.join(__dirname, '..', 'gsd-core', 'references', 'planning-config.md');
|
|
|
|
describe('VALID_CONFIG_KEYS parity — #1494 orphan-undocumented keys', () => {
|
|
const { VALID_CONFIG_KEYS } = require(CONFIG_SCHEMA_PATH);
|
|
|
|
test('workflow.mvp_mode is in VALID_CONFIG_KEYS', () => {
|
|
assert.ok(
|
|
VALID_CONFIG_KEYS.has('workflow.mvp_mode'),
|
|
'workflow.mvp_mode is read by config-loader.cts and plan-phase.md but was missing from VALID_CONFIG_KEYS (#1494)'
|
|
);
|
|
});
|
|
|
|
test('workflow.code_review_command is in VALID_CONFIG_KEYS', () => {
|
|
assert.ok(
|
|
VALID_CONFIG_KEYS.has('workflow.code_review_command'),
|
|
'workflow.code_review_command must be in VALID_CONFIG_KEYS'
|
|
);
|
|
});
|
|
|
|
test('workflow.plan_chunked is in VALID_CONFIG_KEYS', () => {
|
|
assert.ok(
|
|
VALID_CONFIG_KEYS.has('workflow.plan_chunked'),
|
|
'workflow.plan_chunked must be in VALID_CONFIG_KEYS'
|
|
);
|
|
});
|
|
|
|
test('workflow.test_command is in VALID_CONFIG_KEYS', () => {
|
|
assert.ok(
|
|
VALID_CONFIG_KEYS.has('workflow.test_command'),
|
|
'workflow.test_command must be in VALID_CONFIG_KEYS'
|
|
);
|
|
});
|
|
|
|
test('workflow.build_command is in VALID_CONFIG_KEYS', () => {
|
|
assert.ok(
|
|
VALID_CONFIG_KEYS.has('workflow.build_command'),
|
|
'workflow.build_command must be in VALID_CONFIG_KEYS'
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('config-set accepts workflow.mvp_mode (#1494)', () => {
|
|
let tmpDir;
|
|
afterEach(() => { if (tmpDir) cleanup(tmpDir); });
|
|
|
|
test('config-set workflow.mvp_mode true succeeds and stores the value', () => {
|
|
tmpDir = createTempProject();
|
|
const result = runGsdTools(['config-set', 'workflow.mvp_mode', 'true'], tmpDir);
|
|
assert.ok(
|
|
result.success,
|
|
`config-set workflow.mvp_mode must succeed; got:\nstdout: ${result.output}\nstderr: ${result.error}`
|
|
);
|
|
const parsed = JSON.parse(result.output);
|
|
assert.strictEqual(parsed.updated, true, 'response must have updated:true');
|
|
assert.strictEqual(parsed.key, 'workflow.mvp_mode', 'response must echo the key');
|
|
});
|
|
|
|
test('config-set workflow.mvp_mode false succeeds', () => {
|
|
tmpDir = createTempProject();
|
|
const result = runGsdTools(['config-set', 'workflow.mvp_mode', 'false'], tmpDir);
|
|
assert.ok(
|
|
result.success,
|
|
`config-set workflow.mvp_mode false must succeed; got:\nstdout: ${result.output}\nstderr: ${result.error}`
|
|
);
|
|
const parsed = JSON.parse(result.output);
|
|
assert.strictEqual(parsed.updated, true);
|
|
});
|
|
});
|
|
|
|
// allow-test-rule: source-text-is-the-product — planning-config.md is the deployed reference contract (#1494)
|
|
describe('planning-config.md documents #1494 keys', () => {
|
|
let content;
|
|
before(() => { content = fs.readFileSync(PLANNING_CONFIG_PATH, 'utf-8'); });
|
|
|
|
const KEYS = [
|
|
'workflow.mvp_mode',
|
|
'workflow.code_review_command',
|
|
'workflow.plan_chunked',
|
|
'workflow.test_command',
|
|
'workflow.build_command',
|
|
];
|
|
|
|
for (const key of KEYS) {
|
|
test(`planning-config.md documents \`${key}\``, () => {
|
|
assert.ok(
|
|
content.includes(`\`${key}\``),
|
|
`planning-config.md must document \`${key}\` (#1494)`
|
|
);
|
|
});
|
|
|
|
test(`\`${key}\` appears in the Complete Field Reference section`, () => {
|
|
const refSection = content.slice(content.indexOf('## Complete Field Reference'));
|
|
assert.ok(
|
|
refSection.includes(`\`${key}\``),
|
|
`planning-config.md Complete Field Reference must include \`${key}\` (#1494)`
|
|
);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|