Documentation

Docs / Reference

ADR 0033 — Angular compilation scopes and template matching

Status: Accepted (developer review, 2026-10-27) Date: 2026-10-26

Context

T014c3 consumes ADR 0030 syntax and ADR 0031 declaration leaves to prove host-template references without changing cached syntax or historical edges. Revision 1 replaces the original unknown-block exclusion, which the cache could not implement, with conservative recovery and orphan-block rules.

Options considered

Decision

Reuse post-duplicate declaration edges and partitioned leaf counts. Recursive NgModule compilation/export scopes propagate open, unknown and invalid status; cycles poison scopes. Standalone scopes include self and imports; declared components use their single declaring module. Missing standalone/declaration proof gives none. deferredImports gives unknown.

Parse only T014c3 S1 compounds and comma lists. Unsupported selectors are diagnosed once per class and make nonmatches unknown. Match static raw names, then input and output names in Angular's overwrite order. Structural wrappers use only the first structural key; secondary microsyntax stays unknown. Validate each satisfying source span against recovery. Multiple matching components suppress their component edges while preserving directive edges.

Emit fact renders and uses_pipe edges at confidence 1 with template evidence; inline evidence uses mapped host coordinates. Count each matching usage/class pair before edge merging. Add partitioned element, structural and pipe counters, scope status and recovery count under angular.template_matching. Pipe matches in open scopes are shadowable and emit no edge. No external targets are added.

R1a classifies recovery wholly contained in a captured non-dropped attribute value or block parameter as expression recovery. Other recovery suppresses every usage starting at or after the earliest structural recovery. R1b uses cached block ancestry and source gaps containing only whitespace and complete HTML comments to identify orphan connected blocks; their contents are unknown. case/default require a switch parent. R1c diagnoses the earliest structural recovery or orphan block once per host, naming its line and cause.

C2 rejects dot-prefixed resource URLs other than ./ and ../ as unresolved instead of joining them as relative paths. Existing rooted, outside-repository and backslash guards retain precedence. Link's public signature is unchanged. No contract, store, schema, dependency, grammar or cache-version change occurs.

Consequences

Scopes and references relink on unchanged-source replay after imports, configuration or template changes. Historical declaration/injection facts stay intact. Shared backend tests register the matching fixture for SQLite locally and Postgres in CI. Corpus and timing evidence is in the T014c3 task record (internal).

Known gaps

Review notes (developer, 2026-10-27)

Report a problem with this pageSource: docs/adr/0033-angular-template-matching.md