Skip to content

Document the AccessRuleId write contract on ICollectionRepository - #8186

Open
Hinton wants to merge 1 commit into
mainfrom
pam/access-rule-doc-contract
Open

Document the AccessRuleId write contract on ICollectionRepository#8186
Hinton wants to merge 1 commit into
mainfrom
pam/access-rule-doc-contract

Conversation

@Hinton

@Hinton Hinton commented Aug 11, 2026

Copy link
Copy Markdown
Member

🎟️ Tracking

Follow-up to #7981 review comment.

📔 Objective

CreateAsync and ReplaceAsync both ignore Collection.AccessRuleId — a new collection is always created ungoverned, and an ordinary collection edit can neither erase nor forge a PAM association. That is a contract of ICollectionRepository, not a quirk of MSSQL: EF Core enforces exactly the same thing via PropertySaveBehavior.Ignore on the property in DatabaseContext, and both are covered by the shared [DatabaseTheory] tests in CollectionRepositoryReplaceTests.

Documenting it only on the Dapper implementation hid it from the consumers who need it, and implied it was provider-specific.

  • The contract moves to ICollectionRepository.CreateAsync / ReplaceAsync, where callers see it and every implementation inherits it.
  • What stays on the Dapper methods is only the mechanism by which MSSQL upholds it (the sprocs accept @AccessRuleId and deliberately ignore it).

Documentation only — no behaviour change.

CreateAsync and ReplaceAsync both ignore Collection.AccessRuleId, and that is a
contract of the interface rather than a quirk of MSSQL — EF Core enforces the same
thing through PropertySaveBehavior.Ignore in DatabaseContext. Documenting it only on
the Dapper implementation hid it from the consumers who need it and implied it was
provider-specific.

Move the contract to ICollectionRepository, where callers see it and every
implementation inherits it. What stays on the Dapper methods is only the mechanism by
which MSSQL upholds it.
@Hinton
Hinton requested a review from a team as a code owner August 11, 2026 08:21
@Hinton
Hinton requested a review from BTreston August 11, 2026 08:21
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This is a documentation-only change that moves the Collection.AccessRuleId write contract from the Dapper CollectionRepository onto ICollectionRepository.CreateAsync/ReplaceAsync, leaving only the MSSQL mechanism on the Dapper methods. I verified the documented behaviour against both providers: Collection_Create and Collection_Update accept @AccessRuleId and never assign it, all Collection_*WithGroups/Users wrappers delegate to those two procedures, and EF Core enforces the same contract via PropertySaveBehavior.Ignore on the tracked property in DatabaseContext. The cref/paramref targets resolve within the file's existing using scope, and no executable code paths changed.

Code Review Details

No findings.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.21%. Comparing base (a0a31b6) to head (cf549ac).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8186   +/-   ##
=======================================
  Coverage   68.21%   68.21%           
=======================================
  Files        2343     2343           
  Lines      101919   101919           
  Branches     9197     9197           
=======================================
+ Hits        69520    69525    +5     
  Misses      30085    30085           
+ Partials     2314     2309    -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Hinton
Hinton requested a review from eliykat August 11, 2026 17:18
@Hinton Hinton added the t:docs Change Type - Documentation label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:docs Change Type - Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants