Skip to content

fix: follow-up for #146 (CI, test record, pins README) - #174

Merged
chaodu-agent merged 3 commits into
mainfrom
fix/pr146-followup
Nov 20, 2026
Merged

chaodu-agent merged 3 commits into
mainfrom
fix/pr146-followup

Conversation

@chaodu-agent

Copy link
Copy Markdown
Contributor

Context

This PR follows the merge of #146 at 3f6afbe to main on 2026-11-19. That PR merged before its CI and council review were complete. The owner chose to keep it and fix forward. This PR carries those follow-up fixes.

Fixes

  • 6366a05 fix(linux): paging deadline test measured its own serialisation. The test built a 64 MB body and timed post(), which serialises the body inside the request deadline. On a debug build that took about 4 s, so the test failed even though the request ended at its 500 ms deadline. The body is now 16 MB, still larger than the socket buffers, and the bound is 3 s. The server releases the socket after 4 s, so a request that ignored its deadline still fails.
  • d29d8e6 test(pins): guard the README npm ci isolation settings. Tests/Fixtures/README.md already had --ignore-scripts, --userconfig, --globalconfig, --cache, --registry https://registry.npmjs.org/ and HOME=, matching run_smoke. Nothing enforced that. FixtureReadme now fails when one of these settings is removed from the README (checked on a copy). It also checks that run_smoke still passes the flags.

Files changed: poc/reverse-attach-linux/src/external_tests.rs, scripts/test-playwright-pins.py.

Verification at head d29d8e6c4ae9277aed8a0f3c7571af8533fffe01

Both runs used git archive HEAD. These are local runs. No CI run exists for this commit, so this PR does not have a CI pass.

Swift (Apple Silicon build host)

  • swift build: Build complete!, exit 0.
  • swift test: Executed 852 tests, with 5 tests skipped and 0 failures (0 unexpected), exit 0.
  • Failing tests: none.
  • Skipped: 5. Two WizardSnapshotTests (testBrowserStates, testWizardPages) skip unless OAB_SNAPSHOT_DIR is set. The other three are skipped inside other suites.

Rust (aarch64 Linux host)

  • cargo fmt --check: exit 0, no diffs.
  • cargo clippy -- -D warnings: exit 0, clean.
  • cargo test --no-fail-fast: 598 passed, 1 failed, 17 ignored.
    • Failing test: proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic. It panics at assertion failed: raw >= 0 in rustix 1.1.6 src/pid.rs:44. Pre-existing: it also fails on the base commit, so this PR does not introduce it and does not fix it.
    • install:: tests: none failed.
  • The paging test passes. It also passed in three more cargo test paging runs.

Python (aarch64 Linux host)

  • scripts/test-playwright-pins.py: 54 tests OK.

Head

d29d8e6c4ae9277aed8a0f3c7571af8533fffe01

a_server_that_stops_reading_ends_the_request_by_the_deadline built a 64 MB
body and timed the whole post(). post() serialises the body inside the
request deadline, and a debug build takes about 4 s to serialise 64 MB, so
the test saw 4.2 s for a request that ends at its 500 ms deadline.

Change: the body is 16 MB, still larger than the loopback socket buffers,
and the elapsed bound is 3 s. The server releases the socket after 4 s, so a
request that ignored its deadline still fails the bound.

Checks, run on the aarch64 Linux host against a copy of this tree:
- cargo fmt --check: exit 0
- cargo clippy -- -D warnings: exit 0
- cargo test --no-fail-fast: 598 passed, 1 failed, 17 ignored. The paging
  test passes. The one failure is
  proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic,
  which also fails on the base commit (pre-existing, not changed here).
Tests/Fixtures/README.md tells the reader how to re-record the Playwright
fixture with an isolated npm ci: --ignore-scripts, --userconfig,
--globalconfig, --cache, --registry https://registry.npmjs.org/ and HOME.
Those are the same settings run_smoke passes in scripts/playwright-pins.py.
The README already had them. Nothing checked that they stayed there.

Change: FixtureReadme checks that the README names each setting, and that
run_smoke still passes the flags. Removing --cache from the README makes the
new test fail; restoring it makes the test pass.

Checks, run on the aarch64 Linux host against a copy of this tree:
- python3 scripts/test-playwright-pins.py: 54 tests OK, playwright pins: ok (offline)
- python3 scripts/test-playwright-pins.py FixtureReadme on a copy with --cache
  removed from the README: FAILED (failures=1); restored copy: OK
@chaodu-agent

Copy link
Copy Markdown
Contributor Author

Important

CHANGES REQUESTED ⚠️ - The paging-test fix is the right direction, but both new README/run_smoke guard tests can pass while the property they name is broken, and the paging test can pass without exercising the blocked write.

What This PR Does

Follow-up fixes for #146, which merged before CI and review finished. It retunes a flaky Rust deadline test (64 MB -> 16 MB body, 1.5 s -> 3 s bound) and adds Python tests meant to keep the npm ci isolation flags in Tests/Fixtures/README.md in sync with run_smoke.

How It Works

  • external_tests.rs: a TCP listener accepts and never reads, holding the socket for 4 s. The client posts a 16 MB body with a 500 ms deadline and must return upstream_timeout in under 3 s.
  • test-playwright-pins.py: new FixtureReadme class. One test checks that each isolation string appears somewhere in the README. The other checks that each flag appears somewhere in playwright-pins.py.
  • Test-only change. No production code is modified.

Findings

# Severity Finding Location
1 🟡 README guard searches the whole document, not the npm ci command block scripts/test-playwright-pins.py:591-593
2 🟡 run_smoke guard searches the whole file; every asserted string also exists in generate(), so the test is vacuous scripts/test-playwright-pins.py:595-599
3 🟡 Paging test deadline starts before serialisation; a slow serialise can time out before the blocked socket write is reached poc/reverse-attach-linux/src/external.rs:223,228; external_tests.rs:711-723
4 🟡 PR title promises "CI, test record, pins README" but the diff has only the paging test and the README guard PR title
5 🟢 Test-only, small blast radius; comments explain the 16 MB and 3 s choices; 4x less allocation in the paging test -
Finding Details

🟡 F1: README guard does not check the npm ci step

test_the_readme_npm_ci_step_names_every_isolation_setting runs s not in doc over the entire README. A flag that moves to unrelated prose or another shell block still passes, and plain substring matching accepts near-misses such as XHOME= or --cache-foo. The docstring says "the npm ci step ... must carry"; the code checks "the README mentions".

Requested change: extract the fenced block that contains npm ci (currently Tests/Fixtures/README.md:33-38), split it with shlex, and compare tokens. Include --omit=dev (it changes the installed tree); consider --no-audit / --no-fund too.

🟡 F2: run_smoke guard is vacuous

test_run_smoke_passes_the_same_isolation_flags runs assertIn over all of playwright-pins.py. generate() at scripts/playwright-pins.py:991-994 already contains --ignore-scripts, --userconfig, --globalconfig, --cache, --registry and "HOME": work in its npm install --package-lock-only call. run_smoke could drop every one of them and this test would still pass. It also does not check that the command is still npm ci, and it omits --omit=dev, --no-audit, --no-fund.

Requested change (any one):

  1. Best: move the npm argv/env construction into one helper used by run_smoke, and test the helper output against the README tokens from F1.
  2. Mock subprocess.run, call run_smoke, and assert on the exact argv and env it received.
  3. Minimum: scope the search to inspect.getsource(pins.run_smoke).

🟡 F3: Paging test can pass without testing the blocked write

post() computes end at external.rs:223 and only then serialises the body (msg.to_string(), external.rs:228). The PR description reports about 4 s to serialise 64 MB in a debug build, so 16 MB takes about 1 s, which is longer than the 500 ms deadline. In that case owner.check(..., end) or the first timed_out(end) check in write_before() returns upstream_timeout before any byte is written. The test then passes without proving that a blocked write is cut off by the deadline. started.elapsed() also includes serialisation, so a slow or loaded host moves a passing run toward the 3 s bound while the failing case stays the same.

CI runs cargo test --release, where serialisation is much faster, so CI likely does exercise the intended path. Debug runs, including the local runs reported in the PR description, likely do not.

Requested change: make the test independent of serialisation time. Options: test write_before() directly with a pre-built byte buffer against the non-reading listener; or add a test-only path that posts an already-serialised body; or pick a payload that serialises well under 500 ms in debug and still exceeds the socket buffers.

Optional: the test always waits the full 4 s on t.join() even when it passes. That is fine for one test, but the pattern should not be copied.

🟡 F4: Title and scope do not match

The title lists "CI, test record, pins README". The diff changes no CI workflow and no test record file. Please retitle to match the two fixes, or add the missing commits.

🟢 F5: Good

Both hunks are test-only. The new comments state why 16 MB and 3 s were chosen. Smaller allocation in a debug build is a strict improvement.

CI / Status
  • All required checks are green at d29d8e6.
  • Linux hands node (amd64) failed on attempt 1 in probe::tests::a_tree_that_listens_is_reported_by_kind_and_a_silent_one_as_none (src/probe_tests.rs:111). This PR does not touch that test or probe. Attempt 2 passed. This looks like a separate flaky test and should be tracked on its own.
  • scripts/playwright-pins.py:991-994 evidence for F2 was read from the local checkout at the reviewed head.
Baseline Check
  • PR opened: 2026-11-20, base main, head d29d8e6c4ae9277aed8a0f3c7571af8533fffe01
  • Merge-base: 3f6afbe8447d0c2195c2262da272e09bcaccdef7 (the fix: plain input schemas for ui_snapshot and ui_action (closes #145) #146 merge)
  • Diff: 2 commits, 2 files, +23/-2
  • Main already has: the paging deadline test (64 MB, 1.5 s) and the README npm ci command with isolation flags
  • Net-new value: a less flaky paging test and a (currently weak) guard for README/run_smoke parity
Reviewer Verdicts
Reviewer Verdict Key points
Reviewer A (architecture) Changes requested F1, F2, F3, F4; prefers a shared command-builder over text search
Reviewer B (correctness) Changes requested F1, F2 (full flag set), F3 (measurement), F4
Reviewer C (security/CI) Changes requested F1, F2 (strings also in generate()), F3; no auth, secret, or dependency concerns

No external reviewer feedback on this PR yet.

5. Three Reasons We Might Not Need This PR

  1. The guards can give false confidence - as written, both new tests can pass after the command they protect has drifted, which may be worse than having no test.
  2. Text-search tests add coupling without proof - they tie the tests to source formatting but do not prove that the README and run_smoke run the same command. A shared helper would remove the need for them.
  3. The Rust change only tunes one test - its value depends on fixing F3. Otherwise it trades one timing problem for another in debug builds.

The FixtureReadme checks matched flags anywhere in their file. The run_smoke
check was a whole-file substring match, and --userconfig, --globalconfig,
--ignore-scripts and --cache also occur in the lockfile-generation call, so
removing them from run_smoke still passed.

- run_smoke: parse playwright-pins.py with ast, find the subprocess call that
  runs npm ci inside run_smoke, and require the four flags on that call and a
  HOME key in the env dict assigned inside run_smoke.
- README: take the logical command that contains npm ci (with its line
  continuations) from the fenced block and require the flags, HOME= and the
  registry on that command only. This also covers the low finding that the
  README check was a whole-document substring match.
- Low finding on the paging test bound (3 s): not changed here. A safe bound
  needs a measurement on the CI runner, and the change would be to a Rust test
  that this step did not otherwise touch.

Tests added: removing each of the four flags from the README command, from
the run_smoke npm ci call, and removing HOME from the run_smoke env fails its
test. The current README and run_smoke pass.

Verification run for this commit:
- python3 scripts/test-playwright-pins.py FixtureReadme: 5 tests, OK.
- python3 scripts/test-playwright-pins.py: 57 tests, OK; playwright pins
  offline check ok.
- Mutation, file level, one flag at a time in a scratch copy: each of
  --userconfig, --globalconfig, --ignore-scripts, --cache removed from the
  run_smoke npm ci call fails FixtureReadme; the same four removed from the
  README command fail; HOME removed from the run_smoke env fails. Unmodified
  copy: OK.
- swift build (macOS build host, scratch copy under /private/tmp): complete.
- swift test: 852 executed, 0 failures, 5 skipped.
- Rust: skipped, no .rs or Cargo file changed.
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