Skip to content

Testing-1: acceptance scenario suite for the destructive seams — red on the pre-fix commit, green on main #69

Closed

Description

@abogartz

Part of #68. Reframed after discussion: the primary net is a scenario suite, not unit tests.
The bug that started this (#60's force-restore hole) was missed because I tested the primitive per
mode instead of replaying the situation that broke. A scenario that is red on the broken build and
green on the fix is the artifact; unit tests cannot certify that the whole composes.

Already done — the first two scenarios are written and measured

test/scenarios-consistency.test.ts (uncommitted in the working tree as of filing). Two scenarios,
several OS processes, one store, asserted by conservation over file contents only:

scenario on 357ecaf^ (pre-#60) on main
a snapshot restore while two sessions append: every row a session was told it remembered is in the store or in a snapshot FAIL 6/6 — 10, 12, 13, 13, 14, 16 of 100 rows in neither place pass 4/4
two sessions supersede + one appends the same day file: every supersede lands, no append is clobbered FAIL 6/6 — 26–30 of 60 supersede writes never landed pass 4/4

The file is deliberately written so it runs against an old checkout unchanged — it touches only
APIs that existed before #60 and asserts only observable state (never a result shape). That is what
makes "red before, green after" a command rather than a claim:

wt=/tmp/osi-pre && git worktree add --detach "$wt" 357ecaf^
ln -s "$PWD/node_modules" "$wt/node_modules"
cd "$wt" && bun test ./test/scenarios-consistency.test.ts      # 0 pass / 2 fail

Remaining scope

  1. Commit the file, and keep the red/green proof (with the commit it was run against) in the PR body.
  2. Extend the same shape to the destructive seams that have no scenario today:
    memory_forget and prune under a concurrent appender; viewer delete/edit versus a second
    session; restore in check and merge modes under contention; memory_import landing while
    a session writes; batch supersede (Supersede in batch: decay rewrites and snapshots the store file once per row #61) versus an appender.
  3. Record the technique in the file header (partly done): control the schedule instead of hoping —
    hold the store lock to make "another writer is mid-section" a fact, have a child signal after it
    acquires, use filesystem semantics as discriminators. A scenario that fails "usually" is not a
    regression net; that is why scenario 1 fires six restores rather than one.

Harness rule this file discovered the hard way

Child processes must be pinned to the test's memory root by argv, not inherited env:
Bun.spawn does not pass the parent environment by default. The first version relied on
inheritance and wrote 140 rows into the developer's real ~/.config/opencode/memory store (cleaned
up; the day file it created was pure test output). The child preamble in this file now refuses any
root that is not a temp dir. Every spawned-process test in this repo needs that guard — check
test/helpers/writer.ts callers do the same (they pass the dir explicitly; they lack the guard).

Acceptance

  • Red against the pre-fix commit, green on main, 5/5 each way, output in the PR body.
  • Every destructive seam listed in §2 either has a scenario or has a reason it does not need one.
  • No test in the repo can write outside a temp root — enforced by the guard, not by care.
  • Full suite green, tsc --noEmit and biome check clean, both published benches byte-identical.

Non-goals

Unit-test rewrites (#71) and the mutation instrument (#70).

Activity

  1. added
    test-integrity
    on Oct 23, 2026
  2. changed the title [-]Testing-1: commit the mutation sweep and pin the four invariants it exposed[/-] [+]Testing-1: acceptance scenario suite for the destructive seams — red on the pre-fix commit, green on main[/+] on Oct 24, 2026
  3. abogartz-opencode-self-improvement commented on Oct 24, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.8.10 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    releasedtest-integrity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions