Skip to content

fix(settings): decouple access settings from usage analytics - #8828

Merged
waleedlatif1 merged 5 commits into
stagingfrom
codex/settings-billing-read-resilience
Oct 9, 2026
Merged

waleedlatif1 merged 5 commits into
stagingfrom
codex/settings-billing-read-resilience

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Keep permission groups independent of usage analytics and preserve unsaved settings during failed background reads.
  • Read organization plans, usable Enterprise access, and canonical seat reservations from primary through one authorized billing domain for SSO, members, and invitations.
  • Retry transient ledger reads in fresh read-only transactions with a shared retry/statement budget. Deduct pool wait at acquisition and reject expired reads before starting the ledger query. Return sanitized 503 responses with Retry-After for known temporary read failures.
  • Use plain neutral read-error text across workspace and organization settings, preserve accessible alerts and retry controls, and update the shared settings guide.
  • Remove unused billing queries, optimistic cache handling, exports, and a mock-only routing test. Preserve billing statistics for their remaining consumers. Use one named plan/seat response shape and type across the contract, query, and cache-isolation fixtures.

Type of Change

  • Bug fix

Testing

GitHub Actions runs the full test suite, PostgreSQL integration matrix, E2E suites, build, lint, type-check, and audits. Integration coverage includes authorization and tenant denial, canonical seat accounting, unusable Enterprise access, failed reads, fresh transaction retries, read-only enforcement, exhausted pool-wait budgets, and sanitized HTTP errors. Initial regression cases failed on the old behavior or with guards removed. Follow-up tests run in CI as requested.

Local source validation: lint, type-check, all 58 audits, docs manifest, block registry, generated artifacts, and pinned actionlint. Earlier UI verification produced 14 captured states and five recovery flows using production components with synthetic session/API data. The refreshed live component gallery shows the neutral styling and supports manual failure/recovery checks. All nine cleanup passes reviewed the full PR diff.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Full CI test suite passing on the final commit
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 9, 2026 4:22am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 39 files

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/billing/core/ledger-read.ts
Comment thread apps/sim/lib/api/server/routes/billing-read.ts Outdated
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High impact] The reviewed changes appear safe to merge; no actionable issue remains.

Summary

Separates access settings from usage analytics and adds primary-backed organization plan and seat reads. The latest changes consolidate the response schema and reuse its named type in the query and fixtures.

  • No new actionable issues found.
  • The expired-budget guard now rejects the read before its query starts. waleedlatif1 accepted delayed connection acquisition because Drizzle cannot cancel queued acquisition without leaving a transaction running.
  • The exported query APIs have TSDoc.
  • greptile-apps[bot] dismissed the standalone-schema export finding: the contract exposes the validator, and a separate unused export would conflict with repository rules.
  • waleedlatif1 intentionally kept the freshness constant private: the hook and warmer share organizationPlanSeatsOptions, while exporting the constant separately would add an unused export.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[SSO, members, invitations] --> B[Shared plan and seat query]
  B --> C[Authorized billing-plan route]
  C --> D[Current organization admin or owner check]
  D --> E[Primary database plan and seat reads]
  F[Permission group settings] --> G[Permission group query]
  H[Billing statistics] --> I[Usage ledger reads]
Loading

Reviews (6) · Last reviewed commit: "refactor(settings): share the named plan..." · Reviewed by Greptile

Comment thread apps/sim/lib/billing/core/ledger-read.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 39 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/billing/core/ledger-read.ts
@waleedlatif1
waleedlatif1 force-pushed the codex/settings-billing-read-resilience branch from 6065401 to a9775db Compare October 9, 2026 03:42
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 39 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/hooks/queries/organization-plan-seats.ts
@waleedlatif1
waleedlatif1 force-pushed the codex/settings-billing-read-resilience branch from a9775db to 5c2c9d1 Compare October 9, 2026 04:02
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 73 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/ee/session-policy/components/session-policy-settings.tsx
Comment thread apps/sim/lib/api/contracts/organization.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 73 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/hooks/queries/organization-plan-seats.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 73 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit f20b5b4 into staging Oct 9, 2026
47 of 48 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/settings-billing-read-resilience branch October 9, 2026 04:32

This branch was previously deployed

1 inactive deployment
Preview — 05a1d5ae Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant