Skip to content

Share prima's envelope tail and give step-file names one owner - #174

Open
DavertMik wants to merge 5 commits into
mainfrom
advisor/034-prima-envelope-consolidation
Open

Share prima's envelope tail and give step-file names one owner#174
DavertMik wants to merge 5 commits into
mainfrom
advisor/034-prima-envelope-consolidation

Conversation

@DavertMik

Copy link
Copy Markdown
Contributor

prima's three envelope builders each repeated the instance/status/artifacts tail and depended on an invisible ordering rule — await saveStatus before reading a mutable this.artifacts field, or silently emit an envelope with no Artifacts section (the exact defect #166 fixed). Now saveStatus returns {hash, artifacts} and one private envelopeTail supplies the shared keys; the field is gone. Adding the next shared envelope field is a one-line change.

The per-step artifact filenames were written twice with nothing enforcing agreement — writeStepFiles by string concatenation, the envelope renderer as a hardcoded literal. Both now derive from one STEP_FILES constant in envelope.ts; the pre-existing test pinning the exact rendered line proves byte-identical output, and a new test asserts the advertised line names every STEP_FILES extension so the writer and the advertisement can no longer drift.

The status CLI action re-implemented the command lifecycle inline and diverged (never called prima.stop()). runPrima gained {browser, record} flags and status routes through it — still browserless (verified: status nonexistent prints a failure envelope, exit 1, Instance line "not running"), now with the same stop/activity handling as every other command. The config/report unification was deliberately skipped: they diverge on stop() and would need a variation flag.

Note: writeSnapshot now calls getMadeRequests() (same list; the getRequests alias is being removed by open PR #173 — this avoids a conflict between the two PRs). And for the maintainer: the main snapshot still writes aria.yml while step files write .aria.yaml — same content kind, two spellings, now visible side by side in envelope.ts; unifying is a deliberate contract change left undone.

Testing: bun test boat/prima/tests tests/integration/prima-smoke.test.ts 146 pass / 1 skip / 0 fail (incl. the new STEP_FILES test), bun test tests/unit 1225 pass / 0 fail, biome format + lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jz7wTcYsy68jUUjcWttd1B

DavertMik and others added 5 commits September 2, 2026 00:57
successEnvelope/failureEnvelope/reportEnvelope each repeated
instance/status/artifacts; collapse them into one envelopeTail()
helper. writeSnapshot/saveStatus now return the artifact paths they
wrote instead of stashing them on a mutable this.artifacts field
that every builder had to read in the right order. Also swap
requestStore().getRequests() for the surviving getMadeRequests()
alias ahead of PR #173 deleting the old name.

Steps 1 and 2 of plan 034 are committed together: Step 1 alone
(saveStatus/writeSnapshot signature change, field deletion) leaves
the three builders referencing a deleted field and treating an
object as a string, so it doesn't compile or pass tests on its own.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
writeStepFiles wrote .aria.yaml/.html/.diff.yaml by string
concatenation while envelope.ts advertised the same names as a
hardcoded literal in its doc line, with nothing enforcing agreement.
Export STEP_FILES next to ARTIFACT_FILES and have both the writer
and the rendered doc line derive from it. Pin the doc line's exact
extensions with a new test so the two can no longer drift silently.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The status action had its own hand-rolled copy of runPrima's
lifecycle and, unlike every other command, never called
prima.stop() — accidental divergence, not a deliberate choice.
Give runPrima a browser/record toggle so status can reuse the
shared path while staying browserless (the point of PR #166) and
skipping session recording, picking up activity-line handling and
prima.stop() for free. Exit code semantics are unchanged.

Verified manually: `prima status nonexistent` returns a failure
envelope, exits 1, and the Instance line shows the browser as not
running.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The assertion checked the whole rendered envelope, so the 'html'
value passed vacuously via base.artifacts's page.html path rather
than the doc line under test. Scope it to the line that advertises
the step-file names, per the plan's test-plan section.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread boat/prima/src/prima.ts
html: await result.combinedHtml(),
screenshot: result.screenshot,
requests: this.bot.requestStore().getRequests(),
requests: this.bot.requestStore().getMadeRequests(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants