Test existing authentication and site assignment contracts - #1877
Merged
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis change adds database-backed tests for API-key and login attempt limiting, user database contracts, and site-assignment configuration, validation, renewal, notification, and email behavior. ChangesContract test coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
stefan-burke
added a commit
that referenced
this pull request
Jul 21, 2026
Main's PR #1877 moved test files from test/lib/ to test/integration/ and switched their imports to relative paths. The no-../ rule (this PR) flags those. Convert every ../ import introduced by the merge back to # aliases: - test/integration/**: ../../lib/... -> #test/lib/..., ../../../lib/... -> #test/lib/..., ../../routes/... -> #test/routes/..., ../../scripts/ -> #scripts/, ../lib/ -> #test/lib/ - scripts/stripe-mock.ts: ../src/ -> #src/ - e2e-payments/src/providers/stripe.ts: ../ -> #e2e/ Also deduped imports left by merge conflict resolution in server-balance-webhook.test.ts and reservation-edge-cases.test.ts, and wrapped the reservation-edge-cases / promo-addons import blocks in jscpd:ignore as the existing pattern does for sibling test files.
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.
This adds four new test files that lock in behaviour already present on main. No production code is touched.
What is added
test/shared/db/api-key-attempts.test.ts— locks the API-key rate limiter at its limit, and proves the API-key counter is separate from the login counter.test/shared/db/login-attempts.test.ts— locks the login lockout deadline and the cleared-after-success behaviour.test/shared/site-assignment/contracts.test.ts— locks the validation, renewal push, and setup email contracts for built-site assignment.test/shared/db/users/contracts.test.ts— locks the user display/auth field, cache, invite lifecycle, KEK migration, key handoff, and keyless activation contracts.Why
These contracts are exercised by current behaviour but did not have their own dedicated test files. Pulling them out into focused files makes regressions easier to localise and keeps mutation runs cheap (each module maps to the narrow test file that covers it).
How
The three complete files are copied from a maintenance branch snapshot (commit
079d3b32). The users contract file is the same snapshot minus the imports for the not-yet-landedaddUserOwnedAccessRecords/getUserOwnedRowSourceshelper and minus its final test that needed them. With those removed, the file is self-consistent on main. All earlier user contract tests are kept intact.Verification
nix develop -c deno task test:fileson the four new files — 32 tests pass.nix develop -c deno task lint:ci— clean.nix develop -c deno task precommit— green (typecheck, lint, cpd, build, full suite).src/changes.Summary by CodeRabbit