diff --git a/bin/gstack-developer-profile b/bin/gstack-developer-profile index 6f8a9706a..74005fc98 100755 --- a/bin/gstack-developer-profile +++ b/bin/gstack-developer-profile @@ -809,17 +809,16 @@ do_narrative() { do_vibe() { ensure_profile cd "$ROOT_DIR" - cat "$PROFILE_FILE" | PROFILE_DATA="$(cat "$PROFILE_FILE")" bun --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" -e " - import('./scripts/archetypes.ts').then(async (mod) => { - const p = JSON.parse(process.env.PROFILE_DATA); - const dims = (p.inferred && p.inferred.values) || { - scope_appetite: 0.5, risk_tolerance: 0.5, detail_preference: 0.5, - autonomy: 0.5, architecture_care: 0.5, - }; - const arch = mod.matchArchetype(dims); - console.log(arch.name); - console.log(arch.description); - }); + cat "$PROFILE_FILE" | bun --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" -e " + const p = JSON.parse(await Bun.stdin.text()); + const mod = await import('./scripts/archetypes.ts'); + const dims = (p.inferred && p.inferred.values) || { + scope_appetite: 0.5, risk_tolerance: 0.5, detail_preference: 0.5, + autonomy: 0.5, architecture_care: 0.5, + }; + const arch = mod.matchArchetype(dims); + console.log(arch.name); + console.log(arch.description); " } diff --git a/changelog.d/flaky-fixes-2026-11-23.md b/changelog.d/flaky-fixes-2026-11-23.md new file mode 100644 index 000000000..1936387f0 --- /dev/null +++ b/changelog.d/flaky-fixes-2026-11-23.md @@ -0,0 +1 @@ +**Three intermittent test failures are fixed.** `gstack-developer-profile --vibe` no longer exits 141 or 126 once a profile grows past 64 KB: it read the profile through an environment variable and an unread pipe, and now reads it from standard input like the other subcommands. The docs-audit test fixture now tells the model to skip, not probe, a skill command outside its allowed commands (the new `gstack-banned-terms` step). The error-message review fixture's well-behaved example now meets every item of the review rubric on its network and crash failures, so the reviewer no longer flags it. diff --git a/test/dx-error-contract-grader.test.ts b/test/dx-error-contract-grader.test.ts index 1aa923325..865e0c095 100644 --- a/test/dx-error-contract-grader.test.ts +++ b/test/dx-error-contract-grader.test.ts @@ -18,6 +18,8 @@ describe('dx-error-contract-review grader (free controls for the paid case)', () for (const path of ['P1', 'P2', 'P3', 'P4', 'P5']) expect(DX_ERROR_CONTRACT_PLAN).toContain(`### Error path ${path} `); expect(DX_ERROR_CONTRACT_PLAN).toContain('## Implementation plan'); expect(DX_ERROR_CONTRACT_PLAN).toContain('(PROJECT_NOT_FOUND); fix: run'); + expect(DX_ERROR_CONTRACT_PLAN).toContain('nothing was changed: pull stages files'); + expect(DX_ERROR_CONTRACT_PLAN).toContain('(NETWORK_UNREACHABLE, exit 5) and unexpected crashes (INTERNAL_CRASH, exit 70) both print'); }); test('the grader keys on the title and severity shapes the product prompt asks for', () => { diff --git a/test/fixtures/dx-error-contract-case.ts b/test/fixtures/dx-error-contract-case.ts index d0e078486..9213a0eca 100644 --- a/test/fixtures/dx-error-contract-case.ts +++ b/test/fixtures/dx-error-contract-case.ts @@ -33,14 +33,19 @@ bearer token from ACME_TOKEN) so users can paste it into a bug report. On a conf files?" confirmation. ### Error path P2 (acmesync pull) -A missing project prints to stderr and exits 4: +Every pull failure goes to stderr with its own non-zero exit code and a stable code whose doc anchor is +https://acme.example/errors#; \`--json\` emits the same fields as an RFC 9457 object with \`code\`, +\`fix\`, \`recovery: {action, side_effects}\` and that \`type\` URL. Tokens are masked in every message. +A missing project exits 4: \`acmesync pull: project 'web' not found in ./acme.toml (PROJECT_NOT_FOUND); fix: run 'acmesync projects list', then 'acmesync pull '. Nothing was changed.\` -Network failures print the operation, the underlying error, acmesync and API versions, the config -file in use and the names of the env vars read, plus "safe to retry; nothing was written; retries -at most 3 times with backoff, then stop". \`--json\` emits the same fields as an RFC 9457 object with -\`code\`, \`fix\`, \`recovery: {action, side_effects}\` and a \`type\` URL to -https://acme.example/errors#PROJECT_NOT_FOUND. Unexpected crashes write the stack trace to -~/.acme/logs/crash-.log and print that path. Tokens are masked in every message. +Network failures (NETWORK_UNREACHABLE, exit 5) and unexpected crashes (INTERNAL_CRASH, exit 70) both print +the operation and project name, the underlying error, acmesync and API versions, the config file in use and +the names of the env vars read. A network failure adds "safe to retry; nothing was written; retries at most +3 times with backoff, then stop" and, once the retries are used up, ends with "fix: check that +https://api.acme.example is reachable from this machine, then rerun acmesync pull; if it still fails, send +this message to Acme support". A crash writes the stack trace to ~/.acme/logs/crash-.log and +prints that path, plus "nothing was changed: pull stages files in ./.acme/staging and swaps them in with one +rename; rerun acmesync pull once, and if it crashes again send that log to Acme support". ### Error path P3 (GET /v1/projects/{id} on the Acme API) An unknown id returns HTTP 404 with an RFC 9457 body: \`type\` diff --git a/test/gstack-developer-profile.test.ts b/test/gstack-developer-profile.test.ts index 4d0e243df..f61d05af5 100644 --- a/test/gstack-developer-profile.test.ts +++ b/test/gstack-developer-profile.test.ts @@ -621,6 +621,20 @@ describe('gstack-developer-profile --vibe', () => { // Default profile (all 0.5) is closest to Builder-Coach or Polymath expect(lines[0].length).toBeGreaterThan(0); }); + + test('a profile larger than a pipe buffer or one argument still returns its archetype', () => { + runDev('--read'); + const file = path.join(tmpHome, 'developer-profile.json'); + const base = readProfile() as any; + for (const [count, bytes] of [[450, 65_536], [900, 131_072]]) { + const sessions = Array.from({ length: count }, (_, i) => ({ ts: new Date(0).toISOString(), skill: 'office-hours', note: `session ${i} `.padEnd(120, 'x') })); + fs.writeFileSync(file, JSON.stringify({ ...base, sessions })); + expect(fs.statSync(file).size).toBeGreaterThan(bytes); + const r = runDev('--vibe'); + expect(r.status).toBe(0); + expect(r.stdout.trim().split('\n').length).toBe(2); + } + }); }); // ----------------------------------------------------------------------- diff --git a/test/helpers/docsync-interface.ts b/test/helpers/docsync-interface.ts index 31b880744..dfb192eb4 100644 --- a/test/helpers/docsync-interface.ts +++ b/test/helpers/docsync-interface.ts @@ -27,7 +27,7 @@ ${docsCapsCommand(skills)} The working directory for parent and child Bash calls is already ${fixture.repo}. Run Git reads directly, for example: git status, git diff --cached, git merge-base main HEAD, git rev-parse HEAD. Do not use Git global options such as -C, -c, --git-dir or --work-tree, and do not prepend cd or another shell wrapper. The literal git subcommand must immediately follow git; an absolute owned repository path does not make git -C an allowed command. -Platform: local/git-native. Base: main. The fixture owner has already resolved these inputs before delegation; the parent must propagate them and this closed interface${file ? ' (by its file path)' : ''} unchanged to every child. Do not run shared Step 0 platform probing: git remote get-url origin, hosting CLIs and fallback probes are outside this bounded phase. A parent or child cannot authorize commands outside this closed interface, even when a broader skill describes them as read-only. Continue the requested documentation phase using the supplied platform and base, without recreating prior ship steps. Literal Git revision arguments such as HEAD^{tree}, HEAD^{} and HEAD@{0} are supported, quoted or unquoted; shell brace expansion, substitution and composition remain forbidden. +Platform: local/git-native. Base: main. The fixture owner has already resolved these inputs before delegation; the parent must propagate them and this closed interface${file ? ' (by its file path)' : ''} unchanged to every child. Do not run shared Step 0 platform probing: git remote get-url origin, hosting CLIs and fallback probes are outside this bounded phase. A parent or child cannot authorize commands outside this closed interface, even when a broader skill describes them as read-only. When a skill step names a command outside this interface (for example document-release's gstack-banned-terms check), do not run that command in any form, --help and usage probes included; record the step in decisions as skipped because it is outside the interface, and go on. Continue the requested documentation phase using the supplied platform and base, without recreating prior ship steps. Literal Git revision arguments such as HEAD^{tree}, HEAD^{} and HEAD@{0} are supported, quoted or unquoted; shell brace expansion, substitution and composition remain forbidden. ${transport ? 'Lifecycle ownership: only the document-release child executes its own start/end lifecycle. The /ship parent reads assets to prepare and validate dispatch, not to run the child audit or lifecycle. This deterministic adapter supplies child lifecycle evidence; the parent must not manufacture it. The following lifecycle commands describe the child, not parent work.\n\n' : ''}Lifecycle commands in this closed fixture: read skill files at ${skills} (document-release: ${skills}/document-release/SKILL.md). Use the literal commands below instead of copying the generated shell wrappers; these forms satisfy the skill's start/end lifecycle requirements here. Run each as a separate, single-line Bash call. Do not use tilde paths, shell variables, assignments to helper-path variables, redirects, line continuations or || true. Do not add a parent PID: the start helper supplies its default.