Repository navigation
test: cover the gaps the test audit found - #505
Merged
Merged
Conversation
allisonmahmood
force-pushed
the
test/prune-suites
branch
from
October 3, 2026 03:20
c7cf06d to
f52a5ba
Compare
allisonmahmood
force-pushed
the
test/fill-gaps
branch
from
October 3, 2026 03:29
4ad771a to
4058dd0
Compare
Owner
Author
|
Codex review (GPT 6.1 Sol, read-only): first pass found two majors and three minors, all fixed. A re-review of the fixes found nothing new.
Codex noted two caveats as known, not defects: the quota race also passes without the owner-row lock, because the company dependency lock already serializes creates; and two S3 metadata cases would still be refused by the SDK's own decoding if our explicit checks went. |
Gap: ADR-0004 makes credentials.json and device-login.json owner-only, but only publish attempts had a mode assertion. State now saves a key and a pending login into a fresh state directory and checks 0600 files in a 0700 directory, with no temp files left behind. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 1b996ec1965df3b76cfded2acd8c0403d1ae63ec)
Gap: ADR-0004 pins exit 130 for both SIGINT and SIGTERM, but only SIGINT was sent. The interruption test now runs for both signals. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit a9a13bb354b9a7a207a37a47046f12df2ef5d03f)
Gap: no test ran the tier 0 starter that `patchy init --tier 0` writes. publishTree can now lay out either starter, and the kept tier 0 publish case uses the real tier 0 starter: after its refusals it publishes the starter's own page, which must refresh, typecheck, build and pass the tier 0 policy. It costs no extra spawn; the init command's install path is tier-agnostic and stays covered by the tier 1 init row. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 7a44173350b13a3204bb1b8783ad10a875bbcef0)
Gap: Refusal.code was a plain string, so a typo in the definitive publish refusal list (or any other code comparison) would typecheck and silently keep or discard a saved attempt. Refusal.code is now RefusalCode, the union of every code PatchyApi's declared error schemas carry, read off the API type rather than copied. Failures relayed from an installed CLI keep string codes, since another release may declare codes this one does not. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 26b3587ac82e82d8929ce8c7b62df5ecc2f9f038)
Gap: Generation passes the caller's company to the shared-table and shared-store lookups and checks a target patch's company itself, but only a disabled source was tested. A regression that asked with the source's company would have handed one company another's schema and passed every test. The new test generates against a shared table, a shared store and a target patch in the caller's company, moves that patch to another company, and expects patch_not_openable for all three. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 93f8d49969862bbccbb44acf5ba196a0a862a0f3)
Gap: the only concurrent quota test raced identical payloads under one publish key, which is a replay, so nothing raced two different creates by one owner past the route's unlocked quota count. The new test pairs two creates with different keys and names at quota N-1 and expects exactly one 201 and one live_patch_quota_exceeded, with the count at the quota. Removing both the company dependency lock and the owner row lock from record lets both creates through, so the test fails without serialization. Removing only the owner row lock does not: record takes the company-wide dependency lock first, which already serializes the count. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 46c2e081e43d5fb8347e2101e8d31ca76f023c5c)
Gap: every sweep test used tier 0 or 1 patches, so the purge branch that queues server artifacts was never run, and a reclamation interrupted part way through a patch's files was never followed past DeletionSweep. - A tier 2 patch with two server artifacts around a tier 1 version is purged while the store refuses one server object; that object stays queued and the next run reclaims it, leaving nothing under the patch. Dropping the server-artifact branch from purgeDeleted fails this test. - A patch's file objects stop being deleted after the first. Its row and namespace are gone, so a fresh DeletionSweep no longer sees it, and the orphan sweep reclaims the remaining two while another patch's indexed file survives. Fixtures.record now also prepares the server artifact's object intent, as Content does, so direct tier 2 records honour the same contract. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 92824ceef5a7af6df22a7cf9de55919794a8cfcd)
Gap: restore and reassign never check the owner quota, and no test pinned whether that was intended. The decision is that the quota gates creating patches only. The new service test restores a deleted patch and has an admin reassign another to the owner, leaving them three patches over a quota of one, then shows creation refused until they are back under it. The Patch quota glossary entry now says so. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit acb2e005c7558b48fd068a96eae0f91cbd91ca33)
Gap: the source-state read test already moves a source to another company and refuses it by name and id, but no list read asserted the company filter directly. The test's full company list now leaves out that foreign patch. Today list and by-reference reads share one company query, so the by-ref refusals already guarded it; this pins the list path should they ever split. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit baa6c61c0cb202c41a14055b07c2c49cb71d4695)
Gap: /patches/:name/log was missing from the signed-out loop and the unknown, foreign and overlong name lists. It now gets the same 401 door, 404 and 414 checks as the card's other routes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 1245cafa3aee7d402349a0a5eb9831ff3267fa54)
Gap: every offline revocation stub ignored its argument, so logout could end the wrong Clerk session while still clearing cookies. The stub now records the id it is asked to revoke, and a test checks it is the signed-in session's sid. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 56e8e7800da824bf0472602480bfb53a95e9e6cc)
…e document Gap: POST /api/runtime/subscriptions had no refusal test. A table now sends it each admission failure the stream GET refuses (no or stale session, bearer, cross-site, wrong wire, changed or null principal) and each ownership failure (another viewer, another company, a stale generation, a different loaded version), and checks none of them reaches the document before a valid control is admitted. RuntimeStream.test also pins that a second viewer cannot open, and so replace, another viewer's document by reusing its id and generation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit e4e9e0cd02010a1fc0483ee1dd2025e590a391e5)
…out config Gap: only task-definition content was tested. The config now keeps a partial previous revision so make refuses it instead of silently losing rollout auth, and make refuses a previous revision named like the current one, a previous definition from another family, missing or public callback URLs, and empty secrets, all before any task launches. Each case fails when its check is removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 09abc6f6b263e2928ab14a52ddde27da753ce90f)
… provider Gap: nothing exercised the recovery that authorizes killing a process group on a shared development machine. After an owner is SIGKILLed, an ordinary operation on another provider relaunches an owner that kills the surviving supervisor group, workerd included, and marks the slot stopped. A record naming a live process with a different start time, as after pid reuse, is reclaimed without signalling that process. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 756ef42a43f9c8195ac5fea95dab58f9cf8d912a)
…erified Gap: SourceClient.cancel ran under no test; Execution.test stubs it with plaintext and HandlerTls never reached a deadline. Over the real TLS Postgres, a pg_sleep past the integration deadline is cancelled and its backend exits, though the closed client socket alone leaves it sleeping; an unverifiable certificate refuses the cancel and the backend survives. A unit case shows the cancel's fresh DNS lookup refusing a private answer before any socket opens. The TLS cases now share one disposable Postgres through it.layer instead of booting one each. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 522c47bf3ff986e8ed2ebad262832fdcaf416b3e)
… fails instead of paging forever ListObjectsV2 pagination refused only a token equal to the one just sent, so a store answering first → second → first kept listing until the server gave up, and the orphan sweep with it. Refuse any token already seen in this listing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit a110cc3ffdd152d15ed5351dd0b60f549388aac2)
… bounded requests Gap: S3 listing validation had no test. An object without a key or modification time, an invalid date, a truncated page without a token, a token that repeats the request's and tokens that cycle each fail the listing as store unavailability within one, two or three requests. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 26ecc78ee2898faca5d8b345af992a873ffc2516)
…unbounded Gap: the SIGINT/SIGTERM test spawned the CLI outside the harness, so a failure left the child running, and it polled for the request with no end if the CLI exited first. It now runs through runCli, which registers the child for cleanup, and waits on a request barrier that fails as soon as the CLI exits before reaching the instance. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 662214b23db6259fb66fb6e47740e6dea5c7f57e)
Gap: the owner-only test checked final modes, which a later chmod would satisfy even if a token were first written world-readable. The test now wraps the state's FileSystem so each temp file is stat'ed right after it is written, before the chmod, and requires 0600 there too. Removing the creation mode from State.writeJson makes it fail (0644 instead of 0600). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit f4e23209b5598c2985d8c06f1a63c186c5d8180e)
Gap: the tier 0 publish case built its tree from starterFiles directly, so broken init --tier 0 wiring would still pass. It now runs the real `patchy init --tier 0` against the offline package registry, then hits the dependency and too_large refusals and publishes the starter's own page from that installed tree. The install enables optional dependencies, since Vite's native binding is one; publishTree goes back to tier 1 only. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 8df3c47c42196f6dff5d52c6758cf29c10eca23e)
Gap: the foreign-source test only moved the platform row, so the source's inventory stayed in the caller's company database. A regression that asked with the source's company instead of the caller's still failed to find the inventory and the test passed. The source now lives in another company with its own user, machine and company database. Generation for that company succeeds against its shared table, shared store and target patch, and the original caller gets patch_not_openable for all three. With Generation asking with the source's company, the old test passed and this one fails. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit cb0722eb382c91e308c4ce6444a7c8e536eaf572)
Gap: the surviving-group recovery case hit the procfs ESRCH race that open PR #501 fixes, so it cannot land before it; this removes it and keeps the stale-identity case. That case now registers its own cleanup before killing anything: recorded processes and the supervisor's group are SIGKILLed only while their recorded start time still matches, without relying on the recovery under test. Its procfs observations retry, since a read can race a process's exit until #501 lands. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 54582c8ceb0088a05f70df6c28a0039584d5a8b6)
allisonmahmood
force-pushed
the
test/fill-gaps
branch
from
October 3, 2026 03:32
4058dd0 to
7d51b9c
Compare
This was referenced Oct 3, 2026
fix(integrations): Postgres list can return the same page forever when the source rounds floats
#508
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test audit found behaviour that matters and that no test checked at any layer. This adds those tests. One of them found a real bug, fixed here.
Security and isolation
POST /api/runtime/subscriptionsrefuses bearer tokens, cross-site requests, a wrong wire, a principal mismatch, and another viewer's, another company's, a stale or a wrong-version document. A second viewer cannot take over a document by reusing its id. Removing each ownership guard makes its test fail./logroute joins the signed-out and foreign-company 404 checks.credentials.jsonand the pending device login owner-only from the first byte (0600 file, 0700 directory), as ADR-0004 promises.Data loss and reclamation
test/local-owner-recovery-parkeduntil fix(execution): local task start no longer hangs when an unrelated process exits #501 lands: on CI it hit theESRCHrace fix(execution): local task start no longer hangs when an unrelated process exits #501 fixes.Rules now pinned
live_patch_quota_exceeded. The quota gates creation only (decided): restore and reassign may leave an owner above it, and the glossary now says so.Refusal.codeis now the API's refusal-code union, so a mistyped code in the definitive-refusal list fails typecheck instead of silently keeping or discarding a saved publish.Bug fixed:
S3ContentStore.listonly refused a continuation token equal to the one it had just sent. A listing whose tokens cycled kept paging until the server failed. It now refuses any token already seen in the listing. Malformed listings (missing key or timestamp, invalid date, truncated without a token) now fail within one or two requests.Made by Claude Opus 5.5 via Claude Code