Skip to content

test(core): isolate containment tests from load and concurrent pruning - #245

Merged
ElbertePlinio merged 2 commits into
mainfrom
fix/220-238-containment-test-races
Oct 5, 2026
Merged

ElbertePlinio merged 2 commits into
mainfrom
fix/220-238-containment-test-races

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Both flakes come from the tests, not the product. Product code, prune rules and product timeouts are unchanged.

#220: the re-creation test made its scope in the shared delegated cgroup. Any other worker that calls createContainmentScope prunes empty pickforge-* siblings there. That removed the scope before the assertions ran. The test now builds its scope in a private parent cgroup, desk-recreate-<pid>. This name has no pickforge- prefix, so pruning never touches it. The test still checks that ensureContainmentScope re-creates the pruned directory with the same token and path.

#238: destroyContainmentScope confirms only after two empty scans of all of /proc, with a 25 ms poll between them. The classification cases gave each sweep 60 ms. On a loaded host, one scan can take longer than that. The cases now use 2000/1000 ms. A clean run still returns after about 80 ms. The fixture never settles, so a misclassified exec still fails, after about 3 s. A temporary mutation that removed the PF_KTHREAD filter confirmed this; the mutation was reverted.

QA pass skipped: this change is test-only and has no user-facing behavior.

Requirement Verified by Scenario Result Evidence
#220 re-creation survives concurrent pruning Load reproduction Background pruner limited to the test's scope name, before and after Before: 3 of 3 failed (ENOENT and existsSync). After: 3 of 3 passed Local run
#238 classification survives CPU load Load reproduction 8 exec-churn loops and vitest pinned to CPUs 0-1 Before: 4 of 40 cases failed. After: 40 of 40 passed Local run
#238 root cause Probe destroyContainmentScope on a fresh scope under exec churn 60/60 ms: 109 of 150 unconfirmed. Default deadlines: 150 of 150 confirmed Local run
Misclassification still detected Mutation check PF_KTHREAD filter removed Case fails on the assertion after 3071 ms Local run
File passes and the cgroup path runs Automated test vitest run packages/core/test/containment.test.ts 60 of 60 passed, cgroup mechanism, no skip Local run, CI
Lint, types, function limits oxlint, tsc, PickCheck 0.4.0 --base origin/main All clean Local run

Closes #220
Closes #238

The scope re-creation test now works in a private parent cgroup. A
createContainmentScope call in another worker prunes empty scopes in the
shared delegated cgroup, so it could remove the re-created scope before
the assertions ran.

The exec classification cases now use deadlines that outlast two full
/proc scans on a loaded host. With 60 ms deadlines a slow scan, or an
unrelated host process that briefly looks mid-exec, left cleanup
unconfirmed. The fixture never settles, so a misclassified exec still
fails the test.

Closes #220
Closes #238
A fixed pid-based name could collide with a leftover from a killed
worker, and a failed cleanup went unreported.
@ElbertePlinio
ElbertePlinio merged commit 097913c into main Oct 5, 2026
22 of 35 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/220-238-containment-test-races branch October 5, 2026 22:05
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.

test: containment initial exec discovery flakes under parallel load test: containment scope re-creation races concurrent pruning

1 participant