# Enterprise Codebase Normalization 2.1.0

## Architecture

Core 2.1.0 introduces a cross-cutting normalization layer:

- `enterprise_codebase_normalization.php` — runtime governance, scanning, legacy-route registry and settings;
- `enterprise_action_router.php` — canonical action resolver with compatibility aliases;
- `enterprise_bundle_210.css` — consolidated legacy CSS in preserved cascade order;
- `enterprise_shell_210.css` — final responsive Shell overrides;
- `enterprise_runtime_210.js` — navigation state and responsive table behavior;
- `db.php` — request-scoped metadata cache and query metrics;
- `enterprise_role_workspace.php` — role workspaces and registered-route enforcement;
- official PL/EN locale files and database UI string registry.

## Database source of truth

The release creates:

- `enterprise_codebase_normalization_runs`;
- `enterprise_codebase_normalization_findings`;
- `enterprise_legacy_route_registry`;
- `enterprise_ui_string_registry`.

Historical upgrade pages remain on disk for audit and compatibility, but they are hidden from normal navigation and blocked by the current-release guard. Migration Ledger remains the authoritative record of applied migrations.

## UI normalization

The build-time sweep covers active PHP UI strings using PHP tokenization. It excludes comments and historical upgrade pages, so internal compatibility constants and migration history are not falsely classified as current UI.

The runtime output guard additionally normalizes stale operational labels that may remain inside legacy screens loaded through compatibility routes.

## Performance model

Clinical rows are not cached across requests. The new cache is request-scoped and limited to schema metadata, keyed `app_settings` reads and keyed feature-flag reads. Query count, total execution time, slow-query fingerprints and repeated fingerprints are logged when configured thresholds are exceeded.

## Error handling

Uncaught request errors receive an `X-Baltique-Request-ID`, are written as structured JSON lines, and render a controlled dark-theme error page. Administrators see the underlying message; other users receive the incident identifier without sensitive stack data.

## Remaining production work

A static normalization release cannot replace browser-based UAT, live database query profiling, accessibility testing with assistive technologies, clinical governance approval or a restore drill. Those remain required before real clinical use.
