Repository navigation
feat(api): connected-record usage and an enforced record allowance (#518) - #1286
Merged
Merged
Conversation
) The commercial unit the pricing page already promises — connected records, summed across every system — is now measured and enforced: - GET /v1/orgs/{org}/usage (viewer+): each dataset's standardized records at its latest snapshot, the total, the allowance, what remains, at_limit. Distinct records by construction, so retries, idempotent replays and re-deliveries never double-count; a failed or canceled run lands nothing. - orgs.record_allowance (nullable = unlimited), set by the operator through PATCH /v1/orgs/{org}/allowance (a tenant key gets 403). - JSON pushes, file imports and new uploads are refused with 402 once the total reaches the allowance; reads, reviews, corrections and exports continue. A count that cannot be taken fails open. The launch proof checks the counts, the 402 at the limit, reads at the limit, and recovery when the allowance is lifted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
athvin
temporarily deployed
to
marketing-preview
November 27, 2026 01:21 — with
GitHub Actions
Inactive
This was referenced Nov 27, 2026
athvin
added a commit
that referenced
this pull request
Nov 27, 2026
… epic and #1279's duplicates Parquet export (#1300) #1286 (248e296) was one commit, d245d4a. Its parent was a fresh main (8b5b25a), but 75 files in its tree were the versions from dc45fd1: a tree from an old worktree was committed on top of a new base. The squash was CLEAN and the old code is self-consistent, so every gate passed while it undid: - the cinematic epic #1253: #1272, #1275, #1278, #1280, #1282, #1283 and #1285, with their tests and visual baselines; - #1279's Parquet export for duplicate groups (exports.rs, read.rs, export_write.rs and the ExportIn doc comment). This is the merge #1286 should have produced, computed rather than hand-picked: 1. Give d245d4a's tree its real parent, dc45fd1. 2. Three-way merge it into 2b8f0b8, the main it landed on, with base dc45fd1. No conflicts. 3. Carry the difference from 248e296 onto today's main with another three-way merge. No conflicts. #1286's own work is kept: the usage endpoint, the record allowance, and the docs on usage and the 402. Closes #1299 Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
athvin
pushed a commit
that referenced
this pull request
Nov 27, 2026
…sion #1286 was one commit whose parent was a fresh main but whose tree came from an old worktree. It undid seven merged pull requests, and every gate was green: the squash was CLEAN and the old code was self-consistent. #1310 nearly did the same that day. The diff reads as a feature that also deletes things. What gives it away is that each file's new content is a version main already had and moved past. `stale tree guard` (stale-tree-guard.yml) walks each changed file's history on main and names the commits a return would undo. A file brought back with the content it had before main deleted it is the same finding. Deletions alone are not findings. It is graded on main's own history: - three or more source files returning fails; - fewer warn (#1302 deliberately took back two lines of #877); - screenshot baselines are reported and never counted (#1298's CTA baseline landed on old bytes). Replayed against #1286's commit and main's last 40 merges, each on its true parent: - #1286 fails, on 33 source files; - so does #1300, the restore, its mirror image, a revert that would carry `revert-ok`; - three merges warn; - the other 35 are silent. The self-test runs first in the job. It covers the #1286 shape, a partial revert, a baseline on old bytes, a genuine change, both exemptions (a `Revert…` title and the `revert-ok` label) and a shallow clone, which is refused rather than passed. The check is not required yet, by the order the ci-and-supply-chain skill gives. Closes #1307 Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 tasks done
athvin
added a commit
that referenced
this pull request
Nov 27, 2026
…sion (#1315) * wip: claim #1307 — flag a pull request whose files revert to an older main version * feat(ci): flag a pull request whose files return to an older main version #1286 was one commit whose parent was a fresh main but whose tree came from an old worktree. It undid seven merged pull requests, and every gate was green: the squash was CLEAN and the old code was self-consistent. #1310 nearly did the same that day. The diff reads as a feature that also deletes things. What gives it away is that each file's new content is a version main already had and moved past. `stale tree guard` (stale-tree-guard.yml) walks each changed file's history on main and names the commits a return would undo. A file brought back with the content it had before main deleted it is the same finding. Deletions alone are not findings. It is graded on main's own history: - three or more source files returning fails; - fewer warn (#1302 deliberately took back two lines of #877); - screenshot baselines are reported and never counted (#1298's CTA baseline landed on old bytes). Replayed against #1286's commit and main's last 40 merges, each on its true parent: - #1286 fails, on 33 source files; - so does #1300, the restore, its mirror image, a revert that would carry `revert-ok`; - three merges warn; - the other 35 are silent. The self-test runs first in the job. It covers the #1286 shape, a partial revert, a baseline on old bytes, a genuine change, both exemptions (a `Revert…` title and the `revert-ok` label) and a shallow clone, which is refused rather than passed. The check is not required yet, by the order the ci-and-supply-chain skill gives. Closes #1307 Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #518
What
Usage and entitlement for the API product. Unit = connected records (standardized source records summed over datasets) — the unit the public pricing page already states, so no new pricing promise.
GET /v1/orgs/{org}/usage; operatorPATCH /v1/orgs/{org}/allowance(new nullableorgs.record_allowance); deliveries 402 at the limit; docs "How usage is measured" + 402 in the error table; readiness record updated.Why
#518: decide the commercial unit and pilot policy, enforce it, prevent double-charging, let admins inspect usage through the public contract, and have the launch proof verify it.
Proof
pg_launch_proof(DuckLake + Postgres): each dataset reports exactly its delivered records despite a redelivery and an idempotent retry; total = sum; allowance set to the total →at_limit, push 402, reads 200, tenant cannot change its allowance (403); lifting it → push 202.cargo test -p er-serveragainst Postgres; frontend unit suite (1104);make checkexit 0.Risk & rollback
Additive nullable column; no allowance is set on any existing org, so nothing is enforced until an operator sets one. A revert leaves the column (harmless).
Post-merge ledger
Closed by: agent · session
Claude Code:24d16c2e-fec6-49d8-9797-060338df4848onbrians-MacBook-Pro· 2026-11-27T02:01:21Zmainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not:
248e2966— rust 45922107179, frontend 45922107283 success; its deploy 45922458663 FAILED (schema-migrate, Deploys fail since #518: the pre-reconcile default-dataset sweep reads orgs through the full-row statement #1290) and was fixed forward by fix(schema): the pre-reconcile default-dataset sweep reads only the org columns it copies (#1290) #1291 (b3c3907e)imagesbuilt, or correctly never ran because nothing that goes intoan image changed: 45922107183 success
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: converged via the fix-forward: deploy 45925250641 success; the live process at https://dupezero.com/api/openapi serves
/v1/orgs/{org}/usagedeploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: deploy green after fix(schema): the pre-reconcile default-dataset sweep reads only the org columns it copies (#1290) #1291; drift/kind red for known reasons (Confirm the er-alerts email subscription and prove alert delivery #1056, kind probe red since 2026-11-10: KeyError 'token_hash' after the credential-omission fix #1106)
Donethrough the automation rather than byhand, and the issue closed: E3 — API usage, entitlements and commercial metering #518 CLOSED, card Done via the merge automation
(a skill, a reference, memory) — or nothing new was learned: memory
pre-reconcile-reads-must-be-narrow: a new column on a table read before the reconciler breaks every deploySpecific to this change
Context — plan, discoveries, measurements, files
Plan
Discoveries
frontend/src/lib/pricing/config.tstiers by total records); the ticket's open question was enforcement, not pricing.erweb.usage_eventsledger meters AI calls, not billable data, and the docs already said so; it is unchanged.Measurements
Files
🤖 Generated with Claude Code