Repository navigation
fix(ci): unpin ServerProfilingIT and GrpcAuthInterceptorTest from implementation details that moved under them - #6890
Conversation
… them Both failures on main are tests asserting something the code never promised, not regressions in the code they cover. ServerProfilingIT (11 failures + 1 cascading error): checkJohnUser() asserted that "albert" is the FIRST line of server-users.jsonl. That order is whatever order ServerSecurity serializes its user store in, and nothing reads it. It used to come straight out of a ConcurrentHashMap, whose hash order happens to iterate [albert, root]; since 9fbbb06 persists a mutation BEFORE publishing it, snapshotWith() appends the new user to the pre-mutation list, so the file is now [root, albert]. The assertion now names which principals were persisted, not which line each landed on - strictly stronger than before, and immune to the next change in serialization order. The 12th test errored on "Bucket1 already exists": it is a cascade, an earlier test failing at checkJohnUser() before reaching dropSchema(). GrpcAuthInterceptorTest.validateTokenReturnsTrueForValidSession: 7c4e44a (#6808) made the bearer branch re-resolve the session's principal against the live users map so a dropped or rotated principal's token stops working at once. The test stubs getUsers() but not getUser(), so the mock returned null and every token now reads as an orphaned one. Stubbed, with the reason stated at the stub. That branch shipped with no gRPC test, so the revocation it enforces was unguarded on this transport. Added validateTokenReturnsFalseWhenPrincipalNoLongerExists, which asserts both halves: the call is closed, and the orphaned session is evicted rather than left to answer getSessionByToken() until it idle-expires. Verified it fails when the branch is disabled. Verification: grpcw 201/201, server com.arcadedb.server.security.** 139/139 (includes ServerProfilingIT 13/13), both green.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ -6.43% coverage variation |
| Diff coverage | ✅ ∅ diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (5d86d17) 168316 135397 80.44% Head commit (b3fb200) 200703 (+32387) 148545 (+13148) 74.01% (-6.43%) 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 (#6890) 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.
|
Tick the box to add this pull request to the merge queue (same as
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe changes strengthen gRPC authentication test coverage for removed users and make persisted-user assertions independent of serialization order. ChangesgRPC authentication validation
Persisted-user assertion
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This test-only change updates assertions to match the intended behavior and adds coverage for principal revocation; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description gives a detailed summary, motivation, failure details, test changes, security context, and verification results. It does not use all template headings or include the checklist, but it provides the required review context and is mostly complete.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
Reviewed the diff. This is a clean, well-scoped test-only fix, both changes are correct.
Minor/nit
No production code changes, no new dependencies, no security or performance concerns beyond what's already covered by the #6808 fix these tests now protect. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6890 +/- ##
==========================================
+ Coverage 71.86% 71.88% +0.02%
==========================================
Files 1883 1883
Lines 168316 168316
Branches 35664 35664
==========================================
+ Hits 120959 120997 +38
+ Misses 32958 32929 -29
+ Partials 14399 14390 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes the two test failures red on
mainin run 33266454013. Both are tests asserting something the code never promised. Neither covers a regression in the code under test - the production behaviour in both cases is the intended one, and in one case it is a security fix that shipped without a test.ServerProfilingIT- 11 failures + 1 cascading error (integration-testslane)checkJohnUser()asserted that"albert"is the first line ofserver-users.jsonl:That order is whatever order
ServerSecurityhappens to serialize its user store in. Nothing reads it - this assertion was its only consumer.It used to be produced by
usersToJSON()iteratingusers, aConcurrentHashMap, whose hash order for these two names happens to be[albert, root](verified). Since 9fbbb06 ("persist before publishing a user mutation")createUserpersistssnapshotWith(name, cfg), which walks the pre-mutation map and appends the new user, so the file is now[root, albert]. Deterministic append order rather than hash order - the better of the two, and no reason to change it back to satisfy a test.The assertion now names which principals were persisted rather than which line each landed on:
Strictly stronger than the pair it replaces (
size() == 2plus a positional name check), and immune to the next change in serialization order.The 12th test,
multipleGroupsAnyType, errored withCannot create bucket 'Bucket1' because already exists. That is a cascade, not a separate cause: an earlier test failed atcheckJohnUser()before reaching itsdropSchema(), leaving the schema behind. It goes green with the assertion fixed.GrpcAuthInterceptorTest.validateTokenReturnsTrueForValidSession(unit-testslane)7c4e44a (#6808) closed a revocation hole: the gRPC bearer branch trusted the
ServerSecurityUsertheHttpAuthSessioncaptured at login, so a dropped or rotated principal kept authenticating until its token idle-expired.getValidSession()now re-resolves the name against the live users map.The test stubs
getUsers()(to make security enabled) but notgetUser(), so the Mockito mock returnednulland every token read as an orphan - the call was closed andstartCallnever reached. Stubbed, with the reason stated at the stub so the next person does not read it as boilerplate.Added coverage for the revocation itself
That branch shipped with no gRPC test, so the behaviour #6808 exists to enforce was unguarded on this transport.
validateTokenReturnsFalseWhenPrincipalNoLongerExistsasserts both halves:removeSession), so it cannot keep answeringgetSessionByToken()until it idle-expires.Proven able to fail: with the
security.getUser(...) == nullbranch disabled, the new test fails on theremoveSessionverification and the other 8 stay green.Verification
mvn -o -pl grpcw verifymvn -o -pl server verify -DskipITs=false -Dtest='com.arcadedb.server.security.**' -Dit.test='com.arcadedb.server.security.**'ServerProfilingIT13/13mainfirstTest-only change: no
src/mainfile is touched.Summary by CodeRabbit
Bug Fixes
Tests