perf: send a schema reference in get-block-data instead of the full schema - #6402
Merged
Pyatakov merged 2 commits intoAug 3, 2026
Merged
Conversation
…chema
request-vc-document-block(-addon) getData embedded the full schema
(document + context) in every form block, so get-block-data responses
grew to tens of MB for policies with large schemas - parsed and
re-serialized across services and refetched by the client.
Emit a lightweight schema reference { id, iri, uuid, name, version };
the client resolves the full schema once by id (cached, de-duplicated)
via GET /schema/:id. The frontend is backward-compatible: a full schema
(document present) is used as before, so the client change is a no-op
until the backend sends a reference.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pyatakov
requested changes
Jul 27, 2026
…f rendering a blank form Falling back to the bare reference (no `document`) made `parseDocument()` a no-op, so `fields` stayed empty and the user saw a silently blank form. Route the failure through `_onError` so it hits the normal error/loading path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Pyatakov
approved these changes
Aug 3, 2026
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
requestVcDocumentBlockandrequestVcDocumentBlockAddongetData()embed the full schema (document+context) in every form block. For policies with large schemas the same schema is serialized once per form block, soget-block-dataresponses can reach tens of MB. That payload isJSON.parse/JSON.stringify-d as it is relayed between services (which do not read it), kept in memory on the client, and re-fetched on every block update — the repeated multi-MB serialization blocks the single Node event loop and slows unrelated requests.Change
Emit a lightweight schema reference
{ id, iri, uuid, name, version }instead of the fulldocument/context. The frontend resolves the full schema once by id (cached and de-duplicated) via the existingGET /schema/:id.get-block-dataresponses for schema-heavy forms.document) exactly as before, so the client change is a no-op until the backend sends a reference. The change is sequenced so the frontend can ship first.Details
request-vc-document-block.ts,request-vc-document-block-addon.ts—getDatareturns the reference.SchemaService.getSchemaById+ cached/de-duplicated/error-evictingresolveSchemaById;request-document-block(-addon)_onSuccessresolves a reference to the full schema before the existing render flow.Tests
request-vc-getdata-reference.test.mjs):getDataemits a reference, notdocument/context. Passing.schema.service.spec.ts): endpoint, concurrent-subscriber de-dup, cache-hit, and error-eviction/retry.Notes for reviewers
get-block-datathat relies on the embeddeddocument/context(e.g. remote/multi-policy interaction). Theid/iriare still present for anything that needs to look the schema up.