mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 00:51:31 +01:00
Codex skills no longer stop on temp-file cleanup, which Codex refuses as rm -f (GST-3364) (#4612)
Skills that clean up temp files now run on Codex: Codex CLI refuses any `rm` with a force flag, and 67 of the 1,239 shell blocks in gstack's Codex skills used one. This unblocks gstack on Codex (office-hours, review, ship, the plan reviews, spec and gstack-upgrade all hit it). Nothing to do after merging. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=state-machines Review-Finding: gstack-upgrade/SKILL.md.tmpl:363:posix-sh-brace-expansion reader=core
This commit is contained in:
1 parent
43c9c201e3
commit
bd77c8ccaa
86 files changed
+337
-204
No files matched your search
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* Codex CLI refuses forced rm (GST-3364).
|
||||
*
|
||||
* Codex classifies every literal command in a shell script it is asked to run
|
||||
* (inside quotes, $(...), trap actions and bash -c too). An rm with a force
|
||||
* option before "--" (-f, -rf, -fr, --force, any single-dash cluster holding
|
||||
* "f") is a dangerous command: with approvals off Codex rejects it with "rm -f
|
||||
* style commands are not permitted. Use a safer approach", otherwise it stops
|
||||
* to ask. Source: openai/codex codex-rs/shell-command/src/command_safety/
|
||||
* is_dangerous_command.rs (rm_args_include_force_option) and
|
||||
* codex-rs/core/src/exec_policy.rs at rust-v0.170.0.
|
||||
*
|
||||
* Renders the Codex host and fails on any forced rm in a shell fence or an
|
||||
* inline code span. Cleanup that must tolerate a missing path uses
|
||||
* "rm X 2>/dev/null || true" or "[ ! -e X ] || rm X"; a folder that can hold
|
||||
* read-only files (a git checkout) uses "rm -r X </dev/null", so a tty never
|
||||
* stops to ask.
|
||||
* The detector is deliberately broader than Codex: it also flags rm text inside
|
||||
* echo strings, because a model told to run that text gets the same refusal.
|
||||
*/
|
||||
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { runGeneration } from '../scripts/gen-skill-docs';
|
||||
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-codex-rm-'));
|
||||
const renderDir = path.join(tmp, 'render');
|
||||
const SHELL_LANGS = new Set(['', 'bash', 'sh', 'shell', 'zsh', 'console']);
|
||||
const WRAPPERS = new Set(['sudo', 'env', 'exec', 'command', 'then', 'do', 'else', 'time', 'nohup', 'xargs', '!']);
|
||||
/** These skills document the commands their guard warns about; the spans are not commands to run. */
|
||||
const GUARD_DOCS = new Set(['gstack-careful', 'gstack-guard']);
|
||||
|
||||
/** Forced rm invocations in shell text, as Codex's rule reads them (a superset: quoted text counts). */
|
||||
export function forcedRm(text: string): string[] {
|
||||
const hits: string[] = [];
|
||||
for (const m of text.matchAll(/(?<![\w.\/-])(?:\/(?:[\w.-]+\/)*)?rm(?=[ \t])/g)) {
|
||||
const at = m.index!;
|
||||
const before = text.slice(text.lastIndexOf('\n', at - 1) + 1, at);
|
||||
const prev = before.trimEnd().split(/\s+/).at(-1) ?? '';
|
||||
const atCommand = prev === '' || /[;&|(\x60'"{}]$/.test(prev) || WRAPPERS.has(prev) || /^[A-Za-z_]\w*=/.test(prev);
|
||||
if (!atCommand) continue;
|
||||
const rest = text.slice(at + m[0].length).split(/[;&|)\n\x60]/)[0];
|
||||
for (const raw of rest.trim().split(/\s+/)) {
|
||||
const arg = raw.replace(/^['"]+|['"]+$/g, '');
|
||||
if (arg === '--') break;
|
||||
if (arg === '--force' || /^-[A-Za-z]*f[A-Za-z]*$/.test(arg)) { hits.push((m[0] + rest).trim()); break; }
|
||||
}
|
||||
}
|
||||
return hits;
|
||||
}
|
||||
|
||||
function renderedDocs(dir: string): string[] {
|
||||
const out: string[] = [];
|
||||
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const p = path.join(dir, e.name);
|
||||
if (e.isDirectory()) out.push(...renderedDocs(p));
|
||||
else if (e.isFile() && e.name.endsWith('.md')) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Shell fences and inline code spans outside fences (CommonMark: a longer outer fence hides inner ones). */
|
||||
function shellText(text: string): { fences: Array<{ line: number; body: string }>; spans: Array<{ line: number; body: string }> } {
|
||||
const lines = text.split('\n');
|
||||
const fences: Array<{ line: number; body: string }> = [];
|
||||
const spans: Array<{ line: number; body: string }> = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const open = lines[i].match(/^(\s*)(\x60{3,}|~{3,})(.*)$/);
|
||||
if (!open) {
|
||||
for (const s of lines[i].matchAll(/\x60([^\x60\n]+)\x60/g)) spans.push({ line: i + 1, body: s[1] });
|
||||
continue;
|
||||
}
|
||||
let end = i + 1;
|
||||
const close = new RegExp('^\\s*' + open[2][0] + '{' + open[2].length + ',}\\s*$');
|
||||
while (end < lines.length && !close.test(lines[end])) end++;
|
||||
if (SHELL_LANGS.has(open[3].trim())) fences.push({ line: i + 1, body: lines.slice(i + 1, end).join('\n') });
|
||||
i = end;
|
||||
}
|
||||
return { fences, spans };
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const result = await runGeneration({ host: 'codex', outputRoot: renderDir });
|
||||
if (result.exitCode !== 0) throw new Error(result.diagnostics.filter(d => d.kind === 'error').map(d => d.message).join('\n'));
|
||||
});
|
||||
afterAll(() => fs.rmSync(tmp, { recursive: true, force: true }));
|
||||
|
||||
describe('forcedRm follows Codex 0.170 is_dangerous_command', () => {
|
||||
test('flags the shapes Codex refuses', () => {
|
||||
for (const script of [
|
||||
'rm -rf /', 'rm -f /', '/bin/rm -fr /tmp/example', 'rm -r -f /tmp/example', 'rm --force /tmp/example',
|
||||
'rm /tmp/example -f', 'sudo rm -rf /tmp/example', 'env TARGET=/tmp/example rm -rf /tmp/example',
|
||||
'printf x | rm -rf /tmp/example', 'if test -d /tmp/example; then rm --force /tmp/example; fi',
|
||||
'rm -rf "$TARGET" >/dev/null', 'for t in /tmp/a /tmp/b; do rm -r -f "$t"; done', 'echo "$(rm -rf /tmp/example)"',
|
||||
"bash -c 'rm -rf /tmp/example'", "trap 'rm -rf /tmp/example' EXIT",
|
||||
'X=1 rm -Rf "$X"', 'cp a b && rm -f "$F" && echo ok', "trap 'rm -f \"$A\"; [ -z \"$B\" ] || rm -rf \"$B\"' EXIT",
|
||||
]) expect(forcedRm(script), script).not.toEqual([]);
|
||||
});
|
||||
|
||||
test('passes the cleanup forms gstack uses and commands that only contain the letters', () => {
|
||||
for (const script of [
|
||||
'rm -r /tmp/example', 'rm -- -f', 'rm "$F" 2>/dev/null || true', '[ ! -e "$F" ] || rm -- "$F"',
|
||||
'rm -r -- "$D" </dev/null', "trap 'rm -r \"$_OUTSIDE_TMP\"' EXIT", 'env TARGET=/tmp/example rm -r /tmp/example',
|
||||
'git rm -f x', 'docker rm -f c', 'git worktree remove --force "$D/wt"', 'cp -Rf a b', 'confirm -f', 'npm run rm -f',
|
||||
]) expect(forcedRm(script), script).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Codex renders contain no forced rm', () => {
|
||||
test('every shell fence and inline code span of every Codex render file', () => {
|
||||
const root = path.join(renderDir, '.agents', 'skills');
|
||||
const files = renderedDocs(root);
|
||||
expect(files.length).toBeGreaterThan(100);
|
||||
let fenceCount = 0;
|
||||
const problems: string[] = [];
|
||||
for (const file of files) {
|
||||
const rel = path.relative(root, file);
|
||||
const { fences, spans } = shellText(fs.readFileSync(file, 'utf8'));
|
||||
fenceCount += fences.length;
|
||||
for (const f of fences) for (const hit of forcedRm(f.body)) problems.push(rel + ':' + f.line + ' fence: ' + hit);
|
||||
if (GUARD_DOCS.has(rel.split(path.sep)[0])) continue;
|
||||
for (const s of spans) for (const hit of forcedRm(s.body)) problems.push(rel + ':' + s.line + ' inline: ' + hit);
|
||||
}
|
||||
expect(fenceCount).toBeGreaterThan(1000);
|
||||
expect(problems).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
{"sha":"bc6f719737c3ad983897755a3be0d5dae48b011e0c9471165b0f6d4c1bbec5c6","replay":"GST-1821"}
|
||||
{"sha":"a7c94e6a25e9c4f2e2b725941ecb78845b7abadb0df4f224592987b954bcefdd","replay":"GST-3364"}
|
||||
@@ -1 +1 @@
|
||||
{"sha":"18b1627a6886fe2e0f0e6cc80a33ac2ee138ac2c8996f51bcb68a108f281acb6","replay":"GST-3075"}
|
||||
{"sha":"7e63c800b944982ddc8729d1afe6605f673a540ae5c661f043c699be6211454c","replay":"GST-3364"}
|
||||
@@ -1 +1 @@
|
||||
{"sha":"3bbbd295c2301c35c253d0ad8a151dad09d731b94019a306a298226bae985fca","replay":"GST-2968"}
|
||||
{"sha":"028d2acefe7be4eaba56ff7f086dc7eae1ef9d308f24276f9f3ef9b9b64bf1c1","replay":"GST-3364"}
|
||||
@@ -0,0 +1 @@
|
||||
{"replay":"GST-3364","justification":"GST-3364 (Codex CLI 0.170 refuses rm with a force flag): review/sections/adversarial.md, ship/sections/adversarial.md and ship/sections/review-army.md change only shell cleanup that no reviewer reads. The outside-voice runner's EXIT trap becomes trap 'rm -r \"$_OUTSIDE_TMP\"' EXIT instead of rm -rf, and Step 9's entry command clears .gstack/tmp/targeted.json with { rm .gstack/tmp/targeted.json 2>/dev/null || true; } instead of rm -f. The prompt each voice receives comes from its prompt file, not from the trap line. Deterministic no-loss check, no paid run: every brief body lib/review-brief.ts cuts from the ship sections keeps its pinned hash (test/fixtures/review-pins/brief-bodies unchanged; test/review-packets-removed.test.ts 'every reviewer brief cut from the ship sections is byte-identical to its pinned body' passes at this tree). No reader, depth, dispatch, brief, checklist or finding rule changes; CREW rule 15 exempts non-reviewer /ship prose."}
|
||||
+51
-51
@@ -2,56 +2,56 @@
|
||||
"_comment": "Generated SKILL.md files over the limit, pinned at their exact character count (#3199). test/skill-md-size-guard.test.ts fails when a pinned skill grows past its pin or shrinks below it: lower the pin when a skill shrinks and delete it once the skill is within the limit. Raising a pin is an owner decision. The shared-preamble hoist (GSTA-96) moved every tier 2+ skill's shared preamble into sections/preamble.md; the pins below are what remains.",
|
||||
"limit": 100000,
|
||||
"pins": {
|
||||
"agy/gstack-autoplan": 109152,
|
||||
"agy/gstack-plan-design-review": 109103,
|
||||
"agy/gstack-plan-devex-review": 114944,
|
||||
"agy/gstack-plan-eng-review": 143530,
|
||||
"agy/gstack-review": 104723,
|
||||
"codex/gstack-autoplan": 107420,
|
||||
"codex/gstack-plan-design-review": 110378,
|
||||
"codex/gstack-plan-devex-review": 114230,
|
||||
"codex/gstack-plan-eng-review": 142473,
|
||||
"codex/gstack-review": 104057,
|
||||
"copilot/gstack-autoplan": 108595,
|
||||
"copilot/gstack-plan-design-review": 109369,
|
||||
"copilot/gstack-plan-devex-review": 114406,
|
||||
"copilot/gstack-plan-eng-review": 143695,
|
||||
"copilot/gstack-review": 104304,
|
||||
"cursor/gstack-autoplan": 107827,
|
||||
"cursor/gstack-plan-design-review": 107911,
|
||||
"cursor/gstack-plan-devex-review": 113676,
|
||||
"cursor/gstack-plan-eng-review": 142285,
|
||||
"cursor/gstack-review": 122776,
|
||||
"factory/gstack-autoplan": 110105,
|
||||
"factory/gstack-plan-design-review": 111009,
|
||||
"factory/gstack-plan-devex-review": 117039,
|
||||
"factory/gstack-plan-eng-review": 145393,
|
||||
"factory/gstack-review": 126549,
|
||||
"gbrain/gstack-autoplan": 108234,
|
||||
"gbrain/gstack-plan-eng-review": 124932,
|
||||
"gemini/gstack-autoplan": 108385,
|
||||
"gemini/gstack-plan-design-review": 109197,
|
||||
"gemini/gstack-plan-devex-review": 114234,
|
||||
"gemini/gstack-plan-eng-review": 143528,
|
||||
"gemini/gstack-review": 104126,
|
||||
"hermes/gstack-autoplan": 108239,
|
||||
"hermes/gstack-plan-eng-review": 124885,
|
||||
"kiro/gstack-autoplan": 107601,
|
||||
"kiro/gstack-plan-design-review": 107757,
|
||||
"kiro/gstack-plan-devex-review": 113528,
|
||||
"kiro/gstack-plan-eng-review": 142147,
|
||||
"kiro/gstack-review": 122600,
|
||||
"openclaw/gstack-autoplan": 108057,
|
||||
"openclaw/gstack-plan-eng-review": 123428,
|
||||
"opencode/gstack-autoplan": 108576,
|
||||
"opencode/gstack-plan-design-review": 109225,
|
||||
"opencode/gstack-plan-devex-review": 114284,
|
||||
"opencode/gstack-plan-eng-review": 143554,
|
||||
"opencode/gstack-review": 123398,
|
||||
"slate/gstack-autoplan": 107714,
|
||||
"slate/gstack-plan-design-review": 107834,
|
||||
"slate/gstack-plan-devex-review": 113602,
|
||||
"slate/gstack-plan-eng-review": 142216,
|
||||
"slate/gstack-review": 122688
|
||||
"agy/gstack-autoplan": 109142,
|
||||
"agy/gstack-plan-design-review": 109093,
|
||||
"agy/gstack-plan-devex-review": 114937,
|
||||
"agy/gstack-plan-eng-review": 143523,
|
||||
"agy/gstack-review": 104718,
|
||||
"codex/gstack-autoplan": 107410,
|
||||
"codex/gstack-plan-design-review": 110368,
|
||||
"codex/gstack-plan-devex-review": 114223,
|
||||
"codex/gstack-plan-eng-review": 142466,
|
||||
"codex/gstack-review": 104052,
|
||||
"copilot/gstack-autoplan": 108585,
|
||||
"copilot/gstack-plan-design-review": 109359,
|
||||
"copilot/gstack-plan-devex-review": 114399,
|
||||
"copilot/gstack-plan-eng-review": 143688,
|
||||
"copilot/gstack-review": 104299,
|
||||
"cursor/gstack-autoplan": 107817,
|
||||
"cursor/gstack-plan-design-review": 107901,
|
||||
"cursor/gstack-plan-devex-review": 113669,
|
||||
"cursor/gstack-plan-eng-review": 142278,
|
||||
"cursor/gstack-review": 122771,
|
||||
"factory/gstack-autoplan": 110095,
|
||||
"factory/gstack-plan-design-review": 110999,
|
||||
"factory/gstack-plan-devex-review": 117032,
|
||||
"factory/gstack-plan-eng-review": 145386,
|
||||
"factory/gstack-review": 126544,
|
||||
"gbrain/gstack-autoplan": 108224,
|
||||
"gbrain/gstack-plan-eng-review": 124923,
|
||||
"gemini/gstack-autoplan": 108375,
|
||||
"gemini/gstack-plan-design-review": 109187,
|
||||
"gemini/gstack-plan-devex-review": 114227,
|
||||
"gemini/gstack-plan-eng-review": 143521,
|
||||
"gemini/gstack-review": 104121,
|
||||
"hermes/gstack-autoplan": 108229,
|
||||
"hermes/gstack-plan-eng-review": 124876,
|
||||
"kiro/gstack-autoplan": 107591,
|
||||
"kiro/gstack-plan-design-review": 107747,
|
||||
"kiro/gstack-plan-devex-review": 113521,
|
||||
"kiro/gstack-plan-eng-review": 142140,
|
||||
"kiro/gstack-review": 122595,
|
||||
"openclaw/gstack-autoplan": 108047,
|
||||
"openclaw/gstack-plan-eng-review": 123422,
|
||||
"opencode/gstack-autoplan": 108566,
|
||||
"opencode/gstack-plan-design-review": 109215,
|
||||
"opencode/gstack-plan-devex-review": 114277,
|
||||
"opencode/gstack-plan-eng-review": 143547,
|
||||
"opencode/gstack-review": 123393,
|
||||
"slate/gstack-autoplan": 107704,
|
||||
"slate/gstack-plan-design-review": 107824,
|
||||
"slate/gstack-plan-devex-review": 113595,
|
||||
"slate/gstack-plan-eng-review": 142209,
|
||||
"slate/gstack-review": 122683
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import { freeTextFileBash } from '../../scripts/resolvers/free-text-file';
|
||||
|
||||
/** /ship Step 14.5's own product-tree record: the path, the Entry's reset and the shared exclude line that keeps it out of git. */
|
||||
export const DOCS_AUDIT_RECORD = '.gstack/tmp/docs-audit.json';
|
||||
export const DOCS_AUDIT_RESET = `rm -f ${DOCS_AUDIT_RECORD}`;
|
||||
export const DOCS_AUDIT_RESET = `rm ${DOCS_AUDIT_RECORD} 2>/dev/null || true`;
|
||||
/** The reset Step 14.5 printed before Codex-safe cleanup (GST-3364); captured runs replay it. */
|
||||
export const DOCS_AUDIT_RESET_FORCED = `rm -f ${DOCS_AUDIT_RECORD}`;
|
||||
export const DOCS_TMP_EXCLUDE = freeTextFileBash([]).split('\n').find(line => line.startsWith('_EX='))!;
|
||||
/** The paths the Step 14.5 continue path may create in the product tree: the record, its directories and git's exclude file. */
|
||||
export const DOCS_AUDIT_RECORD_PATHS = ['.gstack', '.gstack/tmp', DOCS_AUDIT_RECORD, '.git/info/exclude'];
|
||||
|
||||
@@ -5,7 +5,7 @@ import { observeQAWrites, type QAWriteObservation } from './qa-functional-observ
|
||||
import { nativeCalls } from './qa-checkpoint-evidence';
|
||||
import type { SkillTestResult } from './session-runner';
|
||||
import { DOC_PATH, type DocsScenario, type fixtureDocs } from './docsync-fixture';
|
||||
import { docsNativeInterface, DOCS_AUDIT_RECORD, DOCS_AUDIT_RECORD_PATHS, DOCS_AUDIT_RESET, DOCS_TMP_EXCLUDE, docsCapsCommand } from './docsync-interface';
|
||||
import { docsNativeInterface, DOCS_AUDIT_RECORD, DOCS_AUDIT_RECORD_PATHS, DOCS_AUDIT_RESET, DOCS_AUDIT_RESET_FORCED, DOCS_TMP_EXCLUDE, docsCapsCommand } from './docsync-interface';
|
||||
import { sliceBetween } from './skill-fixture';
|
||||
import { readOnlyCommandAllowed } from './read-only-commands';
|
||||
|
||||
@@ -253,7 +253,7 @@ export function docsCommandAllowed(command: string, fixture: ReturnType<typeof f
|
||||
const text = command.trim();
|
||||
if (docsPreambleCommands(fixture).some(block => block.trim() === text)) return true;
|
||||
// The section prints the cap gate with the ~/.claude/skills/gstack prefix; in the fixture HOME is fixture.home, so that form names the same installed binary.
|
||||
if (text === DOCS_TMP_EXCLUDE || text === DOCS_AUDIT_RESET || text === docsCapsCommand(fixture.skills.split(path.sep).join('/')) ||
|
||||
if (text === DOCS_TMP_EXCLUDE || text === DOCS_AUDIT_RESET || text === DOCS_AUDIT_RESET_FORCED || text === docsCapsCommand(fixture.skills.split(path.sep).join('/')) ||
|
||||
(text === docsCapsCommand('~/.claude/skills/gstack') && fixture.skills === path.join(fixture.home, '.claude/skills/gstack'))) return true;
|
||||
if (readOnlyCommandAllowed(text, docsReadOnlyScope(fixture)) || docsComposedReadAllowed(text, fixture)) return true;
|
||||
const insert = /^cat (['"]?)([^\s'"]+)\1 >> (['"]?)([^\s'"]+)\3$/.exec(text);
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('/open-gstack-browser daemon liveness', () => {
|
||||
expect(TMPL).not.toMatch(/\bkill\b[^\n]*(_OLD_PID|\$\w*PID)/);
|
||||
expect(TMPL).not.toMatch(/kill -9/);
|
||||
expect(TMPL).not.toMatch(/grep -o '"pid":/);
|
||||
expect(TMPL).not.toMatch(/rm -f[^\n]*browse\.json/);
|
||||
expect(TMPL).not.toMatch(/\brm\b[^\n]*browse\.json/);
|
||||
});
|
||||
|
||||
test('Step 0 probes with $B status without auto-starting a daemon, before any connect', () => {
|
||||
|
||||
@@ -98,7 +98,7 @@ describe("#2679: skill-content mktemp guards", () => {
|
||||
expect(body).toMatch(/mv "\$INSTALL_DIR\.bak" "\$INSTALL_DIR"/);
|
||||
// The backup rm must live inside the success branch, not after the block.
|
||||
const block = body.slice(body.indexOf('if mv "$TMP_DIR/gstack"'));
|
||||
const successRm = block.indexOf('rm -rf "$INSTALL_DIR.bak"');
|
||||
const successRm = block.indexOf('rm -r "$INSTALL_DIR.bak"');
|
||||
const elseBranch = block.indexOf("else");
|
||||
expect(successRm).toBeGreaterThan(-1);
|
||||
expect(successRm).toBeLessThan(elseBranch);
|
||||
|
||||
@@ -407,7 +407,7 @@ describe('the /ship commands carry the targeted record to the receipt (GST-464)'
|
||||
expect(section('handoff')).toContain(`When Step 11 saved \`${recordPath}\`, add \`--review-targeted @${recordPath}\` to that write.`);
|
||||
expect(fs.readFileSync(path.join(ROOT, 'ship', 'DRIVER.md'), 'utf8')).toContain('[--review-targeted @<f>] --body <body>');
|
||||
const entry = /Every entry also runs\n`([^`]+)`/.exec(section('review-army'))?.[1];
|
||||
expect(entry).toContain(`rm -f ${recordPath}`);
|
||||
expect(entry).toContain(`rm ${recordPath} 2>/dev/null || true`);
|
||||
|
||||
const repo = makeFixtureRepo({ prefix: 'targeted-wire-' });
|
||||
repos.push(repo);
|
||||
|
||||
@@ -218,7 +218,7 @@ test('a repository without a version source or CHANGELOG ships with one skipped
|
||||
|
||||
test('Step 14.5 runs the doc caps before the verification gate and records the audit for the receipt, with the owner exception shape (E11)', () => {
|
||||
// The caps come from origin/<base>'s policy (a branch cannot raise its own cap), and the per-invocation record is cleared before the first launch.
|
||||
expectOrdered(docsTemplate, ['rm -f .gstack/tmp/docs-audit.json', '### Continue or recover', 'gstack-ship-receipt docs-caps --base <base>', 'never the\nbranch\'s copy', '`DOCS_CAP: <path> <bytes>/<max> ok|over`', 'write the receipt\'s record to `.gstack/tmp/docs-audit.json`', '## Blocked recovery'], 'ship documentation section');
|
||||
expectOrdered(docsTemplate, ['rm .gstack/tmp/docs-audit.json 2>/dev/null || true', '### Continue or recover', 'gstack-ship-receipt docs-caps --base <base>', 'never the\nbranch\'s copy', '`DOCS_CAP: <path> <bytes>/<max> ok|over`', 'write the receipt\'s record to `.gstack/tmp/docs-audit.json`', '## Blocked recovery'], 'ship documentation section');
|
||||
expectAbsent(docsTemplate, ['docs-caps --policy .gstack/ship-policy.json'], 'ship documentation section cap source');
|
||||
expectTokens(docs, ['`DOCS_CAP: none declared`', '"status":"updated|current"', '"status":"blocked"', '"exception":{"accepted_by"', '`DOCS_AUDIT_BLOCKED`', 'An unattended run has no owner to accept: it stops here.'], 'ship documentation section');
|
||||
const compose = between(prTemplate, 'Handoff record first', '**Existing open PR/MR**');
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"bytes": 105,
|
||||
"why": "Codex-safe temp cleanup: rm without -f (GST-3364)"
|
||||
}
|
||||
@@ -171,7 +171,7 @@ describe('ship parent decision rules', () => {
|
||||
|
||||
test('the rejection step removes new rejected files and reports tracked ones for a hunk revert', () => {
|
||||
const start = shipSection.indexOf(' REJECTED_FILE="$(git rev-parse');
|
||||
const end = shipSection.indexOf(' rm -f "$REJECTED_FILE"\n', start) + ' rm -f "$REJECTED_FILE"\n'.length;
|
||||
const end = shipSection.indexOf(' rm -- "$REJECTED_FILE"\n', start) + ' rm -- "$REJECTED_FILE"\n'.length;
|
||||
const block = shipSection.slice(start, end).split('\n').map(line => line.replace(/^ {3}/, '')).join('\n');
|
||||
expect(block).toContain('<rejected-file-name>');
|
||||
expect(block).toContain('done < "$REJECTED_FILE"');
|
||||
|
||||
Reference in new issue
Block a user