Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Documentation

- Establish the **Split Screen peer floor of 1.10.6** (issue #40). Piano is standalone-compatible, but focused multi-panel MIDI routing depends on Split Screen's six-method `window.slopsmithSplitscreen` focus API, and the repo carried two unresolved numbers for it: the earliest auditable provider snapshot (1.10.6, commit `54db8d2`) and a later version a maintainer had hand-verified (1.14.5). The six methods are byte-identical at those two snapshots, and all 26 version runs in between (1.10.6 → 1.14.21) carry them, so 1.10.6 is published as the floor — superseding the 1.14.5 "checked floor" note below. Only 1.14.20 carries a git tag, so the manifest `version` is the identity, the same rule core follows. README.md's "Requirements" gains a fourth entry declaring Split Screen as an *optional peer*: not needed for the board, MIDI input, or scoring, but required for focused multi-panel MIDI routing, with the six helper methods tabled and the degraded behavior on a partial or older surface stated as behavior rather than as "fail-soft" — focus stops being authoritative (routed notes and their scoring follow panel mount order, not the panel the user is looking at) and chrome falls back to the shared player mount and control rail. `tests/host-compat.test.js` pins every state — absent, partial in each of its two shapes, the 1.10.6 floor, and the current 1.14.21 surface. The current-surface test drives each panel through its whole lifecycle (mount, draw, resize, the first settings open, a host canvas replacement, then `destroy()`) before reading the helper's call log, so a dependency on a method the floor does not publish fails the test from whichever code path introduced it. The two partial fixtures pin that the three wrappers (`panelChromeFor` / `settingsAnchorFor` / `isCanvasFocused`) are all-or-nothing on the full-surface check while the subscribe/unsubscribe pair is gated only on its own two halves existing — they degrade identically and are consumed differently. The floor is not recorded in `plugin.json`: feedBack's manifest schema has no feature-scoped optional-dependency field and closes `capabilities.*` to unknown keys (audited at `af29496`), so the tests are the executable record until a host learns to read one.
- Detect core drifting from the declared minimum-host surface (issue #43): `tools/verify-host-surface.js` clones core, diffs its `VERSION` against the two audited refs (`803bd0c` = `0.3.0-alpha.1`, `3a4dd7a` = `0.3.0-alpha.2`), and probes current upstream `main` as well as both audited refs for every API the README host table declares. `tests/host-compat.test.js` pins the plugin's behavior against hand-written fixtures, so it structurally cannot notice core renaming `logicalSourceKey` or dropping `ui.playerControlSlot()`; this script closes that gap from the other side. It needs the network, so `.github/workflows/host-surface-drift.yml` runs it on a schedule and on `workflow_dispatch`, mirroring `sri-drift.yml`. The network-free half runs per-PR: four new tests fail if a probe has no README row, a README row has no probe, a ref or `VERSION` in the checker is not cited in the README, or `screen.js` subscribes to a host event nothing probes. They read `SURFACE` and `AUDITED_REFS` out of the tool and compare both directions on the same normalized token, so a probe for a name the README no longer claims fails as loudly as a README row nothing probes. `tests/host-surface-checker.test.js` covers the CLI's non-zero exit against a reachable local ref, first-party file filtering, and a probe that hits, one that misses on a present file, and one whose path core no longer has. A `VERSION` that is missing or renamed at a ref is reported in the tool's own format — `could not read VERSION at <ref>` — and the refs after it are still audited, instead of the run dying on a raw `git show` trace.
- Declare and document the tested minimum host, **feedBack core v0.3.0-alpha.1** (issue #39) — the first core commit whose `VERSION` reads `0.3.0-alpha.1` (`803bd0c`), and the earliest snapshot whose source carries every API this plugin consumes. Core publishes no git tags, so `VERSION` is the identity to compare against. README.md's "Requirements" section now splits the three independent prerequisites: the core version (with a per-API surface table, marking `window.highway.resize()` as optional), Web MIDI browser/permission support, and the WebAudioFont network/audio prerequisites for the built-in synth. Documents the visualization-only fallback (no `midi-input` domain, or a non-v1 one, still renders) as a supported state rather than an error. This is a source-level compatibility floor, not a runtime certification of every older snapshot.
- Add `tests/host-compat.test.js`: the executable half of the minimum-host declaration. Its fixtures reproduce the alpha.1 host surface (event bus, chart bundle, `midi-input` v1 domain, optional splitscreen helper) and pin mount/draw/resize/destroy, MIDI discovery and routing, session release, pause/seek/song change, the visualization-only and no-event-bus fallbacks, and split-panel focus routing. The 13 tests run only against those fixtures, never a live core; the matching `0.3.0-alpha.2` (`3a4dd7a`) evidence is a source audit of the same APIs, whose surface is a superset of alpha.1's.
Expand Down
73 changes: 59 additions & 14 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,24 @@ Under splitscreen, multiple panels can run a Piano instance simultaneously,
but only one keyboard input source (MIDI, or the on-screen keyboard) should
ever be "live" at a time — the one the user is currently looking at/using.
`window.slopsmithSplitscreen` exposes a small helper surface for this;
Piano is the only plugin observed consuming it end-to-end. The full
six-method surface (`isActive`/`isCanvasFocused`/`panelChromeFor`/
`settingsAnchorFor`/`onFocusChange`/`offFocusChange`) is verified present
as of `feedback-plugin-splitscreen` **v1.14.5**; not a hard requirement
per the full-surface-validation design described next — but this is the
minimum version this integration has actually been checked against.
Piano is the only plugin observed consuming it end-to-end.

Split Screen is an **optional peer** — standalone Piano consumes none of it,
and nothing in this integration is a precondition for the board to render.
The peer floor is **`feedBack-plugin-splitscreen` 1.10.6** — the repository's
earliest auditable snapshot (commit `54db8d2`) — where the full six-method
surface (`isActive` / `isCanvasFocused` / `panelChromeFor` /
`settingsAnchorFor` / `onFocusChange` / `offFocusChange`) is already
published. It was audited at that snapshot and at `main` (1.14.21,
`aefac76`): the six methods are byte-identical, and so is every version run
in between (26 of them, 1.10.6 → 1.14.21). The plugin calls nothing beyond
the six — current splitscreen publishes eight more, and the surface map in
`tests/host-compat.test.js` fails if a post-floor method is ever required.
Splitscreen tags only 1.14.20, so the manifest `version` is the identity to
compare against, the same rule core follows. **The floor is a two-snapshot
source audit plus four contract fixtures, not a runtime certification of the
builds in between** — a partial surface is a supported state, not a
violation of the floor.

`_ssActive()` (see "Splitscreen helper wrappers" in `screen.js`) validates
the **entire** surface this plugin needs before treating splitscreen as
Expand All @@ -96,6 +108,29 @@ active," which falls the plugin back to the main-player single-instance
fast path rather than reaching a half-broken state where focus never lands
on any instance and MIDI routing silently dies.

The fallback is fail-soft, but calling it merely *safe* undersells it. What
actually changes under a real split-panel host:

- **Focus stops being authoritative.** `_ssIsCanvasFocused()` returns `true`
unconditionally, so every instance claims focus and the module-level
`_activeInstance` routing slot lands on whichever panel initialised last.
Played notes and their scoring go to that panel, not the one the user is
looking at. Nothing is dropped and nothing throws.
- **Chrome falls back to the shared player.** `_ssPanelChrome()` and
`_ssSettingsAnchor()` return `null`, so the overlay canvas and settings
panel mount against `#player` (`_createOverlayCanvas`,
`_createSettingsPanel`) and the gear docks in `ui.playerControlSlot()` /
`#player-controls` (`_injectSettingsGear`) — N panels stack N overlays and
N gears in the same place.
- **Chrome and focus are all-or-nothing.** `_ssActive()` gates the three
wrappers, so a partial surface is never asked for chrome, anchoring or
focus — only `isActive()` is called for those. The subscribe/unsubscribe
pair is *not* gated on `_ssActive()`: `init()`/`destroy()` check only that
both halves exist, so a surface missing something *other* than
`offFocusChange` still subscribes (and still releases, symmetrically). What
that pair has to guarantee is symmetry, not authority — a listener firing
while every panel reports itself focused changes nothing. Pinned by both
partial-surface fixtures in `tests/host-compat.test.js`, one per shape.
- **Subscribe** — `init()` calls `ss.onFocusChange(_onFocusChange)` only
when *both* `onFocusChange` and `offFocusChange` exist on the helper. A
subscribe without a matching unsubscribe path would leak the listener
Expand Down Expand Up @@ -129,7 +164,13 @@ splitscreen panel is live" behavior, copy this pattern (full surface
validation, subscribe/unsubscribe symmetry, the destroyed-instance guard)
rather than reaching for `window.slopsmithSplitscreen` directly — the
partial-surface fallback is what keeps this safe across splitscreen
version skew.
version skew. **The floor is recorded in prose only.** feedBack's manifest
schema (`docs/plugin-manifest.schema.json`) has no feature-scoped
optional-dependency field, and a `capabilities.*` block is closed to unknown
keys, so `plugin.json` cannot carry the peer version; the executable record
is the absent / partial / floor / current fixture set in
`tests/host-compat.test.js`, whose surface map is the authority on which
methods the floor covers.

## Versioning

Expand All @@ -145,9 +186,12 @@ The declared minimum host is **feedBack core v0.3.0-alpha.1** (issue #39) —
the first core commit whose `VERSION` reads `0.3.0-alpha.1` (`803bd0c`),
the earliest snapshot carrying every host API this plugin consumes. Core
publishes no git tags, so `VERSION` is the identity to compare against.
README.md's "Requirements" section carries the full surface table plus the
README.md's "Requirements" section carries the full surface table, the
three independently-checked requirements (core version, Web MIDI
browser/permission support, WebAudioFont network/audio prerequisites).
browser/permission support, WebAudioFont network/audio prerequisites), and
the optional Split Screen peer floor (README "Requirements" item 4,
"*Peer plugin (optional): Split Screen, for focused multi-panel MIDI*"),
which the integration below implements.

`tests/host-compat.test.js` is the executable half of that declaration: its
fixtures reproduce the alpha.1 host surface (event bus, chart bundle,
Expand Down Expand Up @@ -203,11 +247,12 @@ node --test tests/*.test.js # node:test — no package.json/build step in
```

Two suites: `tests/screen.test.js` (helper and rendering coverage) and
`tests/host-compat.test.js` (the minimum-host contract). Both share the
DOM/`window` stub in `tests/harness.js` — `installBrowserHarness({ feedBack,
slopsmith, slopsmithSplitscreen, storage })` — so host-contract fixtures
(the `midi-input` domain, the event bus, the splitscreen helper) live in
the suites rather than in the harness itself.
`tests/host-compat.test.js` (the minimum-host and peer-floor contracts).
Both share the DOM/`window` stub in `tests/harness.js` —
`installBrowserHarness({ feedBack, slopsmith, slopsmithSplitscreen,
storage })` — so host-contract fixtures (the `midi-input` domain, the event
bus, the splitscreen helper) live in the suites rather than in the harness
itself.

`screen.js` exports a Node-only test hook (`module.exports`, guarded by
`typeof module !== 'undefined'`) alongside the browser `window.*Viz_piano`
Expand Down
Loading
Loading