Skip to content

fix: correct findOne docs to use top-level PK instead of where wrapper#747

Merged
pyramation merged 2 commits intomainfrom
devin/1772137665-fix-findone-docs
Feb 27, 2026
Merged

fix: correct findOne docs to use top-level PK instead of where wrapper#747
pyramation merged 2 commits intomainfrom
devin/1772137665-fix-findone-docs

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Feb 26, 2026

Summary

The ORM docs generator (docs-generator.ts) was emitting findOne({ where: { id: '<value>' }, ... }) in generated documentation, but the actual SDK signature produced by model-generator.ts is findOne({ id: '<value>', select: ... }) — the primary key is a top-level parameter, not nested under where.

This fix updates three doc generation functions to emit the correct signature:

  • generateOrmReadme — README.md code examples
  • generateOrmAgentsDocs — AGENTS.md method signatures
  • generateOrmSkills — per-table skill file usage snippets

Snapshot tests in cli-generator.test.ts were updated to match the corrected output (4 snapshots).

Closes constructive-io/constructive-planning#623

Review & Testing Checklist for Human

  • Verify the corrected findOne signature ({ pk, select }) matches what model-generator.ts actually generates — cross-reference with a generated model file like sdk/constructive-sdk/src/admin/orm/models/invite.ts (line ~100)
  • Decide whether the already-committed .md skill/README files in constructive-sdk (and constructive-db) need to be regenerated as part of this PR or as a follow-up. This PR only fixes the generator — existing generated docs still contain the old where syntax.
  • Spot-check that update and delete methods still correctly use where in the generated docs (only findOne should have changed)

Notes

The docs generator was emitting findOne({ where: { id } }) but the actual
generated SDK signature is findOne({ id, select }). Fixed in README,
AGENTS.md, and skills generators.

Closes constructive-io/constructive-planning#623
@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 b884ba7 into main Feb 27, 2026
44 checks passed
@pyramation pyramation deleted the devin/1772137665-fix-findone-docs branch February 27, 2026 01:06
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