fix(platform): pass the corpus scope rows as one jsonb parameter - #3222
Merged
Conversation
reconcileDocumentScopeStamps handed `pool.unsafe` a pre-serialized JSON
string for the `$2::jsonb` parameter. postgres.js learns the parameter
type from the server's description and JSON-encodes jsonb parameters
itself, so the string arrived double-encoded and `jsonb_to_recordset`
refused it ("cannot call jsonb_to_recordset on a non-array"). The daily
scope reconcile (#3216) therefore never corrected a row, and the
integration proof truncated at the reconcile lane (19/133 lanes ran).
Hand the rows over as `pool.json(intended)` — the typed parameter the
rest of the backend uses — and pin the shape in the unit test.
This was referenced Sep 5, 2026
Collaborator
Author
|
Integration proof on this branch (throwaway Before the fix, main truncates at lane 19 (
|
This was referenced Sep 5, 2026
fix(platform): route legacy knowledge purges through the live pool and prune dead script paths
#3235
Merged
This was referenced Sep 5, 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.
Summary
reconcileDocumentScopeStamps(the daily corpus scope reconcile from #3216) passed a pre-serialized JSON string as the$2::jsonbparameter ofpool.unsafe. postgres.js learns the parameter type from the server's description and JSON-encodes jsonb parameters itself, so the payload arrived double-encoded and Postgres refused it withcannot call jsonb_to_recordset on a non-array. Effects on main: the reconcile never corrected a drifted row, and the real-Postgres integration proof truncated at that lane (RUN TRUNCATED at checkCorpusScopeReconcile, 19/133 lanes).Change
services/platform/backend/domains/knowledge/service.ts: hand the rows over aspool.json(intended), the typed jsonb parameter the rest of the backend uses.scope-reconcile.test.ts: the fake pool modelssql.json; a new case pins that the payload is a jsonb parameter carrying an array, never a string.Tests & gates observed
bunx vitest --run --project server backend/domains/knowledge/scope-reconcile.test.ts→ 10 passedbunx tsc --noEmit→ 0 errorsFound while gating the backend deep-review fix campaign (every fixer's itest run stopped at this lane).