Repository navigation
feat(engine): show column comments in the row's hover - #35
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues — one edge case inline.
Reviewed changes
I reviewed the whole PR: reading column comments on Postgres and MySQL and printing them as JSDoc on Row/Params fields.
- Engine API:
ColumnandParamgain an optionalcomment, which is left out of the JSON when there is none. SQLite always leaves it asNone. - Postgres: a new
COMMENTS_QUERYis asked in the same round as the CHECKs.Engine::commentsgates result columns onown_provenance, follows a view's column to its source column, and gives a written parameter its column's comment when all the columns it fills share one. - MySQL:
column_typesbecomestypedand returnsTyped { types, comments, columns }, andTYPES_QUERYnow readscolumn_comment. The tables come from both the parameters' targets andtraced_from, so a result column gets a comment only for a plain SELECT whoseorg_tableis one of its FROM tables. - Mapper:
fieldComment/objectTypeinsrc/module-types.tskeep a type on one line when no field has a comment. Otherwise each field gets its own line after its doc comment. Onlysrc/mapper.tscallsmoduleTypes. The site'scapture-types.tsrenders its own one-line types, so the site regexes that parseexport type Row = (.*);are unaffected. - Fingerprint:
src/analyze.tsnow includespg_descriptioncolumn comments and MySQL'smd5(column_comment), so an edited comment re-types the import.
claude-opus-5-5 | 𝕏
colinhacks
force-pushed
the
column-comments
branch
2 times, most recently
from
October 22, 2026 22:14
6f7e45f to
04024c7
Compare
colinhacks
force-pushed
the
column-comments
branch
from
October 22, 2026 22:42
04024c7 to
ca02082
Compare
Contributor
There was a problem hiding this comment.
✅ No new issues found. The set-operation fix closes the earlier finding.
Reviewed changes
I reviewed ca02082, the one commit since the last Pullfrog review.
- Per-position result comments:
Engine::commentsnow returnsComments { columns, written }.columnsholds one entry per result column and isNonewhereverown_provenanceis false, sorun()no longer looks up a set-operation column by its leftmost arm's(table, attnum). The empty-pairspath fillscolumnswithNonetoo. - Parameter comments: the
(relation, attnum)map is now used only for written parameters (comments.written). It is built from the sameby_columnresolution, so view-to-source fallback still applies. - Test: added the CTE-union case.
a.idgets no comment andu.id AS uidkeeps its own.cargo test -p reylo-engine-postgres --lib commentandtests/fingerprint.test.tspass locally.
claude-opus-5-5 | 𝕏
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.

Postgres and MySQL let a schema document a column (
COMMENT ON COLUMN users.age IS 'Age (in years)',age int COMMENT 'Age (in years)'). Reylo now reads those comments and prints each one as the doc comment of everyRowfield that reads the column as it is, so the editor's hover overuser.ageshows "Age (in years)". SQLite keeps no comments, so nothing changes there.Before / after
select id, age, age as years, email, lower(email) as lower_email from users where id = :idBefore:
After:
A type with no comments is still written on one line, exactly as before. With a comment, each field gets a line of its own, because TypeScript 7's language server reads a JSDoc only where a line starts with it:
{ id: number; /** doc */ age: number }shows no documentation in the hover, and the same type with a line break before/**does.The language server's hover over
user?.age(from the new test):What changed
Column,Param): each gets an optionalcommentfield, which is left out of the JSON when there is none.COMMENTS_QUERY(pg_descriptionby table oid and attnum), is asked in the same round as the CHECKs, for each result column whose origin the describe names. So an alias keeps its column's comment, and an expression has none. A column whose provenance names only a set operation's leftmost arm (own_provenance) gets no comment. Read through a view, a column takes the view's own column comment, or, where the view's column has none, the comment of the column the view's definition reads. A parameter written to a column (an insert's value,set age = :age) carries that column's comment. A parameter compared with a column does not, because the Postgres engine doesn't track which column a comparison reads.information_schema.columnsquery for parameter types (TYPES_QUERY) now also readscolumn_comment, and is asked in the prepare's round for the tables a parameter is written to or compared with, plus the tables of a plain SELECT's FROM. A result column takes the comment of itsorg_table/org_nameonly when the SELECT reads no WITH query or derived table. Through those, MySQL names the base table beside the derived column's own name (select doc from (select other as doc from o) sreportso.doc), which can be another column of that table. An empty comment counts as none. A parameter written to or compared with a column carries that column's comment.src/module-types.ts): prints the comments onRowandParamsfields, writing a multi-line comment as a block throughsrc/doc-comment.ts, which also escapes*/as*\/.src/analyze.ts): covers column comments on both databases, so an edited comment re-types the import instead of the.reylo/entry being kept.Verified
tests/comments.test.tsagainst throwaway Postgres 18 and MySQL 8.4, through the content mapper's JSON-RPC process: the exactRowandParamstext, multi-line comments, the*/escape, a view, a derived table, and a changed comment re-typing the import from a new process. Run without the fingerprint change, this test fails on the stale.reylo/entry. A language-server hover test checks that the comment shows over a field of the query's row.expected.txtchanged: the oracle prints its own form of the analysis.