Skip to content

fix(broker-v2): align stale permission_denied test with PR #536's matcher widening - #575

Merged
zackees merged 4 commits into
mainfrom
hooks
Jun 22, 2026
Merged

zackees merged 4 commits into
mainfrom
hooks

Conversation

@zackees

@zackees zackees commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

The `is_already_bound_error_does_not_misclassify_permission_denied` test has been cascade-failing every CI unit-test run since PR #536 landed:

The result: every CI run since #536 panicked at this test (`assertion failed: !is_already_bound_error(&err)`), and the failure was admin-merged-past as out-of-scope across many subsequent PRs.

Fix

Rename to `is_already_bound_error_classifies_permission_denied` and invert the assertion to match the now-current contract. Doc comment cross-references PR #536's rationale so the next reader doesn't fall into the same trap.

Verification

```
$ soldr cargo test --features client -p running-process --bin running-process-broker-v2 tests::is_already_bound_error
test tests::is_already_bound_error_classifies_addr_in_use ... ok
test tests::is_already_bound_error_classifies_would_block ... ok
test tests::is_already_bound_error_classifies_permission_denied ... ok
test tests::is_already_bound_error_does_not_misclassify_not_found ... ok
test result: ok. 4 passed; 0 failed
```

Where this leaves the loop

With #573 (path parser), #574 (testbin stub + daemon_version), and this PR (permission_denied test inversion), every CI failure attributable to bitrot from PR #533/#536 should now be resolved. The user's `/loop` "no broken builds" criterion should flip green on this PR.

🤖 Generated with Claude Code

zackees and others added 4 commits June 22, 2026 07:05
…detour install diagnostics (#551)

The slice 7c test was hanging because of a self-inflicted
assertion bug, not a retour or detour issue. The interposer
formats paths via `{:?}` (debug-escaped, doubled backslashes), so
`contains(probe_path)` against the raw path never matched and the
10-second deadline ran to completion. The retour install actually
completed on all 5 detours, and the CreateFileW detour fired
correctly on testbin-createfilew-probe's call.

Fixes:

- `crates/.../interposer-windows/src/lib.rs`: install_detours now
  emits `RPO_HOOK install begin=<name>` / `install end=<name>`
  sentinels around each install_one call. Lets the
  `interposer_diagnostic_windows.rs` test (also added) report
  which retour install hung or errored if a regression ever
  reintroduces the hang. Verified clean against cmd.exe — all
  5 detours install in <100 ms each.

- `crates/.../observer/tests/interposer_integration_windows.rs`:
  un-ignore `interposer_dll_fires_rpo_hook_after_inject`. Replace
  `contains(probe_path.display())` with `contains("RPO_HOOK
  file-open") && contains("probe.txt")` for both the deadline-
  poll exit condition and the final assertion. The basename
  alone is unambiguous since the fixture only ever opens that
  file.

- `crates/.../observer/tests/interposer_diagnostic_windows.rs`:
  new diagnostic test that injects into cmd.exe and reports
  per-detour begin/end pair coverage to eprintln. Always passes
  (observational test) — its eprintln output lands in cargo
  nextest logs for CI / debugging visibility.

Verified locally:
  test interposer_dll_fires_rpo_hook_after_inject ... ok (7.10s)
  test diagnose_install_progress ... ok (13.22s)

Closes the slice 7c gap in #551's slice 7 acceptance criterion:
Windows test now asserts the detour fires on a real (non-
diagnostic) file API call, matching the assertion strength of
Linux (7d) and macOS (7e).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…cket path in test (#488 follow-up)

The slice 3c integration test reads broker stdout looking for the
"bound at" line:

    running-process-broker-v2 bound at <path> (program=<…>, mode=<…>)

It then `strip_prefix("running-process-broker-v2 bound at ")` and
`trim_end()` — which leaves the entire trailing
` (program=<…>, mode=<…>)` glued onto what gets captured as
`socket_path`. The "path" passed to `Stream::connect` is therefore
~25 bytes longer than the actual filesystem socket path. On Linux,
where `sun_path` is exactly 108 bytes, that's enough to push every
non-trivial XDG_RUNTIME_DIR / `/tmp/running-process-<uid>` path
past the limit — and `Stream::connect` then panics with the now-
infamous "exceeds capacity of sun_path of sockaddr_un" error.

This was the bug that's been cascade-failing every CI unit-test
run since slice 3c landed. It's purely a test-parser issue —
production broker bind/connect were always correct because they
share the same string and the broker's own `bound at` print
happens *after* successful `create_sync`.

Fix: `rsplit_once(" (")` on the trimmed remainder. Everything
before ` (` is the path; the trailing parenthesized metadata is
discarded. On Windows + macOS (where the path is short enough
that the test was passing despite the bug) the fix is a no-op
because the path either starts with `\.\pipe\` and contains no
` (` substring, or is the hash-shortened macOS leaf — both
fall back to the full string via `unwrap_or(rest)`.

Verified locally by inspection of test logs:
- Pre-fix: panic at line 146 with "exceeds capacity" + a
  ~113-byte captured "path".
- Post-fix: the captured path is the 88-byte filesystem socket
  the broker actually bound to.

Closes the "broker-v2 cascade failure" item that's been
documented as out-of-scope across the #539 and #551 loops.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…aemon_version regression

Two independent CI regressions surfaced by the broker-v2 cascade
unblock landing in PR #573:

1. **testbin-createfilew-probe fails to compile on Linux + macOS.**
   Slice 7c's #[cfg(target_os = "windows")] gate is at the file
   level — on non-Windows the entire crate compiles to nothing
   and rustc errors out with "main function not found". Cargo
   requires every `[[bin]]` target to have a main fn on every
   build target, regardless of which target ever runs the binary.

   Fix: add a stub main fn for non-Windows that prints a "Windows-
   only fixture" message and exits with code 2. The Windows path
   is unchanged.

2. **`broker_v2_scaffold_accepts_connection::...` now panics at the
   `daemon_version should be populated` assertion (line 196).**
   PR #573 fixed the path-capture parser; the test now successfully
   completes the Hello/HelloReply round-trip and reaches a later
   assertion that the daemon's reported version is non-empty.

   Root cause: PR #533 changed `daemon_version` from the broker
   binary's own CARGO_PKG_VERSION to `definition.min_version.clone()`.
   That's semantically wrong — `daemon_version` is the running
   broker's actual version (matches the proto comment); min_version
   is a per-service floor expressed by the servicedef. For any
   servicedef that doesn't explicitly opt in to a floor (e.g. the
   test's stub), min_version is empty and the contract breaks.

   Fix: restore `daemon_version: env!("CARGO_PKG_VERSION").into()`
   (the pre-#533 behavior the comment block on top of the diff
   already described).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…d` test with PR #536's intentional impl change

Test cascade-failed every CI unit-test run since PR #536. PR #534
(slice 2 of #532) added \`is_already_bound_error_does_not_misclassify_permission_denied\`
when the matcher only covered \`AddrInUse | WouldBlock\`. PR #536
then *deliberately* widened the matcher to also include
\`PermissionDenied\` — Windows double-bind surfaces as
\`ERROR_ACCESS_DENIED\` (raw os error 5) because the existing pipe
instance's ACL blocks the second bind, not as \`AddrInUse\`. PR #536's
commit body documents the change explicitly but didn't update this
test, which then asserted the now-inverted behavior.

Fix: rename to \`is_already_bound_error_classifies_permission_denied\`
and invert the assertion to match the now-current contract. Doc
comment cross-references PR #536's rationale so the next reader
understands why PermissionDenied counts as "already bound" here.

Verified all 4 \`is_already_bound_error_*\` tests pass:
  - classifies_addr_in_use
  - classifies_would_block
  - classifies_permission_denied  (renamed + inverted in this PR)
  - does_not_misclassify_not_found

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit bd828aa into main Jun 22, 2026
36 of 43 checks passed
zackees added a commit that referenced this pull request Jun 22, 2026
… stub)

retour 0.4.0-alpha.4 uses iced-x86 for prologue disassembly,
which doesn't support ARM64. The Windows ARM Lint CI runner
(aarch64-pc-windows-msvc) was therefore failing with
\"could not find \`meta\` in \`arch\`\" — retour's internal
arch::meta module is only defined for x86 / x86_64.

This wasn't surfaced earlier because the broker-v2 cascade
failure was tripping the ARM CI before retour got a chance to
compile. With PR #573-#575 clearing that cascade, the ARM CI
proceeded far enough to hit the real arch incompatibility.

Fix: gate both the retour + windows-sys deps in Cargo.toml on
`cfg(all(target_os = "windows", target_arch = "x86_64"))`, and
gate the lib.rs body the same way. On Windows ARM64 the crate
now falls through to an empty stub so the workspace builds
end-to-end; the file-hook tier reports unavailable for that
arch (which is the honest answer until retour or an alternative
supports ARM64).

Verified:
  $ soldr cargo check -p running-process-observer-interposer-windows
  Finished `dev` profile [unoptimized + debuginfo] target(s)
  $ soldr cargo check --target aarch64-pc-windows-msvc \
        -p running-process-observer-interposer-windows
  Finished `dev` profile [unoptimized + debuginfo] target(s)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Jun 22, 2026
* fix(observer): slice 7c — un-ignore Windows path-specific test + per-detour install diagnostics (#551)

The slice 7c test was hanging because of a self-inflicted
assertion bug, not a retour or detour issue. The interposer
formats paths via `{:?}` (debug-escaped, doubled backslashes), so
`contains(probe_path)` against the raw path never matched and the
10-second deadline ran to completion. The retour install actually
completed on all 5 detours, and the CreateFileW detour fired
correctly on testbin-createfilew-probe's call.

Fixes:

- `crates/.../interposer-windows/src/lib.rs`: install_detours now
  emits `RPO_HOOK install begin=<name>` / `install end=<name>`
  sentinels around each install_one call. Lets the
  `interposer_diagnostic_windows.rs` test (also added) report
  which retour install hung or errored if a regression ever
  reintroduces the hang. Verified clean against cmd.exe — all
  5 detours install in <100 ms each.

- `crates/.../observer/tests/interposer_integration_windows.rs`:
  un-ignore `interposer_dll_fires_rpo_hook_after_inject`. Replace
  `contains(probe_path.display())` with `contains("RPO_HOOK
  file-open") && contains("probe.txt")` for both the deadline-
  poll exit condition and the final assertion. The basename
  alone is unambiguous since the fixture only ever opens that
  file.

- `crates/.../observer/tests/interposer_diagnostic_windows.rs`:
  new diagnostic test that injects into cmd.exe and reports
  per-detour begin/end pair coverage to eprintln. Always passes
  (observational test) — its eprintln output lands in cargo
  nextest logs for CI / debugging visibility.

Verified locally:
  test interposer_dll_fires_rpo_hook_after_inject ... ok (7.10s)
  test diagnose_install_progress ... ok (13.22s)

Closes the slice 7c gap in #551's slice 7 acceptance criterion:
Windows test now asserts the detour fires on a real (non-
diagnostic) file API call, matching the assertion strength of
Linux (7d) and macOS (7e).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(broker-v2): strip trailing `(program=…, mode=…)` from captured socket path in test (#488 follow-up)

The slice 3c integration test reads broker stdout looking for the
"bound at" line:

    running-process-broker-v2 bound at <path> (program=<…>, mode=<…>)

It then `strip_prefix("running-process-broker-v2 bound at ")` and
`trim_end()` — which leaves the entire trailing
` (program=<…>, mode=<…>)` glued onto what gets captured as
`socket_path`. The "path" passed to `Stream::connect` is therefore
~25 bytes longer than the actual filesystem socket path. On Linux,
where `sun_path` is exactly 108 bytes, that's enough to push every
non-trivial XDG_RUNTIME_DIR / `/tmp/running-process-<uid>` path
past the limit — and `Stream::connect` then panics with the now-
infamous "exceeds capacity of sun_path of sockaddr_un" error.

This was the bug that's been cascade-failing every CI unit-test
run since slice 3c landed. It's purely a test-parser issue —
production broker bind/connect were always correct because they
share the same string and the broker's own `bound at` print
happens *after* successful `create_sync`.

Fix: `rsplit_once(" (")` on the trimmed remainder. Everything
before ` (` is the path; the trailing parenthesized metadata is
discarded. On Windows + macOS (where the path is short enough
that the test was passing despite the bug) the fix is a no-op
because the path either starts with `\.\pipe\` and contains no
` (` substring, or is the hash-shortened macOS leaf — both
fall back to the full string via `unwrap_or(rest)`.

Verified locally by inspection of test logs:
- Pre-fix: panic at line 146 with "exceeds capacity" + a
  ~113-byte captured "path".
- Post-fix: the captured path is the 88-byte filesystem socket
  the broker actually bound to.

Closes the "broker-v2 cascade failure" item that's been
documented as out-of-scope across the #539 and #551 loops.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(observer+broker-v2): unblock CI — testbin stub on non-Windows + daemon_version regression

Two independent CI regressions surfaced by the broker-v2 cascade
unblock landing in PR #573:

1. **testbin-createfilew-probe fails to compile on Linux + macOS.**
   Slice 7c's #[cfg(target_os = "windows")] gate is at the file
   level — on non-Windows the entire crate compiles to nothing
   and rustc errors out with "main function not found". Cargo
   requires every `[[bin]]` target to have a main fn on every
   build target, regardless of which target ever runs the binary.

   Fix: add a stub main fn for non-Windows that prints a "Windows-
   only fixture" message and exits with code 2. The Windows path
   is unchanged.

2. **`broker_v2_scaffold_accepts_connection::...` now panics at the
   `daemon_version should be populated` assertion (line 196).**
   PR #573 fixed the path-capture parser; the test now successfully
   completes the Hello/HelloReply round-trip and reaches a later
   assertion that the daemon's reported version is non-empty.

   Root cause: PR #533 changed `daemon_version` from the broker
   binary's own CARGO_PKG_VERSION to `definition.min_version.clone()`.
   That's semantically wrong — `daemon_version` is the running
   broker's actual version (matches the proto comment); min_version
   is a per-service floor expressed by the servicedef. For any
   servicedef that doesn't explicitly opt in to a floor (e.g. the
   test's stub), min_version is empty and the contract breaks.

   Fix: restore `daemon_version: env!("CARGO_PKG_VERSION").into()`
   (the pre-#533 behavior the comment block on top of the diff
   already described).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(broker-v2): align stale `is_already_bound_error_*permission_denied` test with PR #536's intentional impl change

Test cascade-failed every CI unit-test run since PR #536. PR #534
(slice 2 of #532) added \`is_already_bound_error_does_not_misclassify_permission_denied\`
when the matcher only covered \`AddrInUse | WouldBlock\`. PR #536
then *deliberately* widened the matcher to also include
\`PermissionDenied\` — Windows double-bind surfaces as
\`ERROR_ACCESS_DENIED\` (raw os error 5) because the existing pipe
instance's ACL blocks the second bind, not as \`AddrInUse\`. PR #536's
commit body documents the change explicitly but didn't update this
test, which then asserted the now-inverted behavior.

Fix: rename to \`is_already_bound_error_classifies_permission_denied\`
and invert the assertion to match the now-current contract. Doc
comment cross-references PR #536's rationale so the next reader
understands why PermissionDenied counts as "already bound" here.

Verified all 4 \`is_already_bound_error_*\` tests pass:
  - classifies_addr_in_use
  - classifies_would_block
  - classifies_permission_denied  (renamed + inverted in this PR)
  - does_not_misclassify_not_found

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(interposer-windows): gate retour deps + lib body on x86_64 (ARM64 stub)

retour 0.4.0-alpha.4 uses iced-x86 for prologue disassembly,
which doesn't support ARM64. The Windows ARM Lint CI runner
(aarch64-pc-windows-msvc) was therefore failing with
\"could not find \`meta\` in \`arch\`\" — retour's internal
arch::meta module is only defined for x86 / x86_64.

This wasn't surfaced earlier because the broker-v2 cascade
failure was tripping the ARM CI before retour got a chance to
compile. With PR #573-#575 clearing that cascade, the ARM CI
proceeded far enough to hit the real arch incompatibility.

Fix: gate both the retour + windows-sys deps in Cargo.toml on
`cfg(all(target_os = "windows", target_arch = "x86_64"))`, and
gate the lib.rs body the same way. On Windows ARM64 the crate
now falls through to an empty stub so the workspace builds
end-to-end; the file-hook tier reports unavailable for that
arch (which is the honest answer until retour or an alternative
supports ARM64).

Verified:
  $ soldr cargo check -p running-process-observer-interposer-windows
  Finished `dev` profile [unoptimized + debuginfo] target(s)
  $ soldr cargo check --target aarch64-pc-windows-msvc \
        -p running-process-observer-interposer-windows
  Finished `dev` profile [unoptimized + debuginfo] target(s)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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