Skip to content

feat(e2e): detect legacy ciphertext rewrites in migration Runs - #1580

Open
tobyhede wants to merge 88 commits into
mainfrom
feat/migration-harness-no-rewrite
Open

tobyhede wants to merge 88 commits into
mainfrom
feat/migration-harness-no-rewrite

Conversation

@tobyhede

@tobyhede tobyhede commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Detect migrations that rewrite legacy encrypted data while reading it. Compare Oracle-owned ciphertext and equality terms before mutation checks, and identify changed items and attributes without exporting their stored values.

Changes

  • Validate complete initial snapshots and classify transport failures as infrastructure and app-caused schema/data failures as behaviour.
  • Compare DynamoDB source/HMAC attributes and PostgreSQL c/hm fields after read-only behavior.
  • Exercise unchanged and rewrite-on-read applications through real Runs with deterministic broker-compatible Fake Migrators.
  • Integrate the reviewed Run baseline, retaining its host command broker, security fixes and private-store administration relays.

Verification

  • Current head cd118e559054873de7a463184da6a9d3dbcb37ce includes signed supervisor repairs 62b09150f and 9ed2ff135. Shared strace output supplies an explicit PID; the first trusted numeric exec identifies the actor independently of temporary strace capability-probe children discovered through /proc.
  • A regression reproduced the missing-actor-exit error with a helper PID before the follow-up fix (one failed, 28 passed). All 31 supervisor tests now pass, including missing initial exec, missing root exit, descendant exits and non-leader exec. Independent review/replays found no blocking issue and retained fail-closed behavior.
  • Base harness: 131 passing tests. Combined adapter head 7e12eaa0d: 220 passing tests, 21 credentialed tests skipped locally. Harness/e2e type checks, scoped Biome and whitespace checks pass. Socket fixtures run with approved sandbox escalation.
  • Current-head isolation CI passed without retry. Current-head Test JS CI passed; all same-head duplicate workflows also passed without retry. The preceding R4 heads repeatedly failed with missing actor-exit records, including adapter E2E; one base isolation retry passed. Those failures remain recorded and are not dismissed as a passing retry.
  • A credential-free 30-invocation probe in the existing Linux image passed. strace 6.1 source confirms temporary helper children precede actor startup, establishing the identity race; exact historical CI scheduling was not retained. No VM restart or full local Docker suite was used.
  • Includes earlier regression-tested fork/PID reuse, denied SO_ERROR and exact Friction Log schema repairs. The earlier combined-suite FIFO timing flake passed its one rerun.
  • Prior-head CI for 8bcacdf10aeadfd6ac984e321a8c0f357bf192eb passed: Test JS 43127026017, 43127025861; Migration harness/isolation 43127026216, 43127025780.
  • Both same-head Test JS runs and both isolation workflow runs completed successfully. Individual test counts were not re-extracted for this branch.
  • Earlier failures were run 43118324627 (unmatched vfork continuation) and run 43126226067 (forbidden getsockopt reported successful). Both parser defects were reproduced and repaired; the exact historical syscall arguments/order were not retained. The successful runs above exercise the supervisor repairs before the Friction Log instruction change.

Related

Closes #1535. Stacked on #1576. Followed by #1581.

Review notes

Signed merge commits preserve existing branch history. The shared no-rewrite implementation supplies complete snapshot validation and attribute-level diagnostics. Live tests require Docker and CipherStash credentials, without model tokens.

Summary by CodeRabbit

  • Tests
    • Expanded migration validation to detect changes to legacy encrypted data and identify affected fields.
    • Added checks for invalid legacy record shapes, missing or added data, duplicate rows, and deleted records.
    • Improved failure reporting by distinguishing migration behavior issues from infrastructure problems.
    • Added coverage for unchanged and rewritten legacy records, snapshot-read failures, and live migration-harness self-tests after the DynamoDB–Postgres crossover suite. The workflow skips the self-test if cancelled.

…tack 1.x

The existing compat suite showed protect-dynamodb 6.0.1 items read and
query under Stack 1.x, but its acceptance run re-encrypted them as a
backfill step, so it never showed the backfill could be skipped. A new
block freezes a protect-dynamodb corpus (single and bulk writes), moves
the app to Stack 1.x alone, decrypts every item, runs every equality
query, writes new items beside the old ones, and then asserts the stored
items are byte-identical to the snapshot.

The stash-dynamodb skill told customers to re-encrypt every item to move
a table to v3. That is not required, so the skill now says re-encryption
is optional and lists the three differences to plan for: boolean
equality lookups, downcase filters, and legacy dataType('json')
attributes.

The legacy client builder and the result unwrapper move to a shared
helper so the cross-store suite can reuse them.
An encrypted scalar is the same two strings in both stores: DynamoDB's
<attr>__source and <attr>__hmac are the c and hm fields of a Postgres
EQL v3 value. The rest of the Postgres value is the version and the
table and column names, none of it secret, so moving a value between
stores is a copy with no key involved.

The new suite pins that in both directions with real protect-dynamodb
6.0.1 and protect 10.2.1 payloads as well as Stack 1.x ones: the EQL v3
column types accept the copied values, the ciphertext arrives
byte-identical, Stack decrypts it, SQL equality queries and DynamoDB
search hashes still match, and protect-dynamodb 6.0.1 reads items copied
from Postgres.

It needs CS_* credentials and DATABASE_URL, so it runs from its own
config as test:protect-crossover, and the e2e-tests job now starts a
Postgres through integration-db for it.
The boolean-equality test accepted any encryptQuery failure, so a service
outage passed it. It now asserts the "no indexes configured" refusal
Stack gives a storage-only column, after a control query on the same
client succeeds. The snapshot test claimed more than it could show:
nothing in its block writes to the table, so it is renamed and its
comments say it pins only that reads and queries left the stored items
unchanged.

The cross-store suite sorted results with ORDER BY, which follows the
database collation, so it now sorts in JavaScript. The protect-dynamodb
decrypt check uses toEqual like every other decrypt check, and the
raw-payload block goes through the same two copy functions as the rest
of the file instead of a third, slightly different one.

In CI the cross-store suite was skipped whenever the protect-dynamodb
step failed. Both new steps now run on !cancelled().

The stash-dynamodb skill said Stack reads protect-dynamodb items as they
are while the paragraph above still required { storedEqlVersion: 2 }.
It now says a top-level scalar item reads either way and the option is
needed for a grouped v2 field declared by its bare leaf name. The advice
to REMOVE a stale __hmac on in-place updates now covers every domain
that writes no __hmac, not only Boolean.
A v2 downcase column mapped to TextEq is hashed case-sensitively by
Stack, so a mixed-case write gets an __hmac that a lowercase query never
matches. The skill told customers to lowercase only the query value. It
now says to lowercase every write too, notes that this drops the
original casing from the ciphertext, and suggests a separate attribute
for the original when the app needs it. The write-path behaviour is
already pinned by the 'downcase on the write path' test.
… its tests

Customers on @cipherstash/protect 10.2.1 and @cipherstash/protect-dynamodb
6.0.1 need a written path to Stack 1.x that says plainly what changes and
what does not. The guide walks the upgrade as a code-only change over
untouched items, and backs every claim with the name of the compat or
crossover test that proves it.

A guide that cites tests drifts the moment a test is renamed, so
protect-upgrade-guide.e2e.test.ts fails when a cited test name no longer
exists in its suite, or when the Protect versions the guide names differ
from the ones the suites install. It needs no credentials and runs in the
default e2e suite; the live suites still prove the claims themselves.
…ew claims

The step 4 encryptQuery sample read `term.data.hm`, which does not compile:
the result type also covers ciphertexts, strings and null. It now narrows
through an `hmacOf` helper.

Step 2 now names CS_CTS_HOST and CS_ZEROKMS_HOST (Protect 10.2.1 needed
them outside ap-southeast-2, and Stack still honours them), says to carry
over a configured keyset, and fixes a "done" check that `protect-ffi`
always tripped. The unindexed-column row is limited to text, which is all
the suite tests.

Tests: fractional DoubleEq round trip, the Protect JSON schema failing on a
Stack Json rewrite, the JSON gap under both read options, an IntegerEq
assertion the test name already claimed, and a lockfile check on the
customer's protect-ffi and schema versions.
`result.data.hm` does not type-check: encryptQuery's result type also
covers ciphertexts, strings and null. The stash-dynamodb examples now use
an `hmacOf` helper that narrows to the equality term and throws when there
is none.
… guide

pnpm remove refuses a package the manifest does not declare and then
removes nothing, so naming the transitive @cipherstash/schema failed step 2
for any app that only declared protect and protect-dynamodb. The guide test
now pins the remove command to those two packages.

The fractional DoubleEq compat test also asserts the legacy HMAC is a
string, so it cannot pass when both sides return undefined.
The upgrade guide is tied to compatibility tests, but nothing checks that
a reader can follow it. The migration harness (#1540) will have an agent
upgrade a small Protect.js app using only the guide, judge the result
with deterministic checks, and revise the guide from what went wrong.

This lands the groundwork the tickets build on: the harness glossary,
linked from CONTEXT-MAP.md, and the fixture app that every Run starts
from, which stores encrypted customers in DynamoDB and copies three
columns into Postgres EQL v3. The Run driver, Oracle and agents follow
in #1534-#1539.
The spec review for #1540 moved the Oracle's execution of migrated code
out of the harness process, so migrated code cannot read the Oracle, its
snapshots or other Runs' credentials. The restricted process that installs
and runs it needs a name the tickets can share.
Preserve the reviewed migration harness contract in the repository so stacked implementation work has a stable decision record. Separate agent execution from deterministic evidence and retain the Run and Iteration acceptance seams.

Refs #1540
Keep the context architecture decision separate from the implementation plan and align the glossary with both. Define attribution, outcome precedence and enforced Editor boundaries so implementation cannot mistake a blocked access for infrastructure failure or an agent error for guide evidence.

Refs #1540
Distinguish denied exploration from proven isolation breaches and specify observable probes, stage outcomes and attribution provenance. Define redacted evidence exports and Editor restrictions so implementation can test the boundaries without claiming semantic guarantees from mechanical checks.

Refs #1540
Define unresolved stage outcomes, observable runtime supervision and evidence mapping so implementation does not infer guide failures from setup errors or agent self-reporting. Keep the dated plan and glossary consistent, with explicit redaction checks and acceptance IDs for the child tickets.

Refs #1540
Keep the architecture and full implementation contract in the context ADR as requested, rather than splitting authority across a separate plan. Preserve all requirements and acceptance decisions for the stacked implementation work.

Refs #1540
Keep each Migrator independent of earlier friction and use one mandatory supervision contract across execution and acceptance. Keep policy in the authoritative ADR, simplify friction identity, and assign isolation proof before application execution. Refs #1540.
Establish the Run seam with explicit stage outcomes and trusted supervision before enabling migration experiments. Add credential-free CI probes so Linux backend and store failures are visible while full Fixture App acceptance remains under review.

Refs #1534
Harness CI must declare workspace build dependencies and matching push and PR path filters to satisfy repository guards. Route its checks through uncached Turbo tasks and format the new backend files so repository lint passes.

Refs #1534
Make behaviour checks distinguish real writes and copies, initialize assigned stores inside App Host, and reject malformed logs or missing oracle checks. Treat lost observers and exited hosts as terminal failures, separate actor policies, and route assigned stores through explicit container networks.

Enable strict checking across the harness and align its documentation and CI inputs. Expanded live isolation and forwarding verification remains pending; no complete credentialed no-op Run is claimed.

Refs #1534
Resolve the CLI root inside its checkout so fixture paths and revision capture use the intended repository. Open agent-provided Friction Logs nonblocking before validating their type, preventing FIFOs from hanging the controller outside actor supervision.

Cover both failures through the CLI and real FIFO regression seams. Refs #1534
Compare Oracle-owned stored ciphertext and equality terms after read-only application checks and before mutations. Report changed item attributes without disclosing stored values. Refs #1535.
Validate complete Legacy Data snapshots before migration and run unchanged and rewrite-on-read applications through isolated real drivers in credentialed CI. Refs #1535.
@changeset-bot

changeset-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 78460c7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The migration harness validates legacy snapshots and compares DynamoDB and PostgreSQL attributes during migration behavior checks. The real driver classifies snapshot-read failures. Tests cover unchanged and rewritten data, and CI invokes the harness self-test.

Changes: Legacy Data No-Rewrite

Layer / File(s) Summary
Validate and compare legacy snapshots
e2e/migration-harness/run/no-rewrite.mjs, e2e/migration-harness/run/record.mjs, e2e/migration-harness/run/migration-checks.mjs, e2e/migration-harness/__tests__/no-rewrite.test.ts
The harness validates the expected baseline and compares DynamoDB and PostgreSQL legacy attributes. The compatibility entry point delegates to the comparison. Tests cover unchanged data and rewritten DynamoDB or PostgreSQL data.
Run the check and classify snapshot failures
e2e/migration-harness/run/real-driver.mjs, e2e/migration-harness/run/snapshot-errors.mjs, e2e/migration-harness/run/real-stores.mjs, e2e/migration-harness/__tests__/review-driver.test.ts
The real driver validates the baseline and compares it with a later snapshot. It classifies snapshot-read errors as infrastructure or behavior failures. Tests cover the reported outcomes.
Exercise no-rewrite cases in tests and CI
e2e/migration-harness/__tests__/no-rewrite-live.test.ts, .github/workflows/tests.yml
Live tests use the real driver to check unchanged and rewritten application data when the required environment is present. The E2E workflow invokes the harness self-test.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HarnessRun
  participant RealDriver
  participant OracleSnapshot
  participant noRewrite
  participant RunReport
  HarnessRun->>RealDriver: Run behavior check
  RealDriver->>OracleSnapshot: Read current snapshot
  OracleSnapshot-->>RealDriver: Return legacy data or read error
  RealDriver->>noRewrite: Compare baseline and current snapshots
  noRewrite-->>RealDriver: Return pass or changed attributes
  RealDriver->>RunReport: Record check result
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: freshtonic

Merge Risk: Low · previous review ce875

The harness change looks sound. One small test-hygiene issue remains: live tests can skip silently when credentials are missing, which could hide a coverage gap. This is safe to merge with awareness.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(e2e): detect legacy ciphertext rewrites in migration Runs" matches the main change. The PR adds a no-rewrite check (no-rewrite.legacy-bytes) that compares DynamoDB and PostgreSQL enc…
Linked Issues check Passed Directly linked issue #1535 is open and its delivery status says the criteria were implemented in #1580. The reviewed diff (merge base 1140bdc to head ce87501) covers the requirements as follows.
…
Out of Scope Changes check Passed The changed files in the whole-PR diff are: .github/workflows/tests.yml (adds the credentialed harness self-test step with deterministic Fake Migrators and HARNESS_LIVE=1); e2e/migration-harness tests…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "feat(e2e): detect legacy ciphertext rewrites in migration Runs" matches the main change. The PR adds a no-rewrite check (no-rewrite.legacy-bytes) that compares DynamoDB and PostgreSQL encrypted attributes before and after read-only behavior, so legacy ciphertext rewrites are detected. The title is specific and follows a conventional commit format. The supporting changes (snapshot error classification, the CI step, and the live test) are secondary to this main purpose.

Full details: Linked Issues check

Explanation

Directly linked issue #1535 is open and its delivery status says the criteria were implemented in #1580. The reviewed diff (merge base 1140bdc to head ce87501) covers the requirements as follows.

[#1535] Oracle no-rewrite layer and baseline comparison: run/no-rewrite.mjs adds noRewrite and validateLegacySnapshot. noRewrite compares DynamoDB __source/__hmac and PostgreSQL c/hm attributes by key. It lists changed keys without exporting stored values. The baseline must contain exactly one Postgres row and at least one encrypted attribute. run/migration-checks.mjs delegates noRewriteCheck to noRewrite and keeps the stable check ID no-rewrite.legacy-bytes.

[#1535] Unchanged app passes and rewrite-on-read app fails: tests/no-rewrite.test.ts covers unchanged and rewritten DynamoDB data, and a rewritten duplicate Postgres row when the original is last. tests/no-rewrite-live.test.ts runs real Runs for the unchanged and rewrite-on-read cases. The live test requires Docker and CipherStash credentials. Its result was not verified here.

[#1535] Snapshot failure classification: run/real-driver.mjs wraps failed current-snapshot reads as 'Oracle snapshot read failed' and sets the infrastructure flag through isSnapshotInfrastructureError (run/snapshot-errors.mjs). review-driver.test.ts covers DynamoDB 5xx/429, connection errors, PostgreSQL class 08 and 57P01-57P03 as infrastructure, and missing objects, invalid casts, deleted tables and unknown failures as behaviour.

[#1535] Mutation Data and setActive excluded from the snapshot: the snapshot projects only encrypted attributes. The diff does not change the snapshot timing. Existing review-driver tests from the prior review still cover this.

The Run mechanics (run.mjs, driver lifecycle, Run Report evidence) are present at the reviewed head through the merge base. #1576 has no current review evidence, so this PASS relies on the code present at head and not on a separate review of #1576. Excluded scope: #1605 (EQL v2 migration), #1536 (Reference Migration assertion) and the guide milestones are outside #1535 and were not required.

Full details: Out of Scope Changes check

Explanation

The changed files in the whole-PR diff are: .github/workflows/tests.yml (adds the credentialed harness self-test step with deterministic Fake Migrators and HARNESS_LIVE=1); e2e/migration-harness tests for no-rewrite, live no-rewrite and review-driver snapshot classification; and e2e/migration-harness/run files no-rewrite.mjs, record.mjs (object helper), snapshot-errors.mjs, migration-checks.mjs, real-driver.mjs and real-stores.mjs. Each change supports the no-rewrite layer or its failure semantics under #1535.

The PR description also mentions Friction Log instruction repair (1140bdc) and supervisor repairs (late fork returns, SO_ERROR handling). Commit 1140bdc is the merge base, so it is not introduced by this PR. The visible diff does not show supervisor or friction-schema files. The diff output was truncated at 16000 bytes after run/no-rewrite.mjs, so the tail of the file list was not directly read. The raw summary lists the remaining changed files, and none of them is unrelated.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 580b8fa2-905a-4c61-8846-81e346c0191f
Commits

Reviewing files that changed from the base of the PR and between 8bcacdf and ce87501.

Files selected for processing: 1

  • e2e/migration-harness/run/real-driver.mjs

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

CI Docker does not publish ports on internal-only bridge networks. Keep trusted disposable stores on dedicated bridges with loopback-only host ports while actor egress stays enforced in its isolated namespace. Refs #1535.
Use the existing Turbo task and loose environment mode for credentialed Run checks so workflow dependency guards pass and credentials reach the live suite. Refs #1535.
Follow the repository test environment convention so documented local env files enable credentialed acceptance cases. Refs #1535.
…stores

A schema or data error on the post-read snapshot (a renamed column, a
dropped table) used to throw, so the Run Report carried one generic
behaviour error and none of the read checks that had already run. The
Mutation Data snapshot was not classified at all, so a reset connection
there became an editor-eligible behaviour failure and discarded the
completed no-rewrite check.

Both reads now go through one classifier. A store outage stays
infrastructure and carries the completed checks, which run.mjs records
as evidence. App-caused damage becomes a failed check -- the no-rewrite
check, or the active-HMAC check for the Mutation Data read -- naming the
error by its SQLSTATE code or HTTP status only, since messages can quote
stored values.
The migration-layer checks could report a pass for migrations the harness
must reject:

- migration.active-hmac-absent read the Mutation Data after the copy checks
  had put the full record twice. A broken setActive that left a stale
  active__hmac had its HMAC replaced by those puts before the snapshot,
  so the check passed. behaviour().mutate() now takes an afterSetActive
  hook and the real driver snapshots the Mutation record there.
- migration.protect-dependencies-absent and migration.endpoint-shim-absent
  read only the Migrator workspace. The App Host executes a separate
  installed copy that npm lifecycle scripts can rewrite, so a script
  restoring the endpoint shim or a Protect import went unseen. Both
  checks now inspect the installed copy too, as ADR-0001 requires.

Regression tests in review-driver.test.ts fail on the previous code.
A failed provision must be an infrastructure outcome that skips every
dependent stage and leaves the Run ineligible for the Editor. The other
setup stages had this test; provisioning did not.
createStoreSet names Docker resources from the first eight characters of
the Run id. `live-${Date.now()}` gives every concurrent Run the same
prefix, and cleanup is registered before creation, so a second Run on
the same daemon could remove the first Run's active container. Use
randomUUID(), as the CLI does.

HARNESS_LIVE=1 asks for these Runs, so a missing CS_* variable now fails
them with the names it needs instead of skipping them silently.
Only no-rewrite-live.test.ts reads HARNESS_LIVE; migration-harness.yml
already runs the other self-test files on harness changes. Drop
!cancelled() so the two ten-minute live Runs do not start after an
earlier step has failed.
The fixture's column set and its notes-has-no-HMAC rule were written out
in validateLegacySnapshot, the Oracle snapshot SELECT and the
review-driver mock. Renaming a column and missing one of them failed
every real Run at initialization-snapshot. legacy-columns.mjs now owns
the table and builds the snapshot query from it, with the key still a
parameter. The fixture app keeps its own copy, since the harness never
imports app code.
The harness installs @cipherstash/stack from npm inside its isolated
containers and never loads the job's native bindings, so the default
success() gate only hid its result behind failures it does not share.
Match the !cancelled() policy of the independent suites above it; the
step still runs only the live file.
Take the mutation snapshot through the classified reader at the setActive hook, preserving earlier Oracle evidence on infrastructure failures. Retain coverage from both review branches.
Keep harness-owned snapshot fixtures aligned with the Oracle projection and HMAC policy so adding or changing a field cannot leave a second schema behind in the driver tests.

Refs #1580
Four isolation paths turned an ordinary Run into the wrong outcome
category:

- The event budget counted every event since the backend was created,
  because draining or clearing events never lowered the counters. A long
  but normal Run could pass the cap and be reported as infrastructure.
  Clearing events now releases their share of the budget.
- A capability proof that failed after the policy-mismatch probe left
  that probe's synthetic forbidden-and-successful event in the buffer.
  The stage drain then reported it as a real isolation violation, the
  highest-precedence outcome. A failed proof now clears its events.
- stdout and stderr frames were decoded one at a time, so a multi-byte
  UTF-8 character split across two 16 KiB supervisor reads became
  U+FFFD. Each stream now has its own StringDecoder, flushed on close.
- An expected cancellation threw when docker kill found the --rm
  container already gone, turning an agent time limit into an
  infrastructure failure. "is not running" and "No such container" now
  count as cancelled.

The capability-probe workspace is also git-ignored, so a job killed
mid-proof cannot leave a world-writable directory to be committed.
- Store snapshot errors taken by the harness itself (the no-rewrite
  comparison and the afterSetActive check) escaped as plain errors, so a
  DynamoDB Local or relay hiccup failed the behaviour stage and made the
  Run Editor-eligible, blaming the guide or the Migrator. Both snapshots
  now go through one helper that rethrows them as infrastructure errors.
- A Migrator that rejected (protocol violation, spawn or execute error)
  discarded its stdout, stderr and tool calls, so the failed Runs most in
  need of diagnosis had no transcript and no agent-tool evidence. The
  rejection now carries them; the driver writes the transcript before
  rethrowing and the Run records agent-tool evidence from the error.
- The oracle workspace copy rewrote relative symlinks, including
  node_modules/.bin, to absolute host paths that point nowhere inside the
  container. The copy now keeps symlinks verbatim.
- The four harness turbo tasks depended on ^build although none of them
  uses a workspace package's build output, so every harness CI job built
  stack, the CLI, wizard and test-kit first, and unrelated build breakage
  could fail it.
…port

Every supervisor access event was inlined into run-report.json as an
evidence record with its own digest. A normal Run (two npm installs and
a Migrator making 100+ tool calls) can produce hundreds of thousands of
events, nearly all routine allowed reads, so the report grew to tens of
megabytes.

The trail cannot simply be filtered: ADR-0001 needs successful allowed
reads of installed documentation to attribute guide-only success, and
needs denials recorded. So each stage's full trail is now written as
NDJSON to isolation-events/<stage>.ndjson beside the report, and the
report carries one isolation-trail evidence record per stage naming the
file, its event count and the SHA-256 of its bytes. Only forbidden or
failed events stay inline. A supervised Run without a trail writer is
refused, and a failed trail write is an infrastructure failure.
installUnmigrated already copied with verbatimSymlinks, but installAppHost
did not, so a relative symlink in the migrated workspace was rewritten to
an absolute host path that does not exist under /workspace in the App Host.

Adds a regression test that fails without the option.
The broker appended raw Buffer chunks to a string, which decodes each
chunk on its own. A multi-byte character split across two chunks became
replacement characters, in a tool request's command as well as in the
recorded stdout and stderr.

Sets utf8 encoding on both streams, as claude-wire.mjs and isolation.mjs
already do, and adds a regression test that splits a character across
two writes.
Merges feat/migration-harness-run. One conflict, in real-driver.mjs: the
base files every Oracle snapshot failure as infrastructure, while this
branch classifies it, so a store outage is infrastructure and app-caused
damage is a failed check. This branch's classification is kept, and the
base's blanket helper is dropped as unused.

The base's snapshot-failure test is adapted to match: it now throws a
status-carrying store error and uses a snapshot this branch accepts as a
legacy record.

@tobyhede tobyhede left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review attestation

Reviewed e704f812 · posted from Codex · GPT-6 · effort unknown

Sources: code-review · GPT-6

Skills: code-review

Findings (2) · 1 major, 1 minor · 2 inline.

id: 'live-no-rewrite',
manifest,
driver,
supervision: isolation,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

major Both credentialed cases throw A supervised Run requires writeIsolationTrail before provisioning. Supply the per-stage trail writer used by the CLI.

Source: code-review · GPT-6

if (connectionCodes.has(error.code)) return true
if (/^[0-9A-Z]{5}$/.test(error.code))
return (
/^08[0-9A-Z]{3}$/.test(error.code) || /^57P0[123]$/.test(error.code)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

minor PostgreSQL capacity errors 53200 and 53300 turn a failed Oracle snapshot into a migration failure eligible for Editor input. Classify these availability errors as infrastructure failures.

Source: code-review · GPT-6

Use the application role for snapshots and bind cleanup to resources acquired by this Run. Reserve the output directory before staging so previous evidence cannot be reused.
Share the isolation trail writer with acceptance tests and attribute PostgreSQL capacity errors to infrastructure.
Base automatically changed from feat/migration-harness-run to main November 23, 2026 01:20

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migration harness: Oracle no-rewrite layer

3 participants