Skip to content

fix(codegen): FindManyArgs TCondition slot fix + regenerate SDK from latest constructive-db#819

Merged
pyramation merged 2 commits intomainfrom
devin/1773541131-regenerate-sdk-schemas
Mar 15, 2026
Merged

fix(codegen): FindManyArgs TCondition slot fix + regenerate SDK from latest constructive-db#819
pyramation merged 2 commits intomainfrom
devin/1773541131-regenerate-sdk-schemas

Conversation

@pyramation
Copy link
Contributor

fix(codegen): explicit never for FindManyArgs TCondition + regenerate SDK from latest constructive-db

Summary

Bug fix (3 files, ~6 lines of actual logic):

FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = never> has TCondition at position 3. When a table has no condition type, both model-generator.ts and queries.ts were using a spread pattern that omitted TCondition entirely, producing 3-arg calls like FindManyArgs<S, Filter, OrderBy>. TypeScript resolves this as TCondition = OrderBy, TOrderBy = never, which breaks every orderBy parameter on tables without condition types.

Fix: always emit 4 type arguments, passing never explicitly when no condition type exists:

// Before (broken when no condition type):
...(conditionTypeName ? [typeRef(conditionTypeName)] : []),

// After (always 4 args):
conditionTypeName ? typeRef(conditionTypeName) : t.tsNeverKeyword(),

SDK regeneration (~920 auto-generated files): Fresh introspection of constructive-db picks up schema changes including fields jsonb parameter on SecureTableProvisionInput for inline field definitions, new tables (DefaultPrivilege, NodeTypeRegistry, HierarchyModule, SqlMigration, AstMigration), removal of TableModule, and new *TrgmSimilarity/searchScore columns across many tables.

Review & Testing Checklist for Human

  • New required fields on existing tables are a breaking change. Many tables now require *TrgmSimilarity and searchScore fields on create. Verify this is expected from the DB schema and that existing consumers (e.g. agent-os provision scripts) are updated before publishing.
  • private.graphql was added to sdk/constructive-sdk/schemas/. This file is identical to public.graphql and is excluded by the codegen's EXCLUDE_TARGETS, but it wasn't present before. Confirm this is acceptable or should be excluded from the commit.
  • Verify no other codegen paths construct FindManyArgs type args with the same spread pattern. The fix covers model-generator.ts and queries.ts — search for other spread-into-FindManyArgs patterns that may have been missed.
  • Test plan: After publishing, update a downstream consumer (e.g. agent-os) to the new SDK version and verify: (1) secureTableProvision.create() accepts fields parameter, (2) findMany with orderBy works on tables that lack condition types (e.g. ViewRule), (3) React hooks build without type errors.

Notes

… for TCondition)

When no condition type exists for a table, both model-generator.ts and queries.ts
were passing 3 type args to FindManyArgs<TSelect, TWhere, TCondition, TOrderBy>,
which caused OrderBy to land in the TCondition slot (position 3) and TOrderBy to
default to never. This broke orderBy on all tables without condition types.

Fix: always emit 4 type args, using never for TCondition when absent.
… latest constructive-db introspection

- Fresh introspection includes fields parameter on SecureTableProvisionInput
- 103 public tables, 32 admin tables, 7 auth tables, 5 objects tables
- All generated code uses fixed FindManyArgs with explicit never for TCondition
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit dc4a5ba into main Mar 15, 2026
44 checks passed
@pyramation pyramation deleted the devin/1773541131-regenerate-sdk-schemas branch March 15, 2026 02:49
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.

1 participant