Skip to content

refactor: keep test-only code out of production exports - #3369

Merged
thymikee merged 4 commits into
mainfrom
chore/production-unused-exports
Oct 10, 2026
Merged

thymikee merged 4 commits into
mainfrom
chore/production-unused-exports

Conversation

@thymikee

@thymikee thymikee commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Summary

check:production-exports listed 59 production-unused exports but never failed: fallow 2.x --fail-on-issues ignored the gate's warn severity. This clears them before the fallow 3.32 upgrade (next PR in the stack) makes the gate enforce again, as #1282 intended.

None has an external consumer. GitHub code search across the 19 public repos importing agent-device (including tester-army/e2e / @e2edev/mobile) found no use, none is documented, and none is reachable from src/sdk/* or src/ai-sdk.

  • Test support leaves production modules: the maestro conformance projection joins its harness in packages/maestro/test/conformance/; helpers move to co-located *.fixtures.ts.
  • Tests import source modules instead of facade re-exports only tests read, or drive the production caller (buildIosInteractiveSnapshotPresentation, iosSnapshotComparisonIdentityKey, resolveElementReportedTwice). Test-only wrappers and a duplicate equality predicate are removed.
  • chore(gates) records seams fallow cannot see. Among them are the staged managed-local lease foundations (ADR 0021). Their Simlock side, simlock#70, was closed as not planned. Removing that feature changes persisted record formats, so it is left for a separate decision.

80 files. The moved conformance projection gets new health-baseline entries for its pre-existing complexity findings: fallow 2.104 counts a moved file as changed, and the old path never needed an entry. An unused test helper is also dropped.

Validation

Tested 600c3cb39 (rebased on main 19203c620): pnpm check:affected --run passed (full check set, selected fail-open by the tooling and config changes). maestro:conformance 62/62 and scripts/ios-snapshot-differential.test.ts 12/12 (node:test suites outside vitest). Pure tooling and test refactor, so no device run applies.

🤖 Generated with Claude Code

@thymikee
thymikee added this pull request to stack #3371 October 10, 2026 14:10
@thymikee thymikee changed the title chore/production unused exports refactor: keep test-only code out of production exports Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.16 MB 5.16 MB -93 B
Package (unpacked) 5.16 MB 5.16 MB -93 B
Package (download) 1.55 MB 1.55 MB -44 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.7 ms 26.2 ms -1.5 ms
CLI --help 82.7 ms 81.3 ms -1.5 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 80 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/capture-kit/src/ios-snapshot-engine/conformance-harness.fixtures.ts Outdated
Comment thread packages/capture-kit/src/ios-snapshot-engine/conformance-harness.ts Outdated
thymikee and others added 2 commits October 10, 2026 16:53
Production-unused exports accumulated while check:production-exports reported
them as warnings that never failed. Clear the ones with no production or public
consumer:

- move test support out of production modules: the maestro conformance
  projection joins its harness under packages/maestro/test/conformance, and
  test-only helpers move into co-located *.fixtures.ts modules (iOS conformance
  harness, maestro position wrapper, audio-probe descriptor, the renamed
  target-classification fixtures)
- point tests at source modules instead of facade re-exports that only tests
  read (IS_PREDICATES, CLOUD_WEBDRIVER_PROVIDERS, runtime factory, runner
  artifact, iOS snapshot engine members)
- drive helpers through their production callers: tests call
  buildIosInteractiveSnapshotPresentation, compare iosSnapshotComparisonIdentityKey,
  and resolve wrappers through resolveElementReportedTwice; the test-only
  wrappers and the duplicate equality predicate are removed, as is an unused
  runtime scroll snapshot helper

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tialCase private

The failure artifact's replay command quoted the case path with
JSON.stringify, which leaves $ and backticks live inside the double quotes;
shellQuoteIfNeeded is the shared host-side quoting primitive. The fixtures
derive DifferentialCase from compareDifferentialCases, as the generator
already does, instead of widening the harness exports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the chore/production-unused-exports branch from 4fe9877 to 9afc83d Compare October 10, 2026 15:13
@thymikee

Copy link
Copy Markdown
Member Author

The code looks good at 9afc83d. I have one design question below, so I am not marking it ready yet. Smoke Tests was still running when I checked. The diff only removes exports that tests read and moves test helpers. The daemon, Apple, Android and CLI code bodies on the smoke route are unchanged, so I found no overlap with it. I did not run fallow, so I could not confirm the health baseline state or that the gate is clean at head. No conflicts. Smoke Tests must finish green on 9afc83d before merge.

Not blocking, and you can take or leave these. The PR body says the moved conformance-normalize keeps its baseline counts, but at the merge base there is no baseline entry for the old path, so the two complexity_critical and two crap_critical entries at fallow-baselines/health.json:533 are new. Please say so in the body, or drop the entry if the move did not cause them. The new ignoreExports entries at .fallowrc.json:371 keep test-only re-exports (SCRIPT_FLAG_COMMANDS and scriptFlagEntries, acquireDurableCaptureRecoveryAuthorityBeforeDeadline, collectedRecordingPath in stop-sequence.ts). The rest of the PR points tests at the owning module, so these tests could import internal/script-utils.ts, recovery-authority.ts and artifact-paths.ts, and the re-exports and entries could go. The fixture selectMaestroPositionMatches at packages/maestro/src/internal/runtime-target-ranking.fixtures.ts:8 shares its name with a different function in runtime-target-position.ts:17, so a name like resolveMaestroPositionForTest would avoid confusion. The tests at packages/selectors/src/interaction-targeting.test.ts:458 are titled "through the rule on its own" but now call the composite resolveElementReportedTwice, so they need a new title.

Could the enforcement footprint be smaller? Production net is -48 lines, but the PR adds a test-only subpath (capture-kit/audio-probe-descriptor-fixtures) and many ownership entries. If tests imported owning modules for every symbol that only tests read, only the fixture subpath would stay, which follows the existing replay-port and selectors fixtures pattern. The managed-local allowlist entry is fine as a recorded seam until there is a decision to delete the staged managed-local lease foundations, since their owner kind is persisted in device-claim and durable-resource records.

Both cubic-dev-ai P2 threads are fixed at this commit and can be resolved: #3369 (comment) (shellQuoteIfNeeded now quotes casePath) and #3369 (comment) (DifferentialCase is no longer exported).

thymikee and others added 2 commits October 10, 2026 18:25
…-control tests

Review follow-up. resolveMaestroPositionForTest no longer shares a name with
the production selectMaestroPositionMatches, and the wrapper-control tests are
titled for the composite resolveElementReportedTwice they now call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exports maps and the capture-kit subpath pin follow the fixture moves. The
moved conformance projection gets new health-baseline entries for its
pre-existing complexity findings: fallow 2.104's audit treats a moved file as
changed, while the old path needed no entry because no change touched it.
The .fallowrc entries name exports whose consumers sit outside fallow's
--production graph: a published provider's plugin default export, a member
read off a lazy import(), contracts facade members the facade-exhaustiveness
rule requires, two test-tree seams with no fixture subpath (.ad grammar drift
guard, recovery authority), the recording-path contract, and the staged
managed-local lease foundations, which go with their feature rather than
export by export.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the chore/production-unused-exports branch from 9afc83d to 600c3cb Compare October 10, 2026 16:39
@thymikee

Copy link
Copy Markdown
Member Author

Thanks. I tried the smaller footprint, and two gates explain why it stops where it does.

Design question (enforcement footprint).

  • Importing the owning module directly: R11 refuses a relative import into a package from outside it ("import the package specifier instead, or dual specifier/relative loads instantiate the module twice"). A root or cross-package test can only reach a module through a package subpath.
  • Routing through an existing fixtures subpath: I tried this for collectedRecordingPath, re-exporting it from @agent-device/capture-kit/recording-artifact-fixtures. The eager-closure budget then failed (scripts/__tests__/eager-closure-budgets.test.ts). The fixture entry would evaluate artifact-paths.ts, which it didn't at the merge base, and the gate refuses any new eager edge on an entry module. So it stays a re-export from recording-stop-sequence, beside nativeRecordingPath, which production reads through that same subpath.
  • A new fixture subpath per symbol: this would add a manifest entry plus a layering pin each. That's more footprint than the one exemption entry each of SCRIPT_FLAG_COMMANDS/scriptFlagEntries (two names in the existing "test-tree consumers" entry), acquireDurableCaptureRecoveryAuthorityBeforeDeadline and collectedRecordingPath carries now. Neither ad-script nor durable-capture has a fixture subpath.

The other new entries are cases fallow can't see: the provider plugin default export, the lazy import() member, and the members the contracts facade-exhaustiveness rule requires. The managed-local entry is removed again in #3372, which deletes the feature.

Non-blocking items, all taken:

  • The body and the gates commit now say the conformance-normalize health-baseline entries are new: fallow 2.104 counts a moved file as changed, and the old path never needed an entry.
  • The fixture is renamed resolveMaestroPositionForTest.
  • The two wrapper-control tests are retitled "… through resolveElementReportedTwice".

Head: 600c3cb39. pnpm check:affected --run passed on all three stacked heads.

@thymikee
thymikee merged commit 8ce7f86 into main Oct 10, 2026
19 checks passed
@thymikee
thymikee deleted the chore/production-unused-exports branch October 10, 2026 17:18
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-10 17:18 UTC

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.

1 participant