Repository navigation
feat(D150): the managed meter measures each new version in convert - #556
Merged
Merged
Conversation
Metered deployments now accept every format a route reads, of any size the
route handles. Measurement moves from ingest into the convert stage:
- the pdf route (every page through OCR, D139) is doc-scan: the page count
from the page tree, before any OCR call (count_pages, or
count_pages_from_url for a by-URL route);
- a local reading route is doc-text: the whitespace-normalized character
count of the document.md it produced, before any paid stage;
- a card is free; any other route is refused (rate_class_unavailable).
Convert work then parks with the new `admission` defer reason until the
meter drain records the control plane's approval, which releases it in the
same transaction. The receipt becomes the generic v3
{cost_class, native_quantity, unit}; ingest no longer classifies text,
caps sources at 10 MB or stages bytes in the outbox (p9_46_0067).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
fazpu
marked this pull request as ready for review
November 7, 2026 16:05
# Conflicts: # src/rememberstack/adapters/converters/pdf.py
…e D143 OpenAPI pin Migration tests walk down through the head, so p9_46_0067 restores the text-only outbox while it holds only delivered text receipts. The D143 additive-OpenAPI check strips D150's `admission` defer reason like D143's own additions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
… designs - p9_46_0067 takes ACCESS EXCLUSIVE on the outbox before checking for staged originals, so an old writer cannot stage bytes between check and drop; a migration test proves the refusal. - D150 declares the Rule 4 boundary: metered text keeps its registry MIME and D138 route instead of the old classifier's text/plain. - processing_layers_design and e0_files_design follow D150. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Member
Author
Codex review, round 1 (gpt-6.1-sol, max effort)VERDICT: REQUEST_CHANGES
Dispositions
|
…es its cycle - p9_46_0067's downgrade takes ACCESS EXCLUSIVE before its guard. - The sync-cycle retraction barrier exempts deleted sources parked for admission exactly as it exempts deleted no-route input; the D117 deletion regression now covers both reasons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Member
Author
Codex review, round 2 (gpt-6.1-sol, max effort)VERDICT: REQUEST_CHANGES
Dispositions
|
Member
Author
Codex review, round 3 (gpt-6.1-sol, max effort)VERDICT: APPROVE |
# Conflicts: # src/rememberstack/workers/e0.py # src/tests/spine/test_managed_metering_sql.py
…round 4 minor) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Member
Author
Codex review, round 4 (merge of #554; gpt-6.1-sol, max effort)VERDICT: APPROVE
Disposition: minor fixed (docstring). |
# Conflicts: # packages/typescript-client/contracts/metadata.json # packages/typescript-client/src/metadata.generated.ts # packages/typescript-client/src/version.generated.ts
This was referenced Nov 7, 2026
Merged
Closed
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.
Problem
A metered deployment — every hosted remember.dev Project — measured at ingest. Only plain UTF-8 text and Markdown up to 10 MB could be measured. Everything else was refused before it was stored:
409 rate_class_unavailableor422 rate_class_ambiguous;413 source_bytes_limit_exceeded.The accepted bytes were also staged in a
byteacolumn until approval. The cloud's D94 asks for a generic receipt instead:{cost_class, native_quantity, unit}per source version, every PDF page billed asdoc-scan, and other readable text billed asdoc-text.Decision (D150)
Measurement moves into the convert stage, where the route that reads the file is known (
core/metering.py).pdf→doc-scan. The page count comes from the page tree before any OCR call. Bytes routes usePageCountingConverter.count_pages. By-URL routes (D147) useUrlPageCountingConverter.count_pages_from_url, so the worker never reads the object.PdfConverterimplementscount_pages.doc-text. Covers text, markitdown, office, email, notebook, spreadsheet, table and dataset. The quantity is the whitespace-normalized character count of thedocument.mdthe route produced. These routes call no provider, so the count still comes before every paid stage.cardis free. It produces no measurement.rate_class_unavailable, so a metered deployment never runs provider work it cannot bill.admissiondefer reason. No claim takes a row in that state.release_admission_on), and announces it for push hosts.park_for_admissionreads the approval under the measurement-row lock that the approval takes, so a race leaves the work queued, never stranded.classify_doc_textand the classification409/413/422responses are deleted. Unchanged bytes create no version, so there are nono_opreceipts.rememberstack.ingest_measurement.v3: roleprimary,format_family,cost_class,native_quantity,unit(exactly one unit per class).rememberstack.document_version_outcome.v3:succeededorfailedonly.<cost class>-<standard|claims|sources>-v1.p9_46_0067.staged_contentand theno_opdisposition, and addscost_class,unitandformat_family. The migration refuses to run while staged originals remain undrained.admissiondefer reason.PipelineStageReadiness.defer_reasongainsadmission. OpenAPI and the TypeScript contracts are regenerated.RunResultOutcomegainsadmission_parked.Rule 4 (a new version costs only its edit)
No component version moves: converter, blockizer, chunker, extractor and embedding versions all stay. An unmetered deployment takes exactly the old path.
There is one declared boundary, for metered deployments only. The removed ingest classifier stored every metered text as
text/plainortext/markdown. Now a metered deployment keeps the registry MIME, as an unmetered one does, so CSV, code, configuration and logs take their own D138 routes and postures. A lineage whose previous version was ingested under the old classifier re-processes once at its next version. That is accepted because the hosted service relaunches without customer data. D150 states it.Deploy order
The control plane must accept v3 before any deployment runs this release. That is UMC PR writeitai/ultimate-memory-cloud#805, which deploys together with the runtime pin bump. The UMC runtime's
RemoteConvertergainscount_pages_from_urlin the same follow-up.Not in this PR
The
<Cloud>docs passages that describe remember.dev's refusals are left for the PR that ships with the hosted rollout:cloud/limits,cloud/compatibility,guides/ingest-files,reference/errors,reference/http-api/ingest,bring-your-data,file-types,start/choose.Those passages are public claims about the hosted service. They must not change before it runs this release.
Validation
ruff check,ruff format --check,pyright src/(0 errors) andlint-imports(5 kept) pass.export_typescript_contracts --checkandcheck:generatedpass.Unit tests pass:
core/test_metering.py,adapters/test_managed_metering.py,workers/test_ingest_routability.py.PostgreSQL 19rc1 integration tests (isolated container):
spine/test_managed_metering_sql.pypasses, covering:test_processing_layers_pg.py,test_forget_catalog.py,test_p3_corpusfs.pyandtest_migrations.py: see the comments below.Codex review: see the comments below.
I have read and agree to the RememberStack Contributor License Agreement v1.0.
🤖 Generated with Claude Code
https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm