fix(tests): adopt projectcampus fixes — hierarchy seeding, fixture parity, flaky cleanup - #1046
Merged
Merged
Conversation
This was referenced Aug 14, 2026
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.
Adopts the verified fixes from the projectcampus contribution brief (a fork with a four-level channel hierarchy and draft-lifecycle products — it exercises paths cella's single-channel default config masks). All six claims were verified against main before adoption; every mechanical claim checked out.
The fixes
afterEachdelete and tripped the unique(lower(email), type)index on the next run: flaky only on persistent local databases, invisible in CI. Cleanup now deletes withlower()on both sides (one hardening beyond the brief: it stays correct if the fixture email ever changes case). Proven by the run-twice-same-DB gate.TestChannelRowgainsancestorColumns(walked root-first, so every ancestor id is known), and both seeders (hierarchy-helpers.ts+ the rls-security local copy) insert every ancestor id column instead of only the immediate parent. Deep hierarchies keep all ancestor columns NOT NULL, so grandchild seeding died at setup. Upstream-safe: with cella's default hierarchy the chain has length 1 and the generated SQL is unchanged — RLS suite 50/50 green here, 123/0 in the originating fork. Theparent*fields stay for compatibility (now derivable asancestorColumns[0]— flagged for a later cleanup).findUnseenCountsByUser'sisNotNull(publishedAt)filter; inert for cella's attachment. One deviation from the brief worth noting: the brief's'publishedAt' in tableidiom turned out to be deliberately type-safe — the "more canonical"getColumns(table).publishedAtfails typecheck against cella's precise column types. Landed as'publishedAt' in getColumns(table), which keeps both the column-accuracy and the type-check.ContextEntityType→ChannelEntityType(dead since the 2026-07 channel rename).checkPermission→checkAccess.undefinednever exercised the no-elevatedRoles branch — JS default parameters substitute the app-config default on ANY undefined — so the test asserted ambient app config and necessarily failed in forks that configure elevatedRoles. It now asserts the same subtree semantics via an explicit elevatedRoles list containing the granted role, with a comment explaining whyundefinedcannot test that branch. The deeper contract question (empty array as canonical "none" + dropping the undefined branch) is filed separately — it needs coordination with the permission engine'sisHomeScopedGrantsemantics.Verification
pnpm checkgreen (biome, full-repo typecheck, sdk unchanged).TEST_MODE=fullrls-security: 50/50; attachment-seq-reads (the other hierarchy-plan consumer): green; realtime views: green.Fork-facing note: raak consumes the shared testing infrastructure (items 2+3) — auto-migrating, no codemod needed; the changes are additive and byte-stable for any depth-≤2 hierarchy.
🤖 Generated with Claude Code