Skip to content

test: scope interview experience idempotency by submitter - #2286

Merged
KaranUnique merged 1 commit into
Canopus-Labs:mainfrom
Suprita736:fix/interview-experience-idempotency-scope
Aug 31, 2026
Merged

test: scope interview experience idempotency by submitter#2286
KaranUnique merged 1 commit into
Canopus-Labs:mainfrom
Suprita736:fix/interview-experience-idempotency-scope

Conversation

@Suprita736

@Suprita736 Suprita736 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

📝 Pull Request Description

Related Issue

Closes #1926

Summary

Fix interview experience idempotency deduplication so that submissions are scoped to the submitting identity instead of being deduplicated globally by idempotencyKey.

  • Authenticated submissions are scoped by (idempotencyKey, userId).
  • Anonymous submissions are scoped by (idempotencyKey, clientKey).
  • Prevents one user/client from receiving another user's/client's interview submission when the same idempotency key is reused.
  • Added test coverage for the scoped idempotency behavior.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature
  • ♻️ Refactoring
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔥 Other(please describe) ______

How Has This Been Tested?

  • Added/updated unit tests covering idempotency deduplication for authenticated users and anonymous clients.
  • Verified that repeated submissions from the same user/client with the same idempotency key are deduplicated.
  • Verified that the same idempotency key used by different users/clients does not return another submitter's submission.
  • Ran the relevant backend test/validation checks successfully.

Screenshots (if applicable)

Not applicable — this is a backend-only bug fix.


Checklist

  • My code follows the project's guidelines
  • I have tested my changes
  • I have updated documentation where necessary
  • I have linked the related issue
  • My changes do not introduce new warnings or errors

Looks good to me. Ready to merge.

@github-actions

Copy link
Copy Markdown

Thank you for submitting your pull request, @Suprita736! 🙌
We'll review it as soon as possible.
If there are any specific instructions or feedback regarding your PR, we'll provide them here.
Thanks again for your contribution to our project! 😊

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fd867f49-adee-4971-a9d2-629ea3802518

📥 Commits

Reviewing files that changed from the base of the PR and between 420348a and c96aea5.

📒 Files selected for processing (1)
  • backend/tests/interviewExperienceController.unit.test.js

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The unit tests now cover authenticated retry deduplication and anonymous isolation when submissions share an idempotency key.

Changes

Interview experience idempotency

Layer / File(s) Summary
Idempotency scope validation
backend/tests/interviewExperienceController.unit.test.js
Adds coverage for authenticated retries returning an existing submission without creating a duplicate. Updates anonymous isolation coverage to verify lookup by clientKey and creation of a new submission when an authenticated submission uses the same idempotency key.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to c96ae

The idempotency change improves submitter isolation, but authenticated submissions can still retain an anonymous client key, allowing a matching anonymous request to receive the authenticated submission and potentially causing retry failures or 500 responses. The ownership namespaces should be made mutually exclusive before merging.

Suggested reviewers: nyxsky404

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes add tests for scoped idempotency, but the provided summary shows no updates to backend/controllers/interviewExperienceController.js or backend/models/InterviewExperience.js. The linked iss… Implement the authenticated and anonymous scoped deduplication lookup in backend/controllers/interviewExperienceController.js. Replace the global index with the required compound partial unique indexes in backend/models/InterviewExperience.…
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the test change and the main behavior: scoping interview experience idempotency by submitter.
Out of Scope Changes check ✅ Passed The provided changes are limited to unit tests for interview experience idempotency. No unrelated code changes are shown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

The changes add tests for scoped idempotency, but the provided summary shows no updates to backend/controllers/interviewExperienceController.js or backend/models/InterviewExperience.js. The linked issue requires both the scoped deduplication lookup and compound partial unique indexes [#1926].

Resolution

Implement the authenticated and anonymous scoped deduplication lookup in backend/controllers/interviewExperienceController.js. Replace the global index with the required compound partial unique indexes in backend/models/InterviewExperience.js. Retain the added unit tests.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Some tools did not complete. Review the errors below.

🔧 Biome (2.5.7)
backend/tests/interviewExperienceController.unit.test.js

File contains syntax errors that prevent linting: Line 1: Illegal use of an import declaration outside of a module


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the merge ready PR is mergeable and has no conflicts label Aug 30, 2026
@KaranUnique
KaranUnique merged commit 23d4b29 into Canopus-Labs:main Aug 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix : scope interview experience idempotency dedup to submitting user or clientKey

2 participants