Skip to content

refactor(snapshot): retire Android helper presentation utils #2134

Description

@thymikee

Parent: #2129

Blocked by: none. Wave 1; this child is independent of #2133 and may be rebased after it.

Scope — exact tracked files

Production:

  • src/utils/android-helper-presentation/geometry.ts
  • src/utils/android-helper-presentation/labels.ts
  • src/utils/android-helper-presentation/predicates.ts
  • src/utils/android-helper-presentation/structural-noise.ts
  • src/utils/android-helper-presentation/tree.ts
  • src/utils/android-helper-snapshot-presentation.ts

There is no dedicated tracked utility test for these modules. The current integration coverage is in the snapshot cases of src/utils/__tests__/output.test.ts, which is owned by the surface-output child and must remain green while this child changes the import path.

Destination and importer edits

Move the five helper modules to:

  • src/snapshot/snapshot-presentation/android/geometry.ts
  • src/snapshot/snapshot-presentation/android/labels.ts
  • src/snapshot/snapshot-presentation/android/predicates.ts
  • src/snapshot/snapshot-presentation/android/structural-noise.ts
  • src/snapshot/snapshot-presentation/android/tree.ts

Move android-helper-snapshot-presentation.ts to:

  • src/snapshot/snapshot-presentation/android/helper.ts

Update the internal relative imports among those six files and the one production importer:

  • src/utils/output.ts (later moved by the surface-output child; update its current path in this child or coordinate the exact final path before landing)

The destination is under the existing src/snapshot/snapshot-presentation/ owner. Do not create a generic Android utility package, internal barrel, compatibility path, or second presentation carrier.

Behavior invariants

Preserve the Android-helper-only admission check, raw-mode identity path, zero-area/rectless filtering, hidden-above/hidden-below derivation, generic structural-label suppression, unlabeled action-row promotion, duplicate structural-node removal, repeated action-row collapse, representative/ref selection, geometry tolerance, ordering, and warning counts. Raw snapshots must remain unchanged; regular snapshots must retain the same nodes and refs after presentation. Keep the existing snapshot policy in src/snapshot; do not move Android host mechanics, transport, app logs, or provisioning here.

Focused validation

Run the current output snapshot tests that exercise this owner, including the cases named:

  • formatSnapshotText collapses Android helper nodes in agent-facing output
  • formatSnapshotText promotes Android helper unlabeled action rows
  • formatSnapshotText collapses adjacent React Native row noise in Android helper output
  • formatSnapshotText keeps single repeated child control in Android helper output
  • formatSnapshotText labels Android helper action rows with trailing child controls

Also run:

  • pnpm vitest run src/utils/__tests__/output.test.ts
  • pnpm vitest run scripts/layering/snapshot-presentation-boundary.test.ts

Planted-red proof

This move adds no new gate. Preserve and run the existing positive-control boundary test: a synthetic snapshot module importing daemon assembly must be reported by name. During review, temporarily point one moved module at a daemon path, observe the named boundary failure, then remove the violation before the green run. Do not replace the existing policy with a filename heuristic.

Dependency order

Wave 1. The surface-output child (#2139 or its eventual issue number) depends on this child because its snapshot formatter must import the final Android presentation path. It owns the mixed legacy output test and must not copy these modules.

Shrink target

Delete all six old utility files and retain one implementation of each helper. Destination production LOC, excluding the physical move, must be no greater than the six-file aggregate; no new public export or shim is allowed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions