Skip to content

feat(api): a 10% soft buffer above the record allowance, and usage the app can show (#1522) - #1560

Merged
athvin merged 3 commits into
mainfrom
feat/allowance-buffer
Dec 3, 2026
Merged

athvin merged 3 commits into
mainfrom
feat/allowance-buffer

Conversation

@athvin

@athvin athvin commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Closes #1522

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

The 10% soft buffer the pricing page promises is now real. er-server refuses deliveries only once records reach the allowance plus 10% (refusal_limit). GET /v1/orgs/{org}/usage gains two fields:

  • over_allowance — the org is over its allowance and still accepting;
  • limit — where refusals start.

at_limit keeps its meaning, "refused". In the frontend:

  • an upstream 402 becomes allowance_reached instead of a 502 "internal";
  • Settings → Usage shows connected records against the allowance, with the buffer drawn to scale;
  • the dashboard's "Needs attention" says when the org is over its allowance or refusing;
  • /docs describes the buffer.

Why

Part of #1519. The owner decided (2026-12-02) that the pricing page is the policy. The code refused at 100% of the allowance, and the app showed that refusal as a generic error.

Proof

  • Rust (built into the shared target, since the disk is at ~98%):
    • cargo fmt --check clean.
    • cargo clippy -p er-server --all-targets -D warnings clean.
    • cargo test -p er-server --lib allowance_buffer: 3 passed. The overflow case caught a real + 99 overflow at i64::MAX, now saturating.
    • The launch proof (pg_launch_proof.rs, Postgres-backed, CI's DuckLake e2e tier) now walks: over the allowance and accepting, then at the limit and 402, then raised and accepting.
  • The OpenAPI documents and schema.d.ts were regenerated (additive). make api-launch-gate-check self-test: 14 passed.
  • Frontend:
    • vitest run → 1,333 passed. New tests cover the 402 → allowance_reached mapping, the usage card's four states, and the error vocabulary.
    • Playwright, Chromium + iPhone WebKit: record-usage, axe (new usage-settings screen), dashboard, grow, steward surfaces, first results → 188 passed.
    • Authz gate: 129 handlers.
  • Baselines: config studio ×3 changed (the new settings tab). The dashboard is identical; every mock org is unlimited.

Risk & rollback

The refusal threshold moves up by 10%; no data changes. The dashboard reads usage once a minute (one lake count per dataset, the same count every delivery already pays). git revert <merge-sha>.

Post-merge ledger

Closed by: unclosed

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not:
  • images built, or correctly never ran because nothing that goes into
    an image changed:
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion:
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed:
  • follow-ups are open for everything deferred here — numbers:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned:

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Open the marketing preview

This link updates with new commits. The PR's previews are deleted when it closes or merges.

bmoore813 and others added 3 commits December 2, 2026 21:54
…e app can show (#1522)

/pricing promised a 10% soft buffer above a tier's record cap and a prompt
to upgrade; er-server refused every delivery with 402 the moment records
reached the allowance, and the BFF turned that 402 into a 502 "internal".
The owner made the page the policy.

er-server:
- refusal_limit(allowance) = allowance + 10%, rounded up and saturating;
  deliveries are refused only once records reach it.
- GET /v1/orgs/{org}/usage gains over_allowance (records > allowance, still
  accepted) and limit (where refusals start); at_limit keeps its meaning,
  "new deliveries are refused". Additive to the public contract; the
  OpenAPI documents and schema.d.ts are regenerated.
- The 402's detail names the total, the allowance and the limit.
- The launch proof walks the buffer: over the allowance and accepting, then
  at the limit and refusing, then raised and accepting.

frontend:
- BFF: a new allowance_reached code; an upstream 402 maps to it (shared
  mapping and the imports route), never to 502.
- Settings → Usage: connected records against the allowance, the buffer
  drawn to scale in the same track, each dataset's share, and the standing
  in a sentence with its glyph. Any member may read it.
- Dashboard: "Needs attention" says when the org is over its allowance or
  refusing new records, linking to Usage.
- /docs' usage section describes the buffer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… reference (#1522)

The agent-skills drift gate failed on #1560: the new /[org]/settings/usage
page was missing from frontend-data-ui's generated screens list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin force-pushed the feat/allowance-buffer branch from 9e75838 to 5cedb8e Compare December 3, 2026 02:56
@athvin
athvin merged commit 8101dd1 into main Dec 3, 2026
45 checks passed

This branch was successfully deployed

1 active deployment
marketing-preview — 5cedb8e4 Deployed Dec 3, 2026 by athvin via publish marketing preview #325
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.

Record allowance: a 10% soft buffer, and usage the app can show

2 participants