Skip to content

test(platform): require every backend:integration lane to run and pass - #3981

Merged
yannickmonney merged 8 commits into
mainfrom
test/backend-integration-full-coverage
Sep 30, 2026
Merged

yannickmonney merged 8 commits into
mainfrom
test/backend-integration-full-coverage

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part of TALE-382 (run backend:integration in CI). Before CI can gate on the suite, a whole run has to cover every lane and pass. It did neither on main:

  • A run could skip lanes and still pass. Without ITEST_S3_ENDPOINT, twenty-five blob checks recorded themselves as passing (SKIPPED) checks. A few more passed their blob half silently: the hard-delete blob reclaim, the vanished-attachment chip, the settled-donor dismissal and the org-teardown blobs.
  • The full run was red. In a local run of all 204 lanes on main (see Test plan), 20 of 1190 checks failed.
    • Ten came from one leak. checkErasureReviewHandoverRaces made the shared user an owner of two throwaway organizations and never took that back. From then on every /api/v1 call on that user's keys answered ORG_SLUG_REQUIRED, the refusals drained the key holder's rest:api budget, and the REST lanes forty lanes later failed, the last ones on 429.
    • Filtered runs (ITEST_LANES) never showed it.

What changes

  1. ITEST_REQUIRE_ALL_LANES=1 asks for full coverage.

    • The harness refuses to start (exit 2) with a lane filter or without all three ITEST_S3_* variables.
    • Every skip goes through recordSkip (backend/integration-lane-helpers.ts), which records a failure in such a run and a counted skip otherwise. The tally now says how many checks were skipped.
    • Lanes read the harness's own variables only through the helpers. tests/guards/integration-skips.guard.test.ts holds both rules.
  2. A lane that changes the shared user's organization memberships fails, and the failure names the lane. The erasure race lane now gives its organizations an owner of their own.

  3. Three lanes are held to what a whole run looks like.

    • The ask-bell check wanted exactly one bell, but other lanes add admins to the shared org. It now runs in an organization of its own with a controlled audience. Owner, admin and quiet admin must be rung; a plain member, a disabled member and an admin who turned escalations off must not. The exact recipient set is compared on create, on the fold and on dismissal. This is 2b66586, which supersedes a093a63's rule-derived audience; see the review thread.
    • The workspace-tool door provisioned a project-agent session under a made-up id. Since feat(platform): let members create tasks and work their own #3810 that door serves such a session only as the agent's standing session (pa-<agentId>), so the check now uses the standing session, and so do feat(platform): name the serving release in workspace_status #3972's status tokens.
    • The embedding re-queue check read the job a moment before pg-boss completes it. It now waits for the job too.
  4. Pushed onto this branch by a reviewer, kept as is:

    • 7e76220 fails checkRecoverySweeps when its corpus seed fails, which was another silent pass;
    • 3679a6c widens the skip guard to *-check.ts, to syntax-tree env reads and to lower-case skips;
    • 4706a61 corrects where the video-link probe finds its ffmpeg.

The CI job itself is not in this PR. GITHUB_TOKEN_TALE cannot push .github/workflows/*: the push was refused for the missing workflow scope. The job is a ready commit that sits on top of this branch, described below.

Checklist

  • bun run check passes — N/A locally: the sandbox's 4 GiB cap cannot hold the platform-wide gates. The changed files were checked as listed under Test plan, and CI runs the full gate.
  • bun run lint:sast passes — the pre-commit hook ran Opengrep on the staged files; CI's Opengrep job runs it in full.
  • Translations — N/A: harness only.
  • Docs in docs/{en,de,fr}/ — N/A: no user-visible change. services/platform/backend/README.md documents the flag and the membership rule.
  • README.md — N/A.

Test plan

Full local runs on PostgreSQL 16.13 with pg_search 0.22.6 and pgvector 0.8.1 (the versions tale-db ships), the ghcr.io/tale-project/ops/minio:RELEASE.2025-04-22T22-12-26Z binary (the CLI's object-store pin), and ffmpeg/ffprobe on PATH. All 204 lanes ran every time.

Run Checks passed Failed
main @ ab45722 1170/1190 20
these commits + #3980 1182/1190 8
the same, rebased on main @ 0e7cf2d, with ITEST_REQUIRE_ALL_LANES=1 1183/1191 in 458 s the same 8; 0 skipped, 0 did-not-run, no membership leak
head 2b66586 + #3980, with ITEST_REQUIRE_ALL_LANES=1 1183/1191 in 428 s the same 8

The 8 that still fail are all network lanes, and they fail only because this sandbox has no DNS and no direct egress:

  • the picker's stale-send check: live openrouter.ai / ai-gateway.vercel.sh catalogs time out after 3×10 s and the send answers 500;
  • five video-link checks: dns.resolve4 gets no answer, so they end on dnsResolutionFailed;
  • the AI-title fallback: api.anthropic.com times out after 10 s;
  • the deferred send: the openrouter catalog fetch outlasts the 18 s wait.

Through the sandbox proxy the endpoints answer at once: openrouter 200, vercel 200, anthropic 401 in under 0.25 s. So a GitHub runner should pass them; the first CI run will confirm. Note that the suite reaches these vendors: an outage of theirs can turn the CI job red.

Controls:

  • The leak check, on main's erasure lane (ITEST_LANES=checkErasureReviewHandoverRaces), fails with harness: checkErasureReviewHandoverRaces leaves the shared user's organizations as it found them — before=[<shared org>:owner] after=[<2 new orgs>:owner,<shared org>:owner].
  • The preflight under ITEST_REQUIRE_ALL_LANES=1 exits 2 with a lane filter, with no ITEST_S3_*, and with only the endpoint set; each refusal names what is missing.
  • The guard fails, naming file and line, when a lane reads process.env.ITEST_FOO, reads process.env["ITEST_BAR"] or records a "(SKIPPED)" itself.
  • ITEST_LANES=checkRestDoor,checkSandboxSpawner after rebasing onto feat(platform): name the serving release in workspace_status #3972: the tool door and feat(platform): name the serving release in workspace_status #3972's workspace-status check both pass.

Local checks:

  • vitest --project server on backend/integration-lane-helpers.test.ts (12) and the new guard (3): pass.
  • A scoped tsc over every changed file, including integration-check.ts: clean.
  • oxlint --type-aware per file and oxfmt --check: clean.

A run could skip a lane and still pass: without ITEST_S3_ENDPOINT
twenty-five blob checks recorded themselves as passing skips, and a
few more passed their blob half silently. ITEST_REQUIRE_ALL_LANES=1
now asks for full coverage. The harness refuses to start with a lane
filter or without all three ITEST_S3 variables, and every skip goes
through recordSkip, which records a failure in such a run and a
counted skip otherwise.

Lanes read the harness's variables only through the lane helpers, and
a guard holds both rules.
The erasure race lane made the suite's shared user an owner of two
throwaway organizations and never took that back. From then on every
/api/v1 call on that user's keys answered ORG_SLUG_REQUIRED, the
refusals drained the key holder's budget, and ten REST checks forty
lanes later failed, the last ones on 429. Filtered runs never showed
it.

The race now gives its organizations an owner of their own, and the
harness fails any lane that changes the shared user's memberships,
naming the lane.
The ask bell check expected exactly one bell, but by then other lanes
have added admins to the shared organization; it now wants one unread
bell for the owner and one row per recipient. The workspace-tool door
provisioned a project agent session under a made-up id, which the
door serves only as the agent's standing session since members may
start agent runs; it now provisions the standing session. The
embedding refusal lane read the re-queued job the moment the file
finished indexing, just before pg-boss completes the job; it now
waits for both.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

At reviewed head 6c2e42a431269332e05655558d1286b539eeb2f4, the revised ask-bell assertion weakens recipient coverage: bellRecipients comes from bellAfterCreate, so its size comparison proves uniqueness, while ownerBells.length === 1 leaves every other recipient unchecked (assertion).

Bounded local controls evaluated the exact source predicate, extracted with the TypeScript AST, using inert rows. All three passed: the valid owner + eligible admin; owner only, omitting that admin; and owner + admin + an unauthorized ordinary member. This demonstrates a test-oracle gap, not an observed production notification leak.

Please independently establish the expected eligible owner/admin IDs from controlled fixture membership and notification preferences, then compare exact recipient sets. Preserve uniqueness, unread, fold and dismissal assertions, and add missing-eligible / unexpected-recipient negative controls. Deriving the expected set from the returned bells or the production audience helper would repeat the same blind spot.

yannickmonney and others added 5 commits September 30, 2026 10:37
checkRecoverySweeps passed its adoption half through `!corpusSeeded ||`
when the seed INSERT into private_knowledge.documents threw, so a
required run stayed green without proving that finished work is adopted.
tale-db ships the corpus and other lanes write to it with no fallback:
a failed seed now fails the check and names the error.
The whole-run relaxation of the ask-bell check only asked for one bell
for the owner and one row per recipient, so a fan-out that reached every
member, or skipped an admin, still passed. An ask with no project rings
the organization's owners and admins who kept escalation bells on: the
check now reads that audience beside the bells, requires the two sets to
match, and prints what is missing or stray.
The guard scanned only `*.integration.ts` and `*-integration.ts`, so the
REST proofs the harness imports lazily (`rest/*-check.ts`) went unread,
and it matched only `process.env.ITEST_X` and an upper-case `(SKIPPED)`:
a destructuring, an optional chain or a lower-case `(skipped)` got past.

It now reads `*-check.ts` too, judges env reads on the syntax tree (any
ITEST_ key off process.env, and any code that names one of the harness's
own variables), matches `(skipped)` in any case, and fails a lane that
only tells the console it skipped something. The status-hints lane's
seed message says "failed", which is what it counts.

The helper and guard comments describe the flag's intent rather than a
CI job that does not exist yet.
The README said both media probes run ffmpeg from PATH. Only the
transcription probe does: the video-link probe hands yt-dlp an explicit
`--ffmpeg-location`, `VIDEO_INGEST_FFMPEG_LOCATION` or else
`/usr/bin/ffmpeg`, and never reads PATH. Say so, and when to set it.
The ask-bell check compared the bells with an audience it read from the
shared organization by the same rule the fan-out applies, so a rule
wrong on both sides still passed, and that organization held no member
the rule must leave out.

The scenario now runs in an organization of its own with an owner, an
admin, an admin whose other preferences are off, a plain member, a
disabled member and an admin who turned escalations off. The bells on
create and on the fold must go to exactly the first three, one each,
and the answer must read every one of them.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Thanks. The point holds: ownerBells.length === 1 plus uniqueness proves nothing about the other recipients. a093a63, pushed meanwhile, compares the bells with an audience read back from the shared org by the fan-out's own rule, so a rule that is wrong on both sides still passes. That is the blind spot you describe, and the shared org holds no member the rule must leave out.

2b66586 (rebased on top of 7e76220…4706a6132, superseding only a093a63's bell section) runs the scenario in an organization of its own. The lane sets its members and preferences:

Fixture Role notification_preferences Must be rung
owner (signed up; answers the ask) owner none yes
admin admin none yes
quietAdmin admin task_commented = false, escalation = NULL yes (an unset escalation is on)
member member none no
disabled disabled none no
mutedAdmin admin escalation = false no

The expected set is written down from that table, never read from the bells or the rule. Three things must match it exactly, as sorted id lists, so a missing, doubled or stray recipient each fail:

  • the bells on create;
  • the fold rows carrying the merged question;
  • the recipients whose rows the answer dismisses.

The unread, fold and dismissal assertions stay; the answer now goes through the fixture owner's own session.

Negative controls. I mutated the product rules in backend/domains/collab/service.ts locally, ran ITEST_LANES=checkAskAnswer on each and reverted:

Mutation Check Detail
org-level audience role <> 'disabled' (every member) FAIL created=admin+member+owner+quietAdmin
isNotificationAllowed ignores preferences FAIL created=admin+mutedAdmin+owner+quietAdmin
a stored NULL preference read as off FAIL created=admin+owner (quietAdmin missing)
owners only FAIL created=owner
unmutated PASS created=admin+owner+quietAdmin, fold the same, answer 200, 6/6 rows read

Whole run at this head plus #3980, ITEST_REQUIRE_ALL_LANES=1: 1183/1191 checks across 204/204 lanes, 0 skipped, 0 did-not-run, no membership leak. The 8 failures are the network lanes this sandbox cannot reach, as described in the PR body. ITEST_LANES=checkRecoverySweeps,checkAskAnswer covers 7e76220's lane too: 37/37.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

The original recipient-oracle blocker is resolved at 2b66586975f3e752dd02d52f55479c10d0529bb4. Independent review of the exact one-file delta confirms that the expected owner/admin audience comes from the isolated seeded fixture, not notification results or the production audience rule. Controls extracted from the actual assertions reject missing eligible recipients, extra member/disabled/muted recipients, duplicates, premature read state and incomplete folding/dismissal. The unchanged helper/required-lane guard remains intact.

This accepts the source correction; it is not a passing complete backend integration campaign. The author reports 1183/1191, with eight network failures, and the separate CI workflow is still unpublished. Raw source-bound PostgreSQL/control receipts, the completed normal checks, and TALE-382’s actual hosted green plus reverted broken-lane red proof remain separate acceptance steps. Proxy endpoint reachability alone does not establish those lanes pass.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Normal CI is now complete at the same head 2b66586975f3e752dd02d52f55479c10d0529bb4: all five workflows succeeded on attempt 1 (48 successful checks, 11 conditional skips, one neutral scanner comparison). Unit and UI executed fresh; the affected helper/skip-guard tests passed. This remains separate from the proposed all-lanes PostgreSQL job.

For the workflow-scope limitation, please provide the prepared public-source workflow commit as a fenced git format-patch here if the task-file handoff is unavailable, with exact parent/head and SHA-256. Include only the reviewed public-source patch and synthetic result summary; do not publish credentials or unreviewed raw logs. The existing maintainer route can publish the specific reviewed change without granting the agent broader token scope. Preserve the raw source-bound PostgreSQL and reverted-mutation files in the task deliverables as requested.

The workflow review must also preserve candidate-source binding: the new job should test the resolved candidate SHA and feed the existing candidate receipt gate on release-candidate dispatch, as well as the normal PR/main paths. No stale Turbo verdict or silent lane skip can satisfy this gate.

@yannickmonney
yannickmonney merged commit 52f4196 into main Sep 30, 2026
60 checks passed
@yannickmonney
yannickmonney deleted the test/backend-integration-full-coverage branch September 30, 2026 09:17
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