fix(#138): add --default true to nyquist_validation config-get in validate-phase/audit-milestone (#405)
config-get calls lacked --default, causing stderr noise ("Key not found") and a fragile empty-variable fallback when workflow.nyquist_validation was absent; added --default true (matching schema default). Fixes #138.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
5
.changeset/138-nyquist-config-get-default.md
Normal file
5
.changeset/138-nyquist-config-get-default.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: Fixed
|
||||
pr: 138
|
||||
---
|
||||
`config-get workflow.nyquist_validation` calls in validate-phase and audit-milestone now include `--default true`, preventing stderr noise and fragile empty-variable fallback when the key is absent.
|
||||
@@ -144,7 +144,7 @@ For each REQ-ID, determine status using all three sources:
|
||||
Skip if `workflow.nyquist_validation` is explicitly `false` (absent = enabled).
|
||||
|
||||
```bash
|
||||
NYQUIST_CONFIG=$(gsd_run query config-get workflow.nyquist_validation --raw 2>/dev/null)
|
||||
NYQUIST_CONFIG=$(gsd_run query config-get workflow.nyquist_validation --raw --default true 2>/dev/null)
|
||||
```
|
||||
|
||||
If `false`: skip entirely.
|
||||
|
||||
@@ -26,7 +26,7 @@ Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`.
|
||||
|
||||
```bash
|
||||
AUDITOR_MODEL=$(gsd_run query resolve-model gsd-nyquist-auditor --raw)
|
||||
NYQUIST_CFG=$(gsd_run query config-get workflow.nyquist_validation --raw)
|
||||
NYQUIST_CFG=$(gsd_run query config-get workflow.nyquist_validation --raw --default true)
|
||||
```
|
||||
|
||||
If `NYQUIST_CFG` is `false`: exit with "Nyquist validation is disabled. Enable via /gsd:settings."
|
||||
|
||||
48
tests/policy-138-nyquist-config-default.test.cjs
Normal file
48
tests/policy-138-nyquist-config-default.test.cjs
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
// Policy regression test for issue #138:
|
||||
// config-get workflow.nyquist_validation calls in validate-phase.md and
|
||||
// audit-milestone.md MUST include --default so they don't error / emit
|
||||
// stderr noise when the key is absent.
|
||||
//
|
||||
// Form-agnostic: matches on `config-get workflow.nyquist_validation` + `--default`
|
||||
// regardless of the runtime prefix ($GSD_SDK vs gsd_run), so this test
|
||||
// survives PR #379's prefix rename.
|
||||
|
||||
const { test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const WORKFLOWS_DIR = path.join(__dirname, '..', 'get-shit-done', 'workflows');
|
||||
|
||||
function findNyquistConfigLine(filePath) {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const lines = content.split('\n');
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].includes('config-get workflow.nyquist_validation')) {
|
||||
return { lineNumber: i + 1, line: lines[i] };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
test('validate-phase.md: config-get workflow.nyquist_validation must include --default', () => {
|
||||
const filePath = path.join(WORKFLOWS_DIR, 'validate-phase.md');
|
||||
const result = findNyquistConfigLine(filePath);
|
||||
assert.ok(result, 'Should find a line containing config-get workflow.nyquist_validation in validate-phase.md');
|
||||
assert.ok(
|
||||
result.line.includes('--default'),
|
||||
`Line ${result.lineNumber} of validate-phase.md is missing --default flag.\nFound: ${result.line.trim()}`
|
||||
);
|
||||
});
|
||||
|
||||
test('audit-milestone.md: config-get workflow.nyquist_validation must include --default', () => {
|
||||
const filePath = path.join(WORKFLOWS_DIR, 'audit-milestone.md');
|
||||
const result = findNyquistConfigLine(filePath);
|
||||
assert.ok(result, 'Should find a line containing config-get workflow.nyquist_validation in audit-milestone.md');
|
||||
assert.ok(
|
||||
result.line.includes('--default'),
|
||||
`Line ${result.lineNumber} of audit-milestone.md is missing --default flag.\nFound: ${result.line.trim()}`
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user