Skip to content

test(media): real picker-dialog photo-attach forwarding coverage (Refs #1358) - #1409

Merged
9thLevelSoftware merged 4 commits into
mainfrom
test/issue-1358-photo-attach-gate-discrimination
Nov 18, 2026
Merged

9thLevelSoftware merged 4 commits into
mainfrom
test/issue-1358-photo-attach-gate-discrimination

Conversation

@9thLevelSoftware

Copy link
Copy Markdown
Owner

Refs #1358 (issue closed by #1397 — deliberately NOT Fixes; no issue-state change).

Post-merge test-hygiene follow-up to merge-gate finding N1 (#1397 (comment) §7). Test-only change; no production behavior change.

What was wrong

ExercisePickerHostPhotoAttachTest only mounted ExerciseMediaAttachments(enableAttach = <constant>):

  • routineEditorHost_* / workoutAddHost_* were pairwise identical tests.
  • listThumbnailSuppression_alone_neverDisablesAttach cannot fail on pre-fix code. With the P1 mutation (enablePhotoAttach = enableVideoPlayback put back in ExercisePicker.kt), all 5 tests still passed — only the source-string drift guard caught it.

Changes

  1. Renamed + deduped (names now claim only component-level SD10 behavior). ExercisePickerHostPhotoAttachTest (5 tests) → ExerciseMediaAttachGateTest (2 tests: gateOn_addPhotosEnabled_noPreferenceOffNotice, gateOff_addPhotosDisabled_preferenceOffNoticeShown). Class doc explicitly scopes these to ExerciseMediaAttachments component behavior and points at the real forwarding test + drift guard for host wiring.

  2. Real behavioral forwarding test. New ExercisePickerDialogPhotoAttachForwardingTest renders the real ExercisePickerDialog with enableVideoPlayback=false, enablePhotoAttach=true (the exact pre-fix host combination), taps Create Custom Exercise (the real user gesture), and asserts Add photos is enabled with no preference-off notice; plus the mirror direction (enableVideoPlayback=true, enablePhotoAttach=false → disabled + notice). Both tests fail when ExercisePickerDialog forwards enableVideoPlayback instead of enablePhotoAttach.

  3. Harness-only seam (no production behavior change). The documented blocker (Robolectric Dialog + TextField never reaches idle — AppNotIdleException) is worked around with the suggested test-only DialogProperties(usePlatformDefaultWidth = false) seam: new defaulted parameters dialogProperties on CreateExerciseDialog and createDialogProperties on ExercisePickerDialog, both defaulting to production DialogProperties() (exactly what the unparameterized Dialog used). No production call site passes them; production rendering is unchanged. The forwarding line under test is shell-independent.

Also updated ExerciseMediaWiringTest doc/message references to the renamed test (comments only, no test-name changes).

Discrimination proof (mutation probe)

Against the mutation (enablePhotoAttach = enableVideoPlayback restored in ExercisePicker.kt:233) — ./gradlew -Pskip.supabase.check=true :shared:testAndroidHostTest --tests '…ExercisePickerDialogPhotoAttachForwardingTest' --tests '…ExerciseMediaAttachGateTest':

ExercisePickerDialogPhotoAttachForwardingTest > preferenceOff_thumbnailsShown_addPhotosDisabled_noticeShown FAILED
    java.lang.AssertionError at ExercisePickerDialogPhotoAttachForwardingTest.kt:145
ExercisePickerDialogPhotoAttachForwardingTest > preferenceOn_thumbnailsSuppressed_addPhotosStillEnabled_noNotice FAILED
    java.lang.AssertionError at ExercisePickerDialogPhotoAttachForwardingTest.kt:135
4 tests completed, 2 failed
BUILD FAILED

Both new behavioral tests FAIL under the mutation (the 2 component-level tests pass, correctly — they no longer claim host coverage).

Against main code (mutation reverted, enablePhotoAttach = enablePhotoAttach at ExercisePicker.kt:233) — same command:

ExerciseMediaAttachGateTest: tests=2 failures=0 errors=0
ExercisePickerDialogPhotoAttachForwardingTest: tests=2 failures=0 errors=0
TOTAL: tests=4 failures=0 errors=0
BUILD SUCCESSFUL

Focused host suite

Full :shared:testAndroidHostTest on the PR head: 5965 tests, 0 failures, 0 errors (BUILD SUCCESSFUL in 2m 13s), including ExerciseMediaWiringTest (12/12, drift guard photoAttachGateIsDecoupledFromListThumbnailFlagAtBothHosts green) and both new classes. ExercisePickerHostPhotoAttachTest is gone.

Acceptance

  • New test fails under the mutation (2/2 forwarding tests FAILED at :135/:145)
  • New test passes on main (4/4 green)
  • Focused host suite green (5965 tests, 0 failures)
  • No production behavior change (diff to phoneMain is only the defaulted DialogProperties() seams; no call site passes them)

…#1358)

Test-hygiene follow-up to merge-gate finding N1 on PR #1397.

- Replace ExercisePickerHostPhotoAttachTest (5 tests whose names claimed
  host coverage but only mounted ExerciseMediaAttachments with a constant;
  pairwise-identical routineEditorHost_*/workoutAddHost_* pairs and a
  listThumbnailSuppression test that cannot fail on pre-fix code) with
  ExerciseMediaAttachGateTest: 2 deduplicated tests whose names claim only
  component-level SD10 behavior (Add enabled/disabled + preference notice).
- Add ExercisePickerDialogPhotoAttachForwardingTest: renders the REAL
  ExercisePickerDialog with enableVideoPlayback=false / enablePhotoAttach=true,
  opens the create dialog via the real 'Create Custom Exercise' tap and asserts
  Add photos is enabled (plus the mirror direction). Fails when
  ExercisePickerDialog forwards enableVideoPlayback instead of
  enablePhotoAttach (mutation-probe evidence in the PR).
- Harness-only seam: test-only DialogProperties(usePlatformDefaultWidth=false)
  via new defaulted dialogProperties/createDialogProperties parameters on
  CreateExerciseDialog/ExercisePickerDialog to dodge the Robolectric
  Dialog+TextField AppNotIdleException quirk. Defaults are production
  DialogProperties(); no production call site passes them; production behavior
  unchanged.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 22:56

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Devil and others added 2 commits November 17, 2026 18:08
…1406)

Drive-by test-hygiene fix, pre-existing on main at 6f95247 (Unit Tests red
there): #1406 landed the real migration 64.sqm (issue #1400 aggregateEligible)
without moving ExerciseMediaWiringTest.noMigrationTouchesExerciseImage's
sanctioned ratchet ('bump this ratchet only when a real migration lands').
64.sqm does not touch ExerciseImage (only 43.sqm does, guard (b) intact), so
the ratchet moves 63 -> 64. This unblocks the check pipeline on this PR
(Build Android / iOS Test Target Compile skip while Unit Tests is red).
@9thLevelSoftware

Copy link
Copy Markdown
Owner Author

Main-unblocking drive-by (test-only) at 9be639b: the first CI pass failed Unit Tests on ExerciseMediaWiringTest.noMigrationTouchesExerciseImage ("found 64.sqm beyond the base 63.sqm"). That failure is pre-existing on main (main head 6f95247 has Unit Tests: failure / Shared Module Test Results: failure on its own check-runs): #1406 landed the real migration 64.sqm (issue #1400 aggregateEligible) without moving #1397's sanctioned ratchet ("bump this ratchet only when a real migration lands").\n\nFix included here (one test assertion + its comment, no production code): ratchet 63 → 64. Verified 64.sqm does not touch ExerciseImage (only 43.sqm does — guard (b) untouched and passing). This also un-skips Build Android / iOS Test Target Compile, which the workflow skips while Unit Tests is red.\n\nPost-bump local verification on the PR head (merged with main 6f95247): full ./gradlew -Pskip.supabase.check=true :shared:testAndroidHostTest — 5991 tests, 0 failures, 0 errors (same test count CI runs). Mutation-probe evidence in the PR body stands unchanged.

@9thLevelSoftware

Copy link
Copy Markdown
Owner Author

Merge gate verdict — PR #1409 @ 9be639bed4ab14ace32971eab944eb599e29b9a4: NOT MERGED. Substance approved; merge blocked by a conflict with main (mechanical rework, then re-gate)

Why no merge

At merge time GitHub reports mergeable: CONFLICTING / mergeStateStatus: DIRTY. main moved from 6f952472 to c28f5094 ("test(media): bump noMigrationTouchesExerciseImage ratchet to 64.sqm"). That commit was pushed directly to main at 2026-11-17T19:01-05:00, author phoenixworker, without a PR or gate. It applies the same ratchet bump this PR carries in 9be639be. git merge-tree confirms the only conflict is shared/src/commonTest/kotlin/com/devil/phoenixproject/presentation/ExerciseMediaWiringTest.kt, in the T6 ratchet hunk. Both sides set the bound to <= 64, so only the comment and message text differ.

Required rework (narrow)

  1. Merge origin/main (c28f5094 or later) into test/issue-1358-photo-attach-gate-discrimination, and resolve the ExerciseMediaWiringTest T6 hunk to one maxSeen <= 64 assertion. Main's version or this PR's wording are both fine. Do not change guard (b) (mentions == listOf("43.sqm")).
  2. Leave every other file in the PR exactly as it is at 9be639be. After the merge, the PR-vs-main diff may contain only the 5 other files plus, at most, comment/message text in ExerciseMediaWiringTest.
  3. Push, wait for CI to be green at the new head, then request a fresh gate.

What is already verified (re-gate only needs the delta)

1. Scope: behavior-neutral ✅, with a disclosed source-level nuance. The diff adds a harness seam in 2 phoneMain files:

  • CreateExerciseDialog.dialogProperties: DialogProperties = DialogProperties() → Dialog(onDismissRequest, properties = dialogProperties)
  • ExercisePickerDialog.createDialogProperties: DialogProperties = DialogProperties(), forwarded

Accepted as no production behavior change: (a) the originating N1 spec named and sanctioned exactly this seam; (b) upstream CMP v1.12.2 (this repo's version) declares expect fun Dialog(onDismissRequest, properties: DialogProperties = DialogProperties(), content) (compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/window/Dialog.kt:64-66), so the explicit default is identical on Android and iOS; (c) no production call site passes either parameter. The only use is the internal forward at ExercisePicker.kt:229, and SingleExerciseScreen uses the default.

2. Discrimination ✅ (independently reproduced, clean worktree at 9be639b).

  • Head: ExercisePickerDialogPhotoAttachForwardingTest 2/2, ExerciseMediaAttachGateTest 2/2, ExerciseMediaWiringTest 12/12 → 16/16 pass.
  • Negative control ExercisePicker.kt:233 → enablePhotoAttach = enableVideoPlayback,: 4 tests completed, 2 failed. preferenceOn_thumbnailsSuppressed_addPhotosStillEnabled_noNotice fails at :135 and preferenceOff_thumbnailsShown_addPhotosDisabled_noticeShown fails at :145. The component-scoped gate tests stay green, as expected.
  • Mutation reverted afterwards: tree clean.

3. CI at 9be639b ✅. CI Tests run 44197608547 all passed (Unit Tests, Build Android, Lint, iOS Test Target Compile, Schema Sync, Security Hygiene, test-result checks). The tvOS run 44197608611 passed (native-tv, native-tv-device). GitGuardian passed. iOS Simulator Tests (non-blocking) were SKIPPED, as on main. This result is for 9be639b only; the post-merge head needs its own green CI.

Process note

main @ 6f952472 was red (CI Tests run 44193888713: noMigrationTouchesExerciseImage FAILED — found 64.sqm beyond the base 63.sqm). The fix reached main as a direct push (c28f5094), not through a gated PR. The content is test-only and correct, but the bypass is flagged for the orchestrator.

Issue linkage

Refs #1358 only (closingIssuesReferences: []). #1358 read back as CLOSED / COMPLETED (closedAt 2026-11-17T22:07:45Z). Issue state was not modified.

— phoenix-rca merge gate (kanban t_f19ea2fd)

…-attach-gate-discrimination

# Conflicts:
#	shared/src/commonTest/kotlin/com/devil/phoenixproject/presentation/ExerciseMediaWiringTest.kt
@9thLevelSoftware

Copy link
Copy Markdown
Owner Author

Merge-to-main re-gate (t_e40b37fa): APPROVED at exact head 9767ef87bd6ed927b8b480d131cd8095615efe1c.

Scope: post-conflict-resolution delta only; substance was approved at 9be639be by t_f19ea2fd (#1409 (comment)).

  1. Delta vs approved head 9be639b. Only ExerciseMediaWiringTest.kt changed (+3/-5): the T6 guard-(a) comment and the assertion message, both now in main's wording. There is still exactly one maxSeen <= 64 assertion (L126), and guard (b) mentions == listOf("43.sqm") is unchanged (L130). The other 5 PR files have blob SHAs identical to 9be639b (AttachGateTest a88c716, ForwardingTest f6f97b2, CreateExerciseDialog f18a9f5, ExercisePicker 3fca222; HostPhotoAttachTest absent in both). T6 at the head is byte-identical to main c28f509.
  2. Delta vs main. It is the 5 PR files plus comment and message text in ExerciseMediaWiringTest (KDoc ~L341, message ~L373). No code change in that file.
  3. CI at 9767ef8. CI Tests run 44205717140 succeeded: Unit Tests, Lint Check, iOS Schema Sync Check, iOS Test Target Compile, Build Android (all required), Security Hygiene, Shared Module and Android App Unit Test Results, and GitGuardian all passed. iOS Simulator (non-blocking) was skipped. tvOS run 44205717179 succeeded: native-tv and native-tv-device both passed. The PR is MERGEABLE/CLEAN.

The earlier mutation-discrimination and seam-neutrality results are not affected by a comment-only delta.

Merging via the PR only (squash, --match-head-commit). This uses Refs #1358 only, so #1358 stays CLOSED/COMPLETED.

@9thLevelSoftware
9thLevelSoftware merged commit 2802c9a into main Nov 18, 2026
12 checks passed
@9thLevelSoftware
9thLevelSoftware deleted the test/issue-1358-photo-attach-gate-discrimination branch November 18, 2026 01:04
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.

2 participants