11 Commits

Author SHA1 Message Date
Michał Pierzchała 1da6fd5180 refactor: split debug symbols workflow modules (#787)
* refactor: split debug symbols workflow modules

* refactor: simplify debug symbols module dependencies

* refactor: align debug symbols with command families

* refactor: move Apple debug symbols under ios platform
2026-06-12 14:44:50 +02:00
Michał Pierzchała b30292d867 refactor(types): deepen type consolidation (#743)
* refactor(types): deepen type consolidation

* fix: satisfy fallow type refactor audit
2026-06-10 14:05:39 +02:00
Michał Pierzchała 1de7e73e2a refactor(types): consolidate duplicated types across src/ into single sources of truth (#717)
* refactor(types): reuse canonical string-unions across the codebase

Replace inline duplicates of SessionSurface, ClickButton, DeviceRotation,
BackMode, ScrollDirection, Platform/PlatformSelector/DeviceTarget,
AlertAction, and LeaseBackend with imports of the existing canonical types.
Extract BackMode into a core/back-mode.ts leaf (matching click-button.ts /
session-surface.ts) to keep backend.ts dependency-clean. Add 'satisfies
readonly T[]' drift-guards to the runtime enum tuples consumed by enumField.

Pure refactor: single source of truth for these unions, no behavior change.

* refactor(types): consolidate gesture + daemon/network/metro mode unions

- Add SwipePattern to core/scroll-gesture.ts; reuse SwipePreset,
  ScrollInputDirection, ScrollDirection at remaining inline sites.
- Move DaemonServerMode / DaemonTransportPreference / SessionIsolationMode /
  NetworkIncludeMode to contracts.ts (the client<->daemon boundary); daemon/
  config.ts and daemon/network-log.ts re-export them. Drop client-types.ts's
  three private alias copies.
- Reuse MetroPrepareKind in metro.ts and remote-config-schema.ts.
- Add satisfies-guards to the runtime enum tuples.

Pure refactor, type-only changes.

* refactor(types): single-source remaining string-literal unions

- ElementSelectorKey (core/interactor-types.ts) for the 'id|label|text|value'
  selector-key subset across core/daemon/ios/maestro.
- GESTURE_KINDS + GestureKind (command-catalog.ts), dropping the duplicate
  GESTURE_KIND_VALUES.
- AndroidTextInputAction (android/adb-executor.ts); reuse NetworkLogBackend for
  the app-log backend union.
- Reuse contracts.ts JsonRpcId / JsonRpcRequestEnvelope in mcp router + server.
- New commands/log-command-contract.ts (LOG_ACTION_VALUES + LogAction),
  mirroring perf-command-contract.ts.
- Named Android snapshot helper metadata unions (transport/captureMode/install
  reason) shared between helper + backend metadata.

Pure refactor, type-only changes; full unit suite green.

* refactor(types): consolidate geometry shapes

- Reuse canonical Rect (utils/snapshot.ts) for inline {x,y,width,height}
  literals (parsing, output, screenshot-diff regions/ocr, atspi-bridge).
- GestureReferenceFrame (core/scroll-gesture.ts) as the single reference-frame
  type; TouchReferenceFrame becomes an alias; replace inline
  {referenceWidth,referenceHeight} across daemon + maestro + commands.
- New ImageDimensions (screenshot-geometry.ts) and MovementRange
  (screenshot-diff-ocr.ts) for repeated {width,height} / {min,max} shapes.
- File-local AndroidRecordingSize in record-trace-android.ts.

Pure refactor, type-only changes. Point literals with normalized-vs-absolute
semantics deliberately left untouched.

* refactor(types): consolidate result/options/resolver shapes (+oxfmt)

- Generic PlatformProviderResolver<T> collapses 6 near-identical resolver
  types in request-platform-providers.ts.
- Reuse canonical DaemonError (contracts.ts) / NormalizedError (utils/errors.ts)
  for the inline error DTOs in daemon/types.ts and utils/output.ts.
- Single DaemonFailureResponse: FailedDaemonResponse becomes an alias and the
  maestro-local redefinition is dropped.
- Extract one shared toBackendResult() into commands/runtime-types.ts, deleting
  5 duplicate copies.
- Normalize whitespace with oxfmt across the touched files.

Full unit suite green.

* refactor(types): share TransformGestureParams + RepeatedInput bundles

- TransformGestureParams (core/scroll-gesture.ts) replaces 4 identical inline
  transform-gesture param shapes (core interactor, dispatch, android multitouch,
  client options).
- Reuse RepeatedInput (commands/command-input.ts) for the tap-modifier bundle in
  PressCommandOptions and BackendTapOptions.

Pure refactor, type-only.

* refactor(types): extract BackendResultEnvelope mix-in

Replace the repeated inline { backendResult?: Record<string, unknown>;
message?: string } pair on ~17 single-object command result types with
'& BackendResultEnvelope' (commands/runtime-types.ts). Discriminated-union
variants and single-field result types are intentionally left inline.

Pure refactor, type-only changes; failing files re-verified green in isolation
(full-suite failures were flaky timeouts).

* refactor(types): dedupe runner/replay/selector/exec result shapes

- RunnerSessionOptions = AppleRunnerLifecycleOptions (field-identical).
- Reuse ReplayActionBlockInvoker for the maestro + daemon replay invoker types.
- SelectorSnapshotOptions aliases the canonical SelectorSnapshotInput; annotate
  selectorSnapshotOptionsFromFlags.
- Reuse ExecResult for the { stdout; stderr; exitCode } subset in
  record-trace-errors and app-log-process.

Pure refactor, type-only.

* refactor(types): make canonical tuples the single source for enum unions

Each string-enum module now exports an 'as const' literal tuple as the single
source and derives its union via (typeof TUPLE)[number]: SESSION_SURFACES,
CLICK_BUTTONS, DEVICE_ROTATIONS, BACK_MODES, SCROLL_DIRECTIONS/SWIPE_PRESETS/
SWIPE_PATTERNS, SCROLL_INPUT_DIRECTIONS, ALERT_ACTIONS, DEVICE_TARGETS. The
command metadata/input files import these tuples instead of redefining local
*_VALUES copies, which also retires 10 now-redundant 'satisfies' drift-guards.

Member order preserved everywhere (enumField error messages unchanged). Platform
tuples intentionally left as-is (command-input vs contracts use different orders).

Net -39 lines; tuple+type dual maintenance eliminated for these unions.
2026-06-09 19:13:55 +02:00
Michał Pierzchała 491ad7e922 fix: improve session ownership and recovery guidance (#674)
* fix: improve session recovery guidance

* fix: quote session recovery commands

* test: simplify record session cleanup fixtures

* test: cover recovery hint edge cases

* test: trim duplicate recovery quoting coverage

* fix: scope implicit sessions by caller workspace

* fix: surface session state directory

* fix: remove unused session store check

* test: trim duplicate session recovery coverage
2026-06-02 14:06:00 -07:00
Michał Pierzchała 99e97c873e feat: stream replay test progress (#605)
* feat: stream replay test progress

* fix: format replay test progress duration

* fix: harden replay progress transports

* refactor: clean up replay progress fallow findings

* refactor: trim replay progress cleanup
2026-05-28 17:54:44 +02:00
Michał Pierzchała 5cea4dd0b1 feat: pass through GitHub Actions artifact install sources (#437) 2026-04-25 19:30:51 -04:00
Michał Pierzchała 0fe724f252 feat: export error contract helpers (#396) 2026-04-11 20:14:46 +02:00
Michał Pierzchała d2b02f1b93 feat: export snapshot contracts (#394) 2026-04-11 19:54:34 +02:00
Michał Pierzchała 20021c3d1c refactor: reduce duplication and simplify codebase (#374)
* refactor: reduce duplication and simplify codebase

Eliminate copy-pasted functions, inline error boilerplate, and repeated
patterns across daemon handlers and platform modules.

Key changes:
- Deduplicate isEnvTruthy, displayNodeLabel, roundPercent into single sources
- Extract throwDaemonError helper for client/CLI daemon response errors
- Add sessionNotFoundResponse/unsupportedOperationResponse helpers and
  adopt errorResponse() across ~30 handler files (-565 lines)
- Unify BATCH_PARENT_FLAG_KEYS/REPLAY_PARENT_FLAG_KEYS into shared
  mergeParentFlags helper in handler-utils
- Extract createLinuxToolResolver for screenshot/clipboard tool detection
- Remove stale type-sync comments from contracts.ts and metro.ts

* refactor: deeper structural simplification pass

Bigger wins from restructuring, not just mechanical dedup:

- cli.ts: move logTailStopper to try/finally (eliminates 28 duplicate
  calls), extract writeCommandCliOutput/writeLogsCliOutput/writeNetworkCliOutput
  from 350-line if/else chain, fix remaining throwDaemonError site
- session-store.ts: replace 67-line sanitizeFlags destructure/reconstruct
  with 10-line pick-from-array loop
- record-trace: extract finalizeRecordingOverlay helper, replacing 4
  copies of the telemetry+overlay block across ios/android/recording files
- Deduplicate normalizeText (finders.ts + selectors-match.ts)
- Fix isEnvTruthy to preserve whitespace-tolerant parsing (.trim())

* fix: ensure logTailStopper runs before process.exit

process.exit() does not unwind the stack, so finally blocks are
skipped. Restore explicit logTailStopper() calls before each
process.exit() to prevent leaking the background daemon log tail
process. The finally block remains as a safety net for normal
return paths.

Also refactor writeCommandCliOutput to return an exit code instead
of calling process.exit() directly, keeping the exit decision in
the caller where cleanup is visible.

* refactor: simplify daemon failure responses

* refactor: remove redundant daemon response cast
2026-04-11 12:53:53 +02:00
Michał Pierzchała be09c1d58a feat: expose bridge-facing contract and metro APIs (#373)
* feat: expose bridge-facing contract and metro APIs

* chore: address review feedback on public contract exports

* refactor: reuse public daemon contracts internally

* refactor: reuse public metro types internally

* fix: widen bridge-facing public contracts
2026-04-10 14:06:27 +02:00
Michał Pierzchała 66d65c887c refactor: expose metro and remote config node apis (#372)
* refactor: expose metro and remote config node apis

* refactor: tighten public node api surface

* refactor: tighten metro public type boundaries

* refactor: normalize remote config public profile

* refactor: make remote config parser library-owned

* refactor: share remote config parsing primitives

* refactor: avoid regex in base url normalization
2026-04-10 13:03:13 +02:00