Skip to content

Pin MCP, CLI and Trash behavior before the async migration (M01-04d slice 4, PR 0) - #52

Merged
WahdanZ merged 2 commits into
mainfrom
m01-04d-4-0-regression-tests
Nov 18, 2026
Merged

WahdanZ merged 2 commits into
mainfrom
m01-04d-4-0-regression-tests

Conversation

@WahdanZ

@WahdanZ WahdanZ commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

PR 0 of M01-04d slice 4 (remove the three blocking async/sync bridges in 6 PRs: 0 → 1a → 1b → 2 → 3 → 4). Tests only; no Release-build behavior change. It pins what the later PRs must preserve. User approval: SAFETY-CRITICAL APPROVED for PR 0 (tests + test-hooks-only probe + hooks-only AppEngine running/quit overrides).

Pinned

Both builds (read-only children):

  • --mcp over a real subprocess: one reply per request in order (initialize, ping, tools/list, disk_status, unknown method), exact keys, -32601 for an unknown method, no reply for invalid/empty/notification lines, exit 0 at EOF
  • 50 requests then immediate EOF → 50 replies in order
  • --cli bench nosuchscan → exit 64, message, empty stdout
  • MCP move_to_trash partial-failure reply shape

Test-hooks build (behind the isolated-Trash and child-home gates):

  • MCP approval runs on the main thread (probe); replies stay in order behind a 400 ms approval; an approved confirm replies only after the file is in the isolated Trash
  • Run-loop fingerprint baseline (sync loop: ticks=0 mode=nil) — PR 1a flips it on purpose
  • trash-files: --yes exit 0; no TTY / piped yes / piped no → exit 2, nothing moved
  • "moved but unrecorded" human output and exit code
  • uninstall_app quit refusal: "did not quit", app untouched, asked once, no executor approval issued

Package: cancelling a real-disk run mid-batch leaves the remaining item on disk (.skipped(.cancelled)).

Test hooks

TestHooks.swift is wholly inside #if MACCLEANER_TEST_HOOKS; one call in the existing hooks block of Entry.main; AppEngine.isRunning/quit overrides under the same #if. check-no-test-hooks.sh now also checks the new names; strings on the Release binary: 0 hits for MACCLEANER_TEST_.

Negative control (not committed)

With --mcp under dispatchMain() the probe still reported main=1 ticks=0 mode=nil and nothing failed: PR 0 cannot tell dispatchMain apart (the loop blocks in readLine). PR 1a must flip the fingerprint and repeat this control so it fails.

Checks (local)

  • Build OK; warning budget OK (4, baselined)
  • Package: 146 pass
  • check-approval-sites.sh pass; check-no-test-hooks.sh pass (Release) and --expect-hooks pass
  • Self-test Release: 491 passed, 0 failed; test-hooks: 532 passed, 0 failed (26 s)
  • mc-reviewer: approve; both should-fix items (reply-after-move not pinned; bridge results) and the nits addressed

🤖 Generated with Claude Code

…lice 4, PR 0)

Tests only; no Release-build change. Pins what PRs 1a-4 must preserve:
- --mcp over a real subprocess (both builds): one reply per request, in
  order, exact keys, -32601 for an unknown method, no reply for invalid,
  empty or notification lines, exit 0 at EOF; 50 requests then EOF.
- --cli bench stays usable (exit 64 for an unknown scan).
- Test-hooks build: the MCP approval runs on the main thread (probe);
  replies stay ordered behind a slow approval; baseline run-loop
  fingerprint (sync loop: ticks 0, mode nil) that PR 1a flips on purpose;
  trash-files --yes / no-TTY / piped yes / piped no; moved-but-unrecorded
  output; uninstall quit refusal issues no executor approval.
- MCP move_to_trash partial failure reply shape.
- Package: cancelling a real-disk run mid-batch leaves the rest on disk.

Test hooks (TestHooks.swift, AppEngine running/quit overrides) exist only
under MACCLEANER_TEST_HOOKS; check-no-test-hooks.sh now checks their names.
…-04d slice 4)

- Hooks-only probe answer (MACCLEANER_TEST_APPROVAL_ANSWER=yes): an approved
  --mcp confirm replies only after the file is in the isolated Trash, asked
  once on the main thread, and a queued ping replies second.
- The child home/Trash gate uses the destructive children's own environment
  and fails closed when the account home is unknown.
- No process-global SIGPIPE change (F_SETNOSIGPIPE on the parent's pipe).
- Unused APP_RUNNING/APP_QUIT env hooks removed; a pre-existing Trash-log
  lock is restored.
@WahdanZ
WahdanZ merged commit 5b3b4e3 into main Nov 18, 2026
2 checks passed
@WahdanZ
WahdanZ deleted the m01-04d-4-0-regression-tests branch November 18, 2026 12:29
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