refactor(contracts): additive capability facts pilot on touch family - #2420
refactor(contracts): additive capability facts pilot on touch family#2420thymikee wants to merge 4 commits into
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
Fixed both failing checks in Root cause (shared by both checks): the touch family's additive-facts refactor (this branch) dropped every owner's explicit
Fix: rather than re-adding the retired hand-written
Repointed the four manifest rows ( Merge-order note: PR #2418 (issue #2411) is concurrently replacing these six coverage manifests with Pushed as |
|
Historical single-platform addition replay requested above. Measured on this branch at Base: Family chosen: touch
The fix keeps the shared default but makes it owner-supplied: the input takes one required Historical single-platform addition available to replayThere is no post-facts-era commit that adds a new runtime operation: So the replay is that addition re-run forward on both shapes: add one Apple/iOS-only touch Replay A — old shape (
|
| # | file | why it must change |
|---|---|---|
| 1 | packages/contracts/src/platform-runtime-unavailable.ts |
shared unavailable builder (the fact surface platform-vega and Linux non-desktop spread) — 5 errors |
| 2 | packages/platform-android/src/runtime.ts |
denial cell only |
| 3 | packages/platform-harmonyos/src/runtime.ts |
denial cell only |
| 4 | packages/platform-linux/src/runtime.ts |
denial cell only |
| 5 | packages/platform-web/src/runtime.ts |
denial cell only |
| 6 | packages/provider-webdriver/src/platform-runtime.ts |
denial cell only |
| 7 | packages/provider-limrun/src/interaction-operations.ts |
denial cell only |
| 8 | packages/contracts/src/touch-runtime.test.ts |
family builder's own exact-facts assertion |
| 9 | src/__tests__/test-utils/runtime-operation-facts.ts |
fixture |
| 10 | src/daemon/__tests__/screenshot-runtime-fixture.ts |
fixture |
| 11 | src/daemon/handlers/__tests__/install-source.test.ts |
fixture |
| 12 | test/integration/provider-scenarios/provider-device-runtime.fixtures.ts |
fixture |
Plus the addition's own four files: contracts/src/touch-runtime.ts,
contracts/src/runtime-operation-names.ts, platform-apple/src/runtime.ts,
platform-apple/src/runner-demand.ts.
Total: 16 files, 8 packages (contracts, platform-apple, platform-android,
platform-harmonyos, platform-linux, platform-web, provider-webdriver, provider-limrun)
plus root src/ and test/.
Replay B — new shape (this branch)
Same probe, minus every denial cell (scratchpad/2412-probe-newshape.patch). pnpm typecheck
passes with four files changed:
packages/contracts/src/runtime-operation-names.tspackages/contracts/src/touch-runtime.tspackages/platform-apple/src/runtime.tspackages/platform-apple/src/runner-demand.ts
Test runs (packages/contracts packages/platform-* packages/provider-* +
runtime-binding-conformance-completeness): 331 files, only
packages/contracts/src/touch-runtime.test.ts fails, on its own enumerate-every-key assertion —
the same file the old shape forces. No owner test file needs an edit; every non-Apple owner
reports the new operation as unavailable with its own reason and hint, unedited.
Total: 5 files, 2 packages (contracts, platform-apple).
Result vs the stop rule
| measure | old shape | new shape | avoided |
|---|---|---|---|
| files | 16 | 5 | 11 |
| unsupported-owner fact files | 7 | 0 | 7 |
| packages touched | 8 | 2 | 6 |
| test fixture files | 4 (+1 builder test) | 0 (+1 builder test) | 4 |
Stop rule was "fewer than two owner edits avoided → stop". Seven are avoided. Continue.
platform-vega never had a touch cell of its own on either shape — it inherits
createUnavailablePlatformRuntimeFacts, which is file #1 above; on the new shape that file needs no
edit either, so Vega is covered without a Vega-side or a contracts-side edit.
Typed-denial proof (acceptance criterion 2)
The branch's own diff is the reverse of the replay: it deletes 37 hand-written cells across the seven
owner files and the shared builder, and every admission test that asserts the unavailable reason per
non-supporting platform stays green with no edit:
- Untouched and green:
packages/platform-android/src/runtime.test.ts(26),
packages/platform-apple/src/runtime.test.ts(40),packages/platform-web/src/runtime.test.ts
(20),packages/platform-linux/src/runtime.test.ts(7),
packages/platform-harmonyos/src/runtime.test.ts(9),
packages/provider-webdriver/src/platform-runtime.test.ts(18),
packages/provider-limrun/src/interaction-operations.test.ts(10),
packages/contracts/src/platform-runtime-unavailable.test.ts(2),
packages/contracts/src/platform-runtime.test.ts(9). - Wide run on the branch: 609 files / 4022 tests passed (
packages/contracts,
packages/platform-{vega,android,apple,web,linux,harmonyos},
packages/provider-{webdriver,limrun},src/daemon/__tests__,
src/daemon/handlers/__tests__,test/integration/provider-scenarios). pnpm typecheckclean.
The five edited test files are the family builder's own test (which gains a case for the new
default) and four fixtures that previously spelled out cells; none of them is an admission assertion.
Caveat on the forecast
The umbrella's ≥2-package target is only reached when the next capability addition is in this
family. Two owners still name a touch operation they refuse — platform-android keeps
hover: hoverUnavailable (unsupported-platform-leaf, not its device-kind reason) and
provider-webdriver keeps fillRef: typeUnavailable — because their denial for that one operation
differs from their family default. That is the design working: the default carries the owner's
reason, so an owner overrides it only where the reason genuinely differs, and one cell of override
is cheaper than eight cells of boilerplate.
|
This now conflicts with main after #2418 landed. Please move the new hover evidence references into the shared coverage declarations when resolving it, then rerun the coverage contracts. The historical addition replay requested above is still needed. |
The touch family's facts builder took one required cell per operation, so an operation only one owner implements still cost a hand-written denial in every other owner. The builder now takes the family's denial once, as `unsupported`, and every operation cell is optional: an owner names what it implements and omission reports that denial verbatim, with the reason and hint the owner would otherwise have repeated per cell. Omission stays a classified refusal, never an unclassified cell and never an implied success: `unsupported` is required, so a call that leaves the family blank does not compile. Facts are unchanged for every owner, so the per-platform admission assertions hold untouched. Refs #2412
Making every touch cell optional dropped the compile-time guard on the three operations every owner implements, with nothing replacing it: an owner could silently drop `tap` and nothing would fail. Only the truly per-owner cells (tapRef, hover, hoverRef, fillRef, tapElementSelector) need `unsupported` as their default. Restoring the required fields caught a real regression this refactor introduced: platform-web's touch facts had silently lost their explicit `longPress: readinessUnavailable` cell, so longPress reported the family's `unsupported` fallback instead of the owner's own readiness reason. Restored it, and fixed the other now-required-field call sites (the fully-unavailable owner fixtures, and the screenshot-runtime-fixture test double, which had also silently lost its longPress/fill distinction). Refs #2412
…ce line The touch family's additive-facts refactor dropped every owner's explicit hover: unavailable cell in favor of the family-level unsupported fallback, so the coverage manifests' literal-substring checks against packages/platform-apple/src/runtime.ts and packages/platform-linux/src/runtime.ts broke: that source line no longer exists. Point the macOS, iOS, tvOS, and Linux hover rows at new tests that assert the typed unavailable denial directly against each owner's bound facts, instead of re-adding a hand-written denial line the refactor was meant to retire. Refs #2412
… declaration table
2371ba2 to
e23d92e
Compare
|
Rebased this branch onto main at The manifest edits from the last commit (
Verified: all four coverage smoke tests (macos/ios-simulator/tvos/linux), both platform runtime test files, |
|
The e23d92e conflict resolution correctly moves hover evidence into the shared declarations, and the typed denial behavior remains intact. No new code finding. The remaining acceptance item is #2412’s historical single-platform addition replay: report which unsupported-owner edits disappear and the count against the two-edit stop rule. iOS smoke is still running. |
|
The replay is now in the PR body under "Replay: historical single-platform addition": the seven unsupported-owner edits that disappear are listed by file (six owner runtimes plus the shared unavailable builder), 16 files / 8 packages → 5 files / 2 packages, seven avoided against the two-edit stop rule. The 14:37 comment carries the full method. iOS smoke passed on |
|
The documented replay resolves the remaining evidence gap: the forward replay of the historical Apple-only operation shape avoids six unsupported platform/provider edits plus the shared builder, exceeding the two-edit stop rule. The caveat about this being a touch-family pilot is clear. Code review is clean at e23d92e and all checks are green. |
What changed
Pilots additive capability facts on the touch operation family (per #2412, child of #2409).
touchRuntimeOperationFactsused to take one required cell per operation, so an operation onlyone owner implements still cost a hand-written denial in every other owner. The builder now takes
the family's denial once, as a required
unsupportedcell, and every per-owner operation(
tapRef,hover,hoverRef,fillRef,tapElementSelector) is optional — an owner names whatit implements and omission reports
unsupportedverbatim, with the reason and hint the ownerwould otherwise have repeated by hand.
tap,longPressandfillstay required: every ownerimplements them, so dropping them would be a silent regression, not a legitimate omission.
A follow-up commit restored that guard after the first pass made all cells optional and a real
regression slipped through: platform-web's touch facts had silently lost their explicit
longPress: readinessUnavailablecell, reporting the family default instead of the platform's ownreadiness reason. Fixed, along with the other now-required call sites (the fully-unavailable owner
fixtures and the screenshot-runtime-fixture test double).
Proof
unavailable reason for each non-supporting platform pass with no edits
(
packages/contracts/src/touch-runtime.test.ts, platform runtime tests).pnpm check:affected --run: 407 test files / 2898 tests passed.pnpm check:layering: green (R2, R6, R7, R9, R10, R11, R13 etc. all hold).Closes #2412
Part of #2409
Replay: historical single-platform addition (#2412 acceptance)
Measured at
0eca306610against basee7d97f7dfe; the later commits only re-requiredtap/longPress/filland ported the hover evidence, neither touches the replayed addition.Full record in the PR comment of 14:37.
Replayed addition: one Apple/iOS-only touch operation (
longPressElementSelector, shaped liketapElementSelector, the way #1987 introduced the family). Files the compiler forces:The seven unsupported-owner edits that disappear:
packages/platform-android/src/runtime.ts(denial cell)packages/platform-harmonyos/src/runtime.ts(denial cell)packages/platform-linux/src/runtime.ts(denial cell)packages/platform-web/src/runtime.ts(denial cell)packages/provider-webdriver/src/platform-runtime.ts(denial cell)packages/provider-limrun/src/interaction-operations.ts(denial cell)packages/contracts/src/platform-runtime-unavailable.ts(shared unavailable builder, whichplatform-vegaand Linux non-desktop spread)Also gone: four test fixtures that enumerated every touch key
(
src/__tests__/test-utils/runtime-operation-facts.ts,src/daemon/__tests__/screenshot-runtime-fixture.ts,src/daemon/handlers/__tests__/install-source.test.ts,test/integration/provider-scenarios/provider-device-runtime.fixtures.ts).The family builder's own exhaustive test (
packages/contracts/src/touch-runtime.test.ts) still changes on both shapes.Stop rule: fewer than two unsupported-owner edits avoided → stop. Seven avoided; the pilot continues.