Repository navigation
fix(i18n): reject a meaning or description that would close its JSDoc comment, and escape @ in it - #650
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
… comment, and escape `@` in it
0c019bf to
a88a106
Compare
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…s printed Angular's `tagToString` throws when it prints the JSDoc, so `ngc` compiles a template whose `*/` meta has no message: an empty or comment-only `i18n` element, `<ng-content i18n>`, an `i18n-title` that a later one replaces, an `i18n-alt` with no value, and partial compilation. The check now runs where the message's JSDoc is built and goes out as an error from full, template, HMR and linker compilation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Summary
An i18n meaning or description is written into the JSDoc comment above the Closure
goog.getMsgmessage, as raw text. A*/in it ends the comment early, and whatever follows becomes code in the emitted module:The
}closes thengI18nClosureModebranch andif (0) {takes over the rest, sosteal()runs every time the consts are built, not only in Closure mode, and the message still works. Other text after*/or/*breaks the output instead.ngtsc never emits this:
tagToStringinoutput_ast.tsthrowsJSDoc text cannot contain "/*" and "*/"for such a text, and escapes@as\@so the text cannot start a JSDoc tag of its own.This PR does both:
i18nori18n-*meaning or description with/*or*/is reported as a template error with Angular's message, so the component is not compiled. The check runs where the attribute is parsed (html_to_r3.rs), because errors that pipeline phases push tojob.diagnosticsdon't reachtransform_angular_file's diagnostics today.@in a meaning or description is emitted as\@(/** @desc mail a\@b.c */).Test plan
test_i18n_meta_that_would_close_its_jsdoc_comment_is_an_error:*/in a description, in ani18n-altmeaning, and/*in a meaning are reported with that error and emit no JSDoc comment.test_i18n_meta_at_sign_is_escaped_in_jsdoc:@in both texts is escaped.cargo test --all-features,cargo fmt --all -- --check, andcargo run -p oxc_angular_conformance(1264/1264, snapshot unchanged).Separately:
compile_component_fullcollectsjob.diagnosticsand drops them, so errors such asUnsupported expression in two-way action binding([(x)]="a + b", which ngtsc rejects) are not reported either. Returning them ascompile_template_for_hmralready does also surfaces a falseAssertionError: unable to find a dependency function for this deferred blockfor@defer (on viewport(missing)), which ngtsc accepts, and fails 18 existing defer tests. So that is left out of this PR.