test(tenancy): integration test for per-repository gitRepositoryFilter scoping#1180
Conversation
…r scoping Guards the 1.7.0 regression fixed in 1.7.2: verifies that RepositoryInterceptor enables the Hibernate gitRepositoryFilter for web requests and that a tenant query is scoped to the current repository, with no cross-repo leak. Runs against a real embedded Postgres + the Flyway schema (the existing @DataJpaTest pattern), seeds two repositories with enabled environments, and asserts that findByEnabledTrue is scoped per X-REPOSITORY-ID (and unscoped when no repo context is set). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | ✅ 9 (≤ 20 complexity) |
🟢 Coverage ∅ diff coverage · +0.11% coverage variation
Metric Results Coverage variation ✅ +0.11% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (911e04f) 15441 7600 49.22% Head commit (57048e2) 15441 (+0) 7617 (+17) 49.33% (+0.11%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#1180) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
Adds an integration test to prevent regressions in Helios’s per-repository tenant isolation by verifying that Hibernate’s gitRepositoryFilter is correctly enabled via the real RepositoryInterceptor path (the production mechanism that avoids the OSIV/transaction-initializer gap).
Changes:
- Introduces an embedded-Postgres (
zonky)@DataJpaTestthat runs against the real Flyway schema. - Seeds two repositories with enabled environments and asserts correct scoping for repo A, repo B, and “no repository context” (filter off).
- Drives the actual
RepositoryInterceptorbehavior to ensure web-request reads remain tenant-scoped.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds the coverage that was missing (and let the 1.7.0 cross-repo leak ship unnoticed).
Drives the real
RepositoryInterceptor+ real Hibernate@Filter+ real Flyway schema on embedded Postgres (existing@DataJpaTestpattern). Seeds two repositories (repo A: 2 enabled envs, repo B: 1) and asserts:Fails exactly the way v1.7.0 would. Scope note in the class Javadoc: servlet-level OSIV ordering is verified in staging/prod, not reproduced here.
Lands before the 1.7.2 release per request.