Skip to content

test(connector-opencode): assert the event channel is core's derivation by identity, not one sampled value - #714

Merged
davidfarah2003 merged 2 commits into
mainfrom
fix/601-arming-cell-identity
Aug 24, 2026
Merged

test(connector-opencode): assert the event channel is core's derivation by identity, not one sampled value#714
davidfarah2003 merged 2 commits into
mainfrom
fix/601-arming-cell-identity

Conversation

@davidfarah2003

Copy link
Copy Markdown
Contributor

What

The events-arm suite for the OpenCode connector asserted that the connector's
declared event channel matched core's derivation for one sample principal, by value:

// principal = { owner: "local", actor: "ollie" }
opencodeConnector.eventChannel?.(principal) === eventChannel(principal)

That is the right comparison at the wrong strength. A re-implementation of the
derivation that returned the correct string for ollie and diverged elsewhere would
pass the cell unchanged. What makes the property true in the shipped connector is not
the sampled value: it is that the connector's field IS core's function rather than a
copy, so the channel the manager mints the grant for and the subject the session
publishes to are decided in exactly one place.

This adds the function-identity assertion:

opencodeConnector.eventChannel === eventChannel

mirroring the assertion the codex events-arm suite already carries. The existing
by-value cell stays, because it additionally proves the derivation is keyed on the
principal rather than the display name.

Test-only. The property is already true; no behaviour changes. Closes #601.

Proof

  • Baseline: smoke:opencode-events-arm reports 16 passed, 0 failed.
  • Mutation, cloning the assignment to eventChannel: (p) => eventChannel(p): KILLED,
    red on the named assertion "not a re-implementation"; mutation-proof reports the
    suite discriminates.
  • The gap shown directly: under that same clone, exactly one cell fails, the new
    identity cell, and the by-value cell is among the 15 that pass. The by-value cell
    alone could not have caught the clone; the new cell does.
  • pnpm typecheck exits 0.

Sibling gap, filed separately

The claude-code events-arm suite has the identical weakness (it asserts the declared
channel by value on one principal and no cell asserts function identity). Rather than
widen this PR past the issue it closes, that is filed as #713 so the weakness is on the
record with its reason, which is the disposition #601 itself argued for.

davidfarah2003 and others added 2 commits August 19, 2026 15:30
…on by identity, not one sampled value

The events-arm suite proved the OpenCode connector declares an event channel and
that its derivation matched core's for one sample principal, by value. A
re-implementation that returned the right string for that principal would pass
unchanged; nothing asserted the connector's field IS core's function rather than a
copy of it, which is the property that keeps the grant the manager mints and the
subject the session publishes to deciding the channel in one place.

Add the function-identity assertion, mirroring the codex events-arm suite, so the
cell fails the moment the assignment is replaced by a re-implementation. The
existing by-value cell stays: it additionally proves the derivation is keyed on the
principal. Test-only; the property is already true in the shipped connector.

Closes #601.
…s discrimination

The inline check name read as if the value cell catches a clone; it does
not. Under a clone that reproduces the subject for one principal, the value
cell passes and only the function-identity assertion fails. The block
comment above already stated this correctly; align the cell label with it.
Label only, no behavior change.
@davidfarah2003
davidfarah2003 merged commit 632840a into main Aug 24, 2026
16 checks passed
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.

The event-channel declaration cell samples one principal, so a clone would pass it

1 participant