Skip to main content

DEC-AIC-0062: Establish Angular frontend architecture standards, UI component types, and Nx guardrails for vault-view

Draft

Status: draft · 2026-11-30

Context​

DEC-AIC-0059 migrated the vault view frontend into an Angular layered application (apps/vault-view and libs/vault-view/{data-access,ui,feat-climb,feat-graph,feat-plans,util}) with frontend-owned DTOs and Nx module-boundary tags (scope:vault-view, architecture:layered, type:app|feat|ui|data-access|util).

Before refactoring the individual frontend layers, two gaps remained (observed: repository @ 2026-11-30): only libs/vault-view/util had a Vitest test target, none of the seven vault-view projects had a typecheck target or Angular-specific ESLint rules (angular-eslint), and several components used inline styles: blocks, omitted ChangeDetectionStrategy.OnPush, or mixed browser globals into stores.

Decision​

  1. Enforce strict layer responsibilities across scope:vault-view:
    • data-access (libs/vault-view/data-access): Pure HTTP API services and focused signal stores/facades. No raw globalThis.location or document access inside stores (inject Angular Router / DOCUMENT or pass values through explicit inputs), and no god-stores.
    • ui (libs/vault-view/ui): Pure presentational components driven exclusively by input() and output(), with ChangeDetectionStrategy.OnPush and zero data-access imports or injection (type:ui may depend only on type:ui and type:util). UI components fall into three explicit types:
      • Primitives (atoms): low-level design-system building blocks (for example, StatusPill, GlassCard, buttons, inputs, badges).
      • Composite / wrapper UI components: presentational components that wrap and compose other ui components (for example, headers, filter bars, toolbars, detail panels, section cards, empty states) while remaining purely input()/output()-driven with no data-access injected.
      • Layout / shell UI components: structural presentational frames composing ui components and <ng-content> slots, with no data-access injected.
    • feat-* (libs/vault-view/feat-climb, feat-graph, feat-plans): Thin smart containers that bind data-access facades to ui components and coordinate feature interactions.
    • util (libs/vault-view/util): Pure, framework-free TypeScript helpers.
  2. Enforce component and file standards:
    • Explicit ChangeDetectionStrategy.OnPush on every component (zoneless-ready).
    • Explicit public / private (or protected) access modifiers on every class member.
    • No inline styles at all: @Component({ styles }) and static style="..." attributes in templates are forbidden; every component's styles live in a separate .css file referenced via styleUrl.
    • External .html templates whenever an inline template exceeds ~40 lines; soft cap of ~250 LOC per file.
    • Lazy-loaded feature routes in apps/vault-view/src/app/app.routes.ts.
    • No comments in source code (DEC-AIC-0011).
  3. Wire automated guardrails across apps/vault-view and all six libs/vault-view/* libraries:
    • Angular ESLint (angular-eslint): Configured in eslint.config.mjs for apps/vault-view and libs/vault-view/* with hard 'error' rules for vault component/directive selectors, @typescript-eslint/explicit-member-accessibility, no-restricted-syntax banning @Component({ styles }), and @angular-eslint/template/no-inline-styles (with allowBindToStyle: true). Pre-existing OnPush and template accessibility violations start at 'warn' and promote to 'error' as each layer is refactored.
    • Nx typecheck targets: ngc --noEmit -p tsconfig.json on apps/vault-view and all Angular libs/vault-view/* libraries (tsc --noEmit on libs/vault-view/util).
    • Nx test targets: Vitest (vitest.config.mts with watch: false and passWithNoTests: true) across apps/vault-view and all six libs/vault-view/* libraries.

Consequences​

  • Contributors and AI agents have one authoritative specification for how vault-view layers, UI component types (primitives, composite wrappers, and layout shells), styles, templates, and tests are structured.
  • Every vault-view project now exposes lint, typecheck, and test through Nx, catching template errors, strict typing regressions, and boundary violations in CI.
  • Existing inline styles, missing OnPush, and template accessibility warnings are surfaced immediately by nx lint and will be eliminated and promoted to errors during the subsequent layer-refactoring PRs.

Alternatives Considered​