-
Notifications
You must be signed in to change notification settings - Fork 404
Improve large Content database performance #2522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
d8e886f
d07d402
03c1a6f
59409da
b95ceb0
1d2dca3
b0c28b1
57be73a
e717fdb
83c4582
46ffed6
212c4e8
f006d6a
748688f
ccaa7b7
e7415e7
06af498
a2fced0
560ed09
a9e72b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@agent-native/core": patch | ||
| --- | ||
|
|
||
| Preserve nested object parameters when browser clients call GET actions. |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,6 +218,36 @@ function normalizeBuilderCmsListFieldPath(fieldPath: string) { | |
| return normalized; | ||
| } | ||
|
|
||
| function preserveProjectedBuilderFieldAbsence( | ||
| read: BuilderCmsReadResult, | ||
| fieldPaths: readonly string[] | undefined, | ||
| rawData: boolean | undefined, | ||
| ): BuilderCmsReadResult { | ||
| if (read.state !== "live" || rawData === true || !fieldPaths?.length) { | ||
| return read; | ||
| } | ||
| const projectedFieldPaths = [ | ||
| ...new Set( | ||
| fieldPaths | ||
| .map(normalizeBuilderCmsListFieldPath) | ||
| .filter((fieldPath): fieldPath is string => fieldPath !== null), | ||
| ), | ||
| ]; | ||
| if (projectedFieldPaths.length === 0) return read; | ||
| return { | ||
| ...read, | ||
| entries: read.entries.map((entry) => { | ||
| const sourceValues = { ...entry.sourceValues }; | ||
| for (const fieldPath of projectedFieldPaths) { | ||
| if (!Object.prototype.hasOwnProperty.call(sourceValues, fieldPath)) { | ||
| sourceValues[fieldPath] = null; | ||
|
Comment on lines
+246
to
+248
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Do not mark nested Builder projections as absentThe normalizer accepts paths such as Additional Info |
||
| } | ||
| } | ||
| return { ...entry, sourceValues }; | ||
| }), | ||
| }; | ||
| } | ||
|
|
||
| export function builderCmsListEntryFields(fieldPaths: readonly string[] = []) { | ||
| const fields = new Map<string, string>(); | ||
| for (const fieldPath of [ | ||
|
|
@@ -1273,22 +1303,32 @@ export async function readBuilderCmsContentEntries(args: { | |
| publicKey, | ||
| privateKey: privateKey ?? undefined, | ||
| }); | ||
| if (contentApiRead.state === "live") return contentApiRead; | ||
| if (contentApiRead.state === "live") { | ||
| return preserveProjectedBuilderFieldAbsence( | ||
| contentApiRead, | ||
| args.fieldPaths, | ||
| args.rawData, | ||
| ); | ||
| } | ||
| if (!privateKey) return contentApiRead; | ||
| } | ||
|
|
||
| if (privateKey) { | ||
| try { | ||
| return await readBuilderCmsContentEntriesViaMcp({ | ||
| model: args.model, | ||
| fieldPaths: args.fieldPaths, | ||
| rawData: args.rawData, | ||
| limit: args.limit, | ||
| maxPages: args.maxPages, | ||
| offset: args.offset, | ||
| fetchImpl, | ||
| privateKey, | ||
| }); | ||
| return preserveProjectedBuilderFieldAbsence( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Do not treat failed MCP hydration as an empty fieldThe MCP search fallback retains the original entry when per-entry hydration fails. Passing that partial result through absence preservation turns missing projected fields into authoritative nulls, so source-field creation can skip its Builder reread and persist empty values instead of retrying or surfacing the unreadable state. Additional Info |
||
| await readBuilderCmsContentEntriesViaMcp({ | ||
| model: args.model, | ||
| fieldPaths: args.fieldPaths, | ||
| rawData: args.rawData, | ||
| limit: args.limit, | ||
| maxPages: args.maxPages, | ||
| offset: args.offset, | ||
| fetchImpl, | ||
| privateKey, | ||
| }), | ||
| args.fieldPaths, | ||
| args.rawData, | ||
| ); | ||
| } catch (error) { | ||
| return { | ||
| state: "error", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Preserve non-plain GET parameter values
This branch JSON-serializes every object, including
DateandURLSearchParams. A Date now arrives JSON-quoted instead of in its prior parseable string form, while URLSearchParams serializes to{}and loses its entries; restrict this path to plain records and retain the existing string conversion for other object types.Additional Info