refactor: deepen GSDTools query execution seams (#3085)
* refactor: deepen gsdtools query execution seams * docs: add changeset for query seam deepening * docs: fix changeset summary text * fix: address coderabbit query seam findings * test: address remaining coderabbit findings and notes * refactor: use internal gsdtools error type import
This commit is contained in:
@@ -10,13 +10,15 @@ import { fileURLToPath } from 'node:url';
|
||||
import { execSync } from 'node:child_process';
|
||||
import { READ_ONLY_JSON_PARITY_ROWS } from './read-only-golden-rows.js';
|
||||
|
||||
const STABLE_JSON_PARITY_ROWS = READ_ONLY_JSON_PARITY_ROWS.filter(
|
||||
(row) => row.canonical !== 'scan-sessions' && row.canonical !== 'audit-uat',
|
||||
);
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const REPO_ROOT = resolve(__dirname, '..', '..', '..');
|
||||
|
||||
describe('Read-only golden parity (JSON toEqual)', () => {
|
||||
it.each(READ_ONLY_JSON_PARITY_ROWS)('$canonical matches gsd-tools.cjs JSON', async (row) => {
|
||||
// Volatile command: mutates while suite runs (session count/size timestamps).
|
||||
if (row.canonical === 'scan-sessions' || row.canonical === 'audit-uat') return;
|
||||
it.each(STABLE_JSON_PARITY_ROWS)('$canonical matches gsd-tools.cjs JSON', async (row) => {
|
||||
|
||||
const gsdOutput = await captureGsdToolsOutput(row.cjs, row.cjsArgs, REPO_ROOT);
|
||||
const registry = createRegistry();
|
||||
@@ -94,19 +96,19 @@ describe('state.load golden parity', () => {
|
||||
});
|
||||
|
||||
describe('state.get golden parity', () => {
|
||||
it('matches full STATE.md when no field (same as `state get` with no section)', async () => {
|
||||
it('matches full STATE.md when no field (same as `state get` with no section)', async ({ skip }) => {
|
||||
const registry = createRegistry();
|
||||
const sdkResult = await registry.dispatch('state.get', [], REPO_ROOT);
|
||||
// Repo may not have .planning/STATE.md; skip parity in that case.
|
||||
if ((sdkResult.data as Record<string, unknown>)?.error === 'STATE.md not found') return;
|
||||
if ((sdkResult.data as Record<string, unknown>)?.error === 'STATE.md not found') skip();
|
||||
const gsdOutput = await captureGsdToolsOutput('state', ['get'], REPO_ROOT);
|
||||
expect(sdkResult.data).toEqual(gsdOutput);
|
||||
});
|
||||
|
||||
it('matches single frontmatter field when `state get <field>`', async () => {
|
||||
it('matches single frontmatter field when `state get <field>`', async ({ skip }) => {
|
||||
const registry = createRegistry();
|
||||
const sdkResult = await registry.dispatch('state.get', ['milestone'], REPO_ROOT);
|
||||
if ((sdkResult.data as Record<string, unknown>)?.error === 'STATE.md not found') return;
|
||||
if ((sdkResult.data as Record<string, unknown>)?.error === 'STATE.md not found') skip();
|
||||
const gsdOutput = await captureGsdToolsOutput('state', ['get', 'milestone'], REPO_ROOT);
|
||||
expect(sdkResult.data).toEqual(gsdOutput);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user