Repository navigation
test: close the classes a twelfth five-run hygiene sweep found - #14421
Conversation
|
Intent: Make a full backend run on a large Linux host green for the right reasons -- every red of a five-run sweep fixed at the seam that inherits across |
80a7d57 to
720e95e
Compare
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify #14388 landed before merge — this PR deliberately omits the shared hooks-globals/ssh-pin fixes and its [DESIGN-REVIEWED] 8641444 |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The new doc line "the pin now sits in every module that builds the launcher" is contradicted by count: Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: FIX — make the Linux full-suite run red-free for real reasons, and fix two user-visible defects: PDF extraction under a >1 GiB gateway and Ctrl-C in terminals from a backgrounded gateway. (More than 10 items; the 10 most noticeable kept.)
[FIRST-PRINCIPLES-REVIEWED] 8641444 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Five full rounds on Linux (16 workers, 139,019 backend tests, 39,695 vitest, 2,204 electron per round) on a fresh venv with a live gateway on the host. Every class is fixed at the seam that inherits, not in the test that noticed, and each is written into the testing spec as the twelfth pass. Production: - pdf_extract_child: on Linux read the child's own VmHWM, not ru_maxrss, which execve seeds with the parent's peak -- a gateway over 1 GiB could not extract any PDF (7 reds, 5/5). - platform_compat: proc_peak_rss_bytes / proc_rss_bytes read the same own VmHWM (monotonic floor); the dashboard peak and the process gauge were the parent's number for the gateway's whole life. - _spawn_exec_shim: a --ctty-fd spawn resets inherited SIG_IGN to SIG_DFL before exec, so a gateway started as a background job still opens terminals where Ctrl-C reaches the foreground job. - prepare-pr push_guard: both `git patch-id --stable` calls go through run(), so the injected git covers them. - scripts/run_scoped_tests: _read_text no longer caches every test file's text for the process (+189 MiB per gate run). - test/source_corpus: repo_files() hands the run's scratch roots to git as --exclude instead of walking 126k scratch entries (27 s -> 0.5 s). Tests: preflight fence root pinned under a repo-internal TMPDIR; terminal Ctrl-C test gated on tcgetpgrp and reaped in finally; hooks globals pinned before a real dashboard boot; kiro-cli / ssh / git / ps resolver seams pinned in the modules that reached the host binaries; SQLite handles closed through the opened() fixture; env leak from a module-scoped patch.dict; class-27 pid reuse in two driver-reap tests; kill census (707 signals, 0 foreign).
720e95e to
8641444
Compare
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal: A full backend run on a big Linux host is green for the right reasons, and two things a user can see -- PDF extraction and Ctrl-C in a terminal -- work when the gateway is large or was started as a background job.
Five full rounds of the suite on a 32-core Linux host (139,019 backend tests per round, 16 workers, a fresh venv, a live gateway on the same host) were red in every round: 19, 21, 16, 20, 17. Twelve tests failed 5/5 and pass at
-n0. Ten more flipped between rounds. Unit tests reached the host's realkiro-cli,ssh,gitandps; eight files left SQLite handles open; one module leaked two env keys for 159 tests.Why it matters
Two of the reds are product bugs, not test bugs. A gateway whose RSS is over 1 GiB cannot extract any PDF on Linux: the extractor child inherits the parent's peak RSS across
execveand its own watchdog kills it before it reads a byte. A gateway launched withcmd &ornohupfrom a script opens terminals where Ctrl-C reaches nothing, becauseSIG_IGNsurvivesexecinto the shell and every job under it. The dashboard's peak-memory number and the process gauge were the parent's, for the gateway's whole life.The rest is the usual cost of a red-on-some-orderings suite: a test that ships green from one run and fails someone else's PR.
Not a goal
hooks_integrationrestore floor, the vitest clock red (fix(test): stop a fixed-date fixture colliding with a pinned relative age #14390), thessh -Vpins intest_sandbox_md_notebook_carveout.pyandtest_sandbox_mount_checked.py.SIGPIPE/SIGXFSZhandling for NON-terminal spawns (a latent defect with its own test to write).session_pid._sync_kill_provider's unpinnedkill_pidat a snapshot pid (a class-27 candidate for its own change).aiohttp"changing state of started application" warnings.What changed (motivation → approach → change)
pdf_extract_child.py'speak_rss_bytes()readru_maxrss; Linux seeds it with the parent's high-water mark atexecveVmHWMfrom/proc/self/status;ru_maxrssstays the macOS sourceplatform_compat.py(proc_peak_rss_bytes/proc_rss_bytes)VmHWMreader, clamped monotonic_spawn_exec_shim.pyresets inheritedSIG_IGNtoSIG_DFLon the--ctty-fdpath beforeexecgh.cmdunder a repo-internalTMPDIRsits inside the working-tree fence_WORKTREE_ROOT) to atmp_pathsiblinghooks_integrationglobals bound (fixed in #14388)spawn_no_cwdinstalled_kiro_cli_version,ssh -V,code_fingerprint, doctor'swarm_backend, a hand-rolled_stub_port_ownercopypush_guard.py's twogit patch-idcalls go throughrun()fd_leak(8 files)opened()fixture,close_skills_loaders, managerclose(), recorded states releasedenv_leak(159 tests)mock.patch.dict(os.environ)monkeypatch.setenvheavy_rss/slowscripts/run_scoped_tests.py's_read_textcached every test file;repo_files()let git walk the run's scratch--excludekill(707 signals)os.kill(pid, 0)and a raw SIGKILL at a reissued pidpid_exists;get_process_start_id+kill_pid_pinnedacp_launch_capturestubbedallocate_scratchwith a fixed/opt/scratch/dsh-sessionand the arm wrote into ittmp_pathEvery fix is at the seam that inherits or resolves, never in the assertion that noticed. The testing spec gains the twelfth-pass section with the measurements, and
writing-tests/SKILL.mdgains one checklist line per class. Thedocs/architectureandplatform-compatdocs name the new RSS source.This PR is the Linux twin of #14388 (macOS, same day, same base). Where both found the same thing -- the hooks-globals floor, the vitest clock red (#14390), two sandbox
sshpins -- this PR carries no change and relies on #14388 landing first.test/acp_launch_capture.pyis touched by both: #14388 stubs the removal, this PR gives the arm a real scratch directory (it also unlinks.ownerthere); the rebase keeps this version.Backwards compatibility
Compatible: production behaviour changes only where it was wrong -- a PDF a large gateway refused now extracts, a terminal a backgrounded gateway opened now delivers Ctrl-C, a diagnostics peak that was the parent's is now the process's. No accepted input is rejected, renamed or removed.
push_guard.run()gains an optionalinput=argument.Tests
test_pdf_extract.py::TestRssWatchdogandtest_platform_compat.py::TestPeakRssIsThisProcesss: a fake/procstatus through a seam; a parent that touches 256-512 MiB spawns a child that must still report a small own peak and extract page 1; the monotonic clamp; malformed status ->None/0, never a guess.test_terminal_handler.py: the first Ctrl-C waits fortcgetpgrpto leave the shell's group; a sibling test proves the shell gets the foreground back; the session is reaped infinally.test_preflight_write_permission.py: passes under aTMPDIRinside the checkout and under the default.test_push_guard.py::test_patchid_failure_refuses: fails before therun()routing, passes after.test_local_gate.py::test_the_reference_scan_reads_each_test_file_once_and_drops_it;test_source_corpus.pyconsumes iterators.test_acp_launch_goldens.py::test_the_deepseek_capture_writes_its_scratch_windows_only_under_tmp_path.kiro-cli,ssh -V,code_fingerprint,warm_backend; the two driver-reap tests carry the grandchild's start-time identity.-n4: 4,548 passed, 48 skipped.Manual verification
hygiene/rss_inherit_probe.pyon the host: a 1,312 MiB parent -> childru_maxrss1,312 MiB, childVmHWM11 MB -- the mechanism, first-hand.Screenshots / video
N/A -- no user-visible frontend change (the vitest fix is #14390).
Related Issues
N/A -- found by the sweep, no tracked issue.