Skip to content

[PM-39976] Scaffold PAM lease endpoints#7925

Open
Hinton wants to merge 3 commits into
mainfrom
pam/scaffold-leases
Open

[PM-39976] Scaffold PAM lease endpoints#7925
Hinton wants to merge 3 commits into
mainfrom
pam/scaffold-leases

Conversation

@Hinton

@Hinton Hinton commented Jul 6, 2026

Copy link
Copy Markdown
Member

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-39976

📔 Objective

Adds the /leases Minimal API group (active, history, mine, revoke, extend) with an intentionally unimplemented handler, following the access-rule and access-request scaffolds.

The response models are already on main; the two new request DTOs (revoke, extension) carry the remaining wire contract. Contract tests lock the routes, names, methods, and return types the generated spec is built from.

Adds the /leases Minimal API group (active, history, mine, revoke, extend)
with an intentionally unimplemented handler, following the access-rule and
access-request scaffolds. The response models are already on main; the two
new request DTOs (revoke, extension) carry the remaining wire contract.
Contract tests lock the routes, names, methods, and return types the
generated spec is built from.
@Hinton Hinton requested a review from a team as a code owner July 6, 2026 09:06
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the PAM /leases scaffold: the Minimal API group (active, history, mine, revoke, extend), its intentionally-unimplemented handler, two new request DTOs, DI registration, and the contract tests. The endpoints, handler stubs, DI wiring, and tests faithfully mirror the established access-request and access-rule scaffolds. The Extend handler returning AccessRequestDetailsResponseModel is consistent with the domain model (extensions produce an auto-approved access request, per ExtensionOfLeaseId).

Code Review Details
  • 🎨 : Documented constraints on the extension DTO aren't expressed as DataAnnotations, so they won't be enforced by PamValidationEndpointFilter or appear in the generated OpenAPI schema
    • bitwarden_license/src/Services/Pam/Api/Models/Request/AccessLeaseExtensionRequestModel.cs:12

@Hinton Hinton added the t:feature Change Type - Feature Development label Jul 6, 2026
Hinton added 2 commits July 6, 2026 11:15
The validation filter only enforces attributed constraints, and only those
surface in the generated OpenAPI schema: Range(1, max) on DurationSeconds
and Required on Reason, matching how AccessDecisionRequestModel encodes its
contract. The rule-specific duration ceiling stays server-side.
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.06452% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.32%. Comparing base (5b4ac6e) to head (734e432).

Files with missing lines Patch % Lines
...am/Api/Endpoints/Handlers/LeaseEndpointsHandler.cs 0.00% 5 Missing ⚠️
...e/src/Services/Pam/Api/Endpoints/LeaseEndpoints.cs 76.19% 5 Missing ⚠️
...Models/Request/AccessLeaseExtensionRequestModel.cs 0.00% 2 Missing ⚠️
...pi/Models/Request/AccessLeaseRevokeRequestModel.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7925      +/-   ##
==========================================
- Coverage   61.33%   61.32%   -0.01%     
==========================================
  Files        2242     2246       +4     
  Lines       98630    98661      +31     
  Branches     8911     8911              
==========================================
+ Hits        60490    60508      +18     
- Misses      36004    36017      +13     
  Partials     2136     2136              

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant