8000 feat!: leave the sqlcommenter comment out of .sql by colinhacks · Pull Request #135 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

feat!: leave the sqlcommenter comment out of .sql - #135

Merged
colinhacks merged 2 commits into
mainfrom
sql-no-comment
Oct 27, 2026
Merged

colinhacks merged 2 commits into
mainfrom
sql-no-comment

Conversation

@colinhacks
Copy link
Copy Markdown
Owner

The query's .sql is the compiled statement alone. The sqlcommenter comment naming the file is added only where Reylo sends the statement, so it still reaches the database's monitoring, but .sql and its hover no longer carry it.

  • getUser.sql is select id, name, email from users where id = $1: no /*file='…'*/, and no trailing newline.
  • .run() and a Standard Query's text send the statement with the comment, unless the project file says sqlcommenter: false. The module now passes sqlcommenter: true to defineQuery, and sentText in src/execute.ts appends the comment last, after a structured parameter's lists are written.
  • The declaration types sql as the compiled statement, and neither sql nor raw carries a doc comment, so a hover over either shows its text once. The note under sql that explained placeholders and casts is gone (sqlNote and RAW_NOTE in src/doc-comment.ts). The import's hover still shows the file's comment and the statement as written.
  • Docs: Usage says .sql is the compiled query with the database's own placeholders; Configuration says each query Reylo sends ends with the comment and that .sql leaves it out.
  • site/scripts/capture-types.ts renders the same declaration, and site/lib/sql-modules.json is captured again. Twelve MySQL modules also pick up the more detailed QueryError the current engine writes, which the committed capture had not caught up with.

.sql's value changes, hence the !.

Checks: nub run typecheck, nub run test with Postgres 18 and MySQL 8.4 (282 pass, none skipped), nub run build, and nub run build in site/.

Reylo still sends each statement with the comment naming its file; the
query's sql is the compiled statement alone, and its hover shows it once.
Copilot AI balanced review requested due to automatic review settings October 27, 2026 17:24
@vercel
vercel Bot commented Oct 27, 2026 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 27, 2026 5:26pm UTC

Request Review

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This review covers the whole PR: the sqlcommenter comment now goes on when Reylo sends a statement instead of being built into the module, and the docs, the declarations and the captures follow.

  • Comment added at send time: sentText in src/execute.ts adds the comment last in statement(), after a structured parameter's variant has rewritten its lists. That covers .run(), .runSync() and a Standard Query's encode. standard-query.ts's statementText also goes through sentText, so the check that a statement's text doesn't depend on its input still compares a commented text with a commented text.
  • Module flag: the loader writes sqlcommenter: true into defineQuery when the project has it on. QueryDefinition and QueryModule gain the field. A query defined by hand still gets no comment, as before.
  • .sql is rewritten.sql.trimEnd(): the loader, the mapper and capture-types.ts all use it. The structured lists' offsets are computed on the trimmed text, which only changes at its end, so the offsets don't move.
  • Declarations: sql and raw lose their doc comments, and sqlNote and RAW_NOTE are gone. The mapper's Project and configIdentity drop sqlcommenter, since declarations no longer depend on it. The session key in src/analyze.ts still includes it, which is right because the loader still reads it.
  • Docs: the .sql sentence in Usage and the sqlcommenter paragraph in Configuration are updated. The skill never mentions the comment, so it needs no change.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit ed02996 into main Oct 27, 2026
7 checks passed
@colinhacks
colinhacks deleted the sql-no-comment branch October 27, 2026 17:29
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

0