fix(#4462): normalize whitespace workstream environment values (#4509)

* test(#4462): expose whitespace workstream scope

* fix(#4462): normalize the workstream environment scope

* docs(#4462): add changeset for #4509

* fix(#4462): normalize sibling planning scope readers

* test(#4462): cover workstream normalization properties

* fix(#4462): share normalized workstream resolution

---------

Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
Michel Moreira
2026-09-15 01:40:15 -03:00
committed by GitHub
parent e5c4941f2a
commit 26e650f312
10 changed files with 145 additions and 12 deletions

View File

@@ -2968,6 +2968,21 @@ describe('#1912 — init.progress fails safe in workstream mode with no active w
assert.match(result.error || '', /workstream|--ws/i, 'error should name the workstream requirement');
});
test('treats a whitespace environment workstream as unset and refuses root progress', (t) => {
seedWs('alpha', 'v9.0');
fs.writeFileSync(path.join(tmpDir, '.planning', 'STATE.md'), 'milestone: v7.1\nstatus: executing\n');
const previous = process.env.GSD_WORKSTREAM;
t.after(() => {
if (previous === undefined) delete process.env.GSD_WORKSTREAM;
else process.env.GSD_WORKSTREAM = previous;
});
process.env.GSD_WORKSTREAM = ' ';
const result = runGsdTools('init progress', tmpDir);
assert.equal(result.success, false, 'a whitespace workstream must not bypass the root-write guard');
assert.match(result.error || '', /workstream|--ws/i);
});
test('succeeds with --ws (reads the named workstream, not root)', () => {
seedWs('alpha', 'v9.0');
fs.writeFileSync(path.join(tmpDir, '.planning', 'STATE.md'), 'milestone: v7.1\nstatus: executing\n');