Skip to content

feat: support namespace lockdown#4062

Merged
turip merged 2 commits into
mainfrom
feat/support-namespace-lockdown
Apr 2, 2026
Merged

feat: support namespace lockdown#4062
turip merged 2 commits into
mainfrom
feat/support-namespace-lockdown

Conversation

@turip
Copy link
Copy Markdown
Member

@turip turip commented Apr 2, 2026

Overview

Achieve parity with the billing implementation of namespace lockdown.

Notes for reviewer

Summary by CodeRabbit

  • New Features
    • Added namespace lockdown validation to the billing system. Restricted namespaces are now prevented from performing charge creation, advancement, and invoicing operations. The system validates namespace access before executing these transactions.

@turip turip requested a review from a team as a code owner April 2, 2026 10:31
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac50517e-5b0f-42ae-8645-33ae7973c8b7

📥 Commits

Reviewing files that changed from the base of the PR and between 32b5260 and 3a667da.

📒 Files selected for processing (6)
  • app/common/billing.go
  • app/common/charges.go
  • openmeter/billing/charges/service/advance.go
  • openmeter/billing/charges/service/create.go
  • openmeter/billing/charges/service/invoicependinglines.go
  • openmeter/billing/charges/service/service.go

📝 Walkthrough

Walkthrough

This PR threads namespace lockdown configuration through the charges service initialization and adds validation checks to prevent operations on locked namespaces. The FSNamespaceLockdown parameter flows from billing registry construction into the charges service, which then validates this constraint before executing Create, AdvanceCharges, and InvoicePendingLines operations.

Changes

Cohort / File(s) Summary
Service Configuration & Wiring
app/common/billing.go, app/common/charges.go
Pass FSNamespaceLockdown parameter through billing registry and charges service constructors into service configuration.
Service Implementation
openmeter/billing/charges/service/service.go
Add fsNamespaceLockdown field to service struct and Config, implement validateNamespaceLockdown method to check namespace membership and return a locked namespace error.
Validation Integration
openmeter/billing/charges/service/{create,advance,invoicependinglines}.go
Add pre-transaction namespace lockdown validation calls at the start of Create, AdvanceCharges, and InvoicePendingLines methods; skip transaction if validation fails.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • fix: invoice pending lines via charges #4059: Both PRs modify charges service and billing registry wiring; this PR adds namespace lockdown validation while the related PR re-routes InvoicePendingLines through the charges backend.

Suggested labels

area/api, release-note/misc

Suggested reviewers

  • tothandras
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: support namespace lockdown' directly and accurately reflects the main change: adding namespace lockdown functionality across billing charges components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/support-namespace-lockdown

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 and usage tips.

@turip turip added the release-note/ignore Ignore this change when generating release notes label Apr 2, 2026
@turip turip requested a review from tothandras April 2, 2026 10:34
@turip turip enabled auto-merge (squash) April 2, 2026 11:33
@turip turip merged commit 677dea6 into main Apr 2, 2026
26 of 27 checks passed
@turip turip deleted the feat/support-namespace-lockdown branch April 2, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/ignore Ignore this change when generating release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants