Skip to content

fix(compiler): match Angular 22.2.2 emit for img/video src sanitizers and namespaced block tags - #577

Open
Brooooooklyn wants to merge 3 commits into
mainfrom
fix/angular-22-2-2-emit-compat
Open

Brooooooklyn wants to merge 3 commits into
mainfrom
fix/angular-22-2-2-emit-compat

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Summary

Matches Angular 22.2.2's emit so the fixture-compare gate passes on both 22.2.1 and 22.2.2 (unblocks #575). Both behaviors are gated on angularVersion >= 22.2.2; angularVersion unset keeps the newest behavior, matching the existing "assume latest" convention.

Upstream changes ported

Angular commit Change oxc equivalent
439ff1bdf4 (refactor: remove img/video src from URL security context) img|src and video|src leave SecurityContext::Url → no ɵɵsanitizeUrl on img[src]/video[src] new SchemaKind::V22_2_2 in dom_security_schema.rs; V22 (22.0.0–22.2.1) keeps the keys, and so do the 21.x/20.x/19.x backports
0244a1cb3 (fix: match namespaced root nodes of control flow blocks against ng-content tag selectors, fixes angular#71162) splitNsName applied to the single-root tag copied onto ɵɵconditionalCreate/ɵɵconditionalBranchCreate/ɵɵrepeaterCreate — :svg:svg → svg ingest_control_flow_insertion_point in pipeline/ingest.rs strips the namespace at ≥22.2.2

Both fixes also ship in 22.3.0-next.1 and were never backported to 21.x/20.x/19.x, so a single >= 22.2.2 predicate covers all released lines (AngularVersion::is_at_least / strips_namespaced_block_tag / drops_img_video_src_url_context).

Failing fixtures this fixes (PR #575 CI)

  • bindings/attr-interpolation, regressions/sanitizer-src-interpolation, regressions/sanitizer-srcset, templates/case-html-void-elements — ɵɵsanitizeUrl no longer emitted on img|src
  • regressions/clickup-exact-{minimal,svg-in-if,svg-in-if-else,theme-switcher}, clickup-theme-switcher-pattern, svg-in-conditional-branch, svg-in-if-else, svg-nested-in-for — :svg:svg → svg block tags

Test plan

  • cargo test -p oxc_angular_compiler — all green (~3205 tests, 0 failed)
  • pnpm test (napi) — 441/441
  • pnpm --filter @oxc-angular/compare compare --fixtures — 0 mismatched at Angular 22.2.1 (unchanged from main) and 0 mismatched after resolving @angular/compiler@22.2.2 via temporary workspace overrides (same setup as PR chore(deps): update npm packages #575's CI)
  • New unit tests cover 22.2.1 (old), 22.2.2/22.3/23 (new), and None (new) for both gates

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T16:18:27.715451Z 2f6db14 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ef3f4742e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread crates/oxc_angular_compiler/src/component/metadata.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a73c4c9e97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +233 to +234
pub fn drops_img_video_src_url_context(&self) -> bool {
self.is_at_least(22, 2, 2) && !self.is_22_3_0_next_0()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor unknown prereleases at the feature cutoff

When a caller supplies an unrecognized prerelease such as 22.3.0-beta.2 or a custom snapshot tag, parsing stores Prerelease::Other, which the new API documentation explicitly defines as earlier than next/rc, but this predicate excludes only Next(0). Such builds therefore incorrectly take the 22.3.0-next.1+ path, dropping the img/video sanitizer; the companion predicate similarly strips namespaced block tags. Compare the stored prerelease against the next.1 cutoff rather than special-casing only next.0.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 2f6db14. The Next(0) special case is gone — 22.3.0 prereleases now compare against the next.1 cutoff directly: Prerelease orders Other < Next(n) < Rc(n), so beta/snapshot/any unknown tag (parses to Other) keeps the old behavior, next.0 keeps the old behavior, and next.1+/rc.0+/22.3.0 stable take the new path. Tests cover beta.2 and snapshot.9 on the old side alongside next.0.

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