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

@@ -494,6 +494,26 @@ describe('loadConfigResolved — provenance', () => {
assert.equal(result.degraded, false);
});
test('whitespace-only explicit and environment workstreams resolve and label the root (#4462)', () => {
writeConfig(tmpDir, { model_profile: 'quality' });
for (const workstream of [' ', '\t', '\n', ' \t\n ']) {
const explicit = loadConfigResolved(tmpDir, { workstream });
assert.equal(explicit.source, 'root');
assert.equal(explicit.degraded, false);
const original = process.env.GSD_WORKSTREAM;
try {
process.env.GSD_WORKSTREAM = workstream;
const ambient = loadConfigResolved(tmpDir);
assert.equal(ambient.source, 'root');
assert.equal(ambient.degraded, false);
} finally {
if (original === undefined) delete process.env.GSD_WORKSTREAM;
else process.env.GSD_WORKSTREAM = original;
}
}
});
test('Fix 2a: GSD_WORKSTREAM set to nonexistent workstream (dir absent) → source:"root", degraded:true', () => {
writeConfig(tmpDir, { model_profile: 'root-value' });
const origWs = process.env['GSD_WORKSTREAM'];