fix(pg-codegen): escape JSDoc terminators in emitted column comments - #1858
Conversation
A column comment containing */ (e.g. a cron example "*/5 * * * *") closed the /** */ block early and left the rest of the comment as bare source, producing an unparseable module.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review complete. 🟡 1 medium 📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Escape // postgres/pg-codegen/src/emit/record.ts
83 if (comment) t.addComment(prop, 'leading', `* ${comment} `, false);This PR adds A column comment containing Fixes
Reviewed commit: 0d5c551 |
Summary
withJsDocwrote Postgres column/table comments verbatim into/** … */blocks. A comment containing*/— found in the wild with a cron example,{"rule": "*/5 * * * *"}oncompute_public.function_schedules.schedule_info— terminated the block early and left the remainder as bare tokens, so the generatedplatform-db-typesmodule failed to parse (SyntaxError: Unexpected token '*', constructive-db #3850 CI).Emits
*\/, which JSDoc tooling renders as*/and JS parsers ignore. Unit test added in__tests__/babel.test.ts(no DB needed).constructive-db side-steps the current instance by rewording the comment in #3850; this makes the generator robust for any future comment.
Link to Devin session: https://app.devin.ai/sessions/3c993d055ffb47f6be27862718a9cd42
Open in Devin Desktop: https://app.devin.ai/desktop/session/3c993d055ffb47f6be27862718a9cd42?variant=devin
Requested by: @pyramation