Skip to content

Sjip 1593 project es source in graphql hits - #269

Merged
evans-g-crsj merged 2 commits into
masterfrom
SJIP-1593-project-es-source-in-graphql-hits
Aug 17, 2026
Merged

Sjip 1593 project es source in graphql hits#269
evans-g-crsj merged 2 commits into
masterfrom
SJIP-1593-project-es-source-in-graphql-hits

Conversation

@evans-g-crsj

Copy link
Copy Markdown
Collaborator

No description provided.

evans-g-crsj and others added 2 commits August 17, 2026 15:29
graphql ships parallel CJS/ESM builds and declares no `exports` map, so Vite
resolves `module` (index.mjs) while node resolves `main` (index.js) for any
externalized dep — graphql-type-json, @graphql-tools/schema. Tests that build
a schema then fail with "Cannot use GraphQLObjectType ... from another module
or realm".

Alias graphql to index.js so tests run against the same copy node loads at
runtime. Test-only: vitest.config.ts is not read by `npm run build`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Creating a saved set above ~10k participants failed with:

  The content length (538859008) is bigger than the maximum allowed string
  (536870888)

The hits resolver searched ES without `_source`, so ES returned whole
documents however few fields the query selected. /sets asks for a single
field (the id) across MAX_SET_CONTENT_SIZE=10000 hits; at ~52KB per
participant_centric document that is a 514MB response, which the ES client
aborts on because it exceeds node's max string length.

This restores behaviour the post-arranger rewrite dropped, rather than adding
an optimization: @arranger/mapping-utils@2.19.4 resolveHits projected
`_source` from the selection set (the top-level keys of edges.node). Same
depth-1 rule here — projecting to leaves would break a nested `total`, which
resolveNested derives from the array length.

`_source` was not expressible on EsSearchParams before, hence the client
changes. Also fixes PUT /sets/:setId, and stops every FE table query from
fetching whole documents.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@evans-g-crsj
evans-g-crsj merged commit 0894da0 into master Aug 17, 2026
2 checks passed
@evans-g-crsj
evans-g-crsj deleted the SJIP-1593-project-es-source-in-graphql-hits branch August 17, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants