Repository navigation
fix(api): declare nested list pagination at the default it actually serves - #132
Merged
Merged
Conversation
…erves Domain.subdomains and Account.domains honoured first/skip at runtime but declared no arguments, so introspection and codegen could not see them and a parent with more than 10 children silently lost the rest. Account.registrations declared first = 100 while serving 10. Declare first: Int = 10, skip: Int = 0 on all three, matching what the handlers have always returned. The default stays at 10 on purpose: the complexity budget charges a nested list 1 regardless of its row count, so this constant is the only bound on nested fan-out. Handlers and the nested connections now share NESTED_DEFAULT_FIRST instead of literals.
Only root-field arguments were resolved against the request variables. Nested handlers read their arguments with getIntArg and friends, which treat an unresolved $var as absent, so subdomains(first: $n) silently fell back to the default. expandSelections now resolves arguments at every depth, and an undefined variable is reported as a validation error instead of a generic execution failure.
The generator parsed and discarded SDL defaults, so every argument came out of introspection as a bare optional with no defaultValue and codegen clients could not see what an omitted first/skip means.
The subdomain and account-domain page loaders held a single (skip, first) per request and cleared the map when another shape arrived, and the prefetch only primed the first selection with a matching name. Differing args across nesting levels, or aliased siblings such as a: subdomains(first: 1) b: subdomains(first: 1, skip: 1), fell back to one point query per row. Key both maps by (key, skip, first) and prime every matching selection.
…hildren than a page The single-child fixture could not distinguish an honoured first from an ignored one or from a changed default. A dedicated fixture with 12 children, 3 grandchildren and 12 registrations pins the default page, first/skip, variables, aliased siblings, per-level args and the introspected defaults.
v1rtl
force-pushed
the
fix/subdomains-pagination
branch
from
September 29, 2026 13:56
ee583e3 to
f69d41b
Compare
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.
Domain.subdomainsandAccount.domainshonouredfirst/skipat runtime but declared no arguments, so introspection and codegen couldn't see them. A parent with more than 10 children silently lost the rest:tide.ethon Sepolia reportedsubdomainCount: 11whilesubdomainsreturned 10.Account.registrationshad the opposite problem: it declaredfirst: Int = 100but served 10.Changes
Declare what is served (
d30f3b2)subdomains(first: Int = 10, skip: Int = 0),Account.domains(first: Int = 10, skip: Int = 0), andAccount.registrationscorrected from= 100to= 10.complexity.zig:283), so this constant is the only bound on nested fan-out. Raising it to 100 would allow ~10× more rows with no change in cost. Every other nested list (subdomainConnection,eventsConnection) already uses 10.NESTED_DEFAULT_FIRSTinstead of literals.docs/TESTING.mdshows the new signature.Variables in nested arguments (
df45125)getIntArg, which treats an unresolved$varas absent, sosubdomains(first: $n)silently used the default. This affected every nested argument, not just this one.expandSelectionsnow resolves arguments at every depth.VALIDATION_ERROR; it used to be a generic execution failure.Introspection defaults (
80809d9)first: Int.defaultValueis now emitted for arguments and input fields.Batching across page shapes (
c578854)(skip, first)per request and cleared it when a different shape arrived. The prefetch also only primed the first selection with a matching name.subdomains(first:1){ subdomains(first:2) }a: subdomains(first:1) b: subdomains(first:1, skip:1)(key, skip, first), and every matching selection is primed.Tests (
f69d41b)alice.eth, which has a single child, sofirst: 1produced identical output whetherfirstwas honoured, ignored, or the default changed.first/skipAccount.domainsandAccount.registrationsKnown, not fixed here
subdomainCountis the signal, and the description says so.skippages can differ between backends. SQLite ordersnameby bytes, while Postgres uses the database collation (hyphens sort differently). Fixing this needsCOLLATE "C"on the(parent_name, name, protocol)index, which is a schema and performance decision.zig build test-all: 89/89 steps, 1481/1481 tests (zig 0.16.0).