fix(trekexecute): run_seen is kept in progress.json and reported on every path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
27280ca8cb
commit
33ef2c1b3a
4 changed files with 70 additions and 2 deletions
2
tests/fixtures/jsonl-schemas.md
vendored
2
tests/fixtures/jsonl-schemas.md
vendored
|
|
@ -22,7 +22,7 @@
|
|||
| trekbrief-stats | ts, task, slug, mode, interview_turns, review_iterations, brief_quality, research_topics, auto_research, auto_result, intent_approved, project_dir, order_id, order_claimed_at, order_reason | commands/trekbrief.md (orchestrator-emit Phase 7; order_* added by lib/stats/stats-append.mjs) | trekbrief.md:1141-1165 | profile, phase_models, profile_source | none |
|
||||
| trekresearch-stats | ts, question, mode, scope, engine, slug, project_dir, brief_path, dimensions, dimensions_baseline, dimensions_baseline_preserved, effort, conv_turns, empty_turns, unique_sources, agents_local, agents_external, gemini_used, confidence, contradictions, open_questions | lib/stats/stats-append.mjs (trekresearch.md Stats tracking) | trekresearch.md:829-862 | profile, phase_models, parallel_agents, external_research_enabled, profile_source | none |
|
||||
| trekplan-stats | ts, task, mode, slug, brief_path, project_dir, codebase_size, codebase_files, agents_deployed, deep_dives, research_briefs_used, research_scout_used, critic_verdict, guardian_verdict, outcome | lib/stats/stats-append.mjs (trekplan.md Phase 12) | trekplan.md:1307-1335 | profile, phase_models, parallel_agents, profile_source | none |
|
||||
| trekexecute-stats (Phase 9 record) | ts, plan, plan_type, mode, result, steps_total, steps_passed, steps_failed, steps_skipped, failed_at_step | lib/stats/stats-append.mjs (trekexecute.md Phase 9) | trekexecute.md:2973-2995 | profile, phase_models, profile_source | none |
|
||||
| trekexecute-stats (Phase 9 record) | ts, plan, plan_type, mode, result, steps_total, steps_passed, steps_failed, steps_skipped, failed_at_step | lib/stats/stats-append.mjs (trekexecute.md Phase 9) | trekexecute.md:2982-3004 | profile, phase_models, profile_source | none |
|
||||
| trekexecute-stats (autonomy events) | ts, event, known_event, payload | lib/stats/event-emit.mjs `emit()` | event-emit.mjs:78-99 | payload.profile, payload.phase_models, payload.profile_source | none |
|
||||
| trekexecute-stats (PostToolUse Bash) | ts, session_id, command_excerpt, duration_ms, success | hooks/scripts/post-bash-stats.mjs (Bash PostToolUse) | post-bash-stats.mjs:42-54 | none (hook is plugin-level, not profile-aware) | command_excerpt (CWE-212) |
|
||||
| trekreview-stats | ts, slug, verdict, counts (BLOCKER/MAJOR/MINOR/SUGGESTION), reviewed_files_count, mode, duration_ms | lib/stats/stats-append.mjs (trekreview.md Phase 8) | trekreview.md:643-693 | profile, phase_models, profile_source | none |
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@
|
|||
// `auto_result: manual`.
|
||||
// K2 /trekbrief's Step 6a "Cancel — do manual" row runs Phase 7 with
|
||||
// `auto_result: cancelled`, like the sentence after the table.
|
||||
// E14 /trekexecute keeps `run_seen` in the progress file (template, field
|
||||
// table, Phase 7) and Phase 8 reads it from there, so the resume and
|
||||
// multi-session paths report it; Handover 5 lists it as optional.
|
||||
// E17a The two /trekresearch wave 2 sentences on outbound queries are pinned
|
||||
// exactly (red under the E17a mutation).
|
||||
// E17b The deep-research adapter says where wave 2's contrarian findings merge.
|
||||
|
|
@ -357,6 +360,61 @@ test('[DJ2] the high-effort loop names the model for a turn that spawns', () =>
|
|||
assert.doesNotMatch(loop, /model: "opus"/, 'the per-turn protocol pins a spawn to model: "opus"');
|
||||
});
|
||||
|
||||
// --- E14 ---------------------------------------------------------------------------
|
||||
|
||||
/** The progress-file template of /trekexecute's Phase 3, parsed as JSON. */
|
||||
function progressTemplate() {
|
||||
const block = between('commands/trekexecute.md', '### Progress file schema', '**The step-loop fields');
|
||||
const m = block.match(/```json\n([\s\S]*?)\n```/);
|
||||
assert.ok(m, 'the Progress file schema section holds no ```json block');
|
||||
return JSON.parse(m[1]);
|
||||
}
|
||||
|
||||
test('[E14] the progress template carries run_seen', () => {
|
||||
const tpl = progressTemplate();
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(tpl, 'run_seen'),
|
||||
'the progress template has no top-level run_seen field');
|
||||
assert.equal(tpl.run_seen, null, `the progress template's run_seen is not null: ${JSON.stringify(tpl.run_seen)}`);
|
||||
assert.ok(!Object.prototype.hasOwnProperty.call(tpl.steps['1'], 'run_seen'),
|
||||
'run_seen sits in the per-step record, not at the top level');
|
||||
});
|
||||
|
||||
test('[E14] the field table describes run_seen', () => {
|
||||
const table = between('commands/trekexecute.md', '**The step-loop fields', '**The coupling fields');
|
||||
const rows = table.split('\n').filter((l) => l.startsWith('| `run_seen` |'));
|
||||
assert.equal(rows.length, 1, `the step-loop field table must hold exactly one run_seen row; found ${rows.length}`);
|
||||
const cells = rows[0].split(' | ');
|
||||
assert.match(cells[1], /^Phase 7$/, `the run_seen row is not written in Phase 7: ${rows[0]}`);
|
||||
assert.match(rows[0], /Claude Code's (built-in )?`run`/, `the run_seen row does not say it is what Claude Code's run showed: ${rows[0]}`);
|
||||
assert.match(rows[0], /`null` = not run/, `the run_seen row does not say null = not run: ${rows[0]}`);
|
||||
});
|
||||
|
||||
test('[E14] Phase 8 reads run_seen from progress.json', () => {
|
||||
const p7 = between('commands/trekexecute.md', '### End to end — "run the thing"', '### Architecture rules (K5)');
|
||||
const rec = sentencesWith(p7, 'Record `run_seen`');
|
||||
assert.equal(rec.length, 1, `Phase 7 must hold one "Record \`run_seen\`" sentence; found ${rec.length}`);
|
||||
assert.match(rec[0], /\bin the progress file\b|\bto the progress file\b|`progress\.json`/,
|
||||
`Phase 7 records run_seen without writing it to the progress file: ${rec[0]}`);
|
||||
const p8 = between('commands/trekexecute.md', '## Phase 8 — Final report', '## Phase 9 — Stats tracking');
|
||||
const hits = sentencesWith(p8, '`run_seen`');
|
||||
const ok = hits.find((s) => /\bread\b|\breads\b/.test(s)
|
||||
&& /progress file|`progress\.json`/.test(s)
|
||||
&& /\*\*Seen with `run`:\*\*/.test(s)
|
||||
&& /summary/.test(s)
|
||||
&& /resume/.test(s) && /multi-session/.test(s));
|
||||
assert.ok(ok, `no Phase 8 sentence says the Seen with run line and the summary's run_seen are read from the progress file, so the resume and multi-session paths report it: ${hits.join(' | ')}`);
|
||||
});
|
||||
|
||||
test('[E14] Handover 5 lists run_seen as optional', () => {
|
||||
const h5 = between('docs/HANDOVER-CONTRACTS.md', '## Handover 5 ', '## Handover 6 ');
|
||||
const rows = h5.split('\n').filter((l) => l.startsWith('| `run_seen` |'));
|
||||
assert.equal(rows.length, 1, `Handover 5 must hold exactly one run_seen row; found ${rows.length}`);
|
||||
const cells = rows[0].split(' | ');
|
||||
assert.equal(cells[2], 'optional', `the run_seen row's Required cell is not "optional": ${rows[0]}`);
|
||||
assert.match(rows[0], /additive/, `the run_seen row does not say the field is additive: ${rows[0]}`);
|
||||
assert.match(rows[0], /Phase 7/, `the run_seen row does not say Phase 7 records it: ${rows[0]}`);
|
||||
});
|
||||
|
||||
// --- E17a / E17b / Da / E18a / Db --------------------------------------------------
|
||||
// E17a, E18a and Db are already right at be0b631; their tests are proven red
|
||||
// under the E17a, E18a and Db entries of tests/fix-round-4-5b-mutations.mjs.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue