PR Summary

What problems was I solving

ARC-2161 requires establishing a secure custom component substrate with trust boundaries, dedicated service ownership, parser-backed validation, and per-instance iframe runtime isolation. The PR moves custom component ownership from assets-service to a new dedicated service, adds feature-gated admin APIs, establishes the publish lifecycle in a separate database, and enforces strict CSP in frontend renderers.

What user-facing changes did I ship

Custom components are now only renderable via tenant-enabled admin interface and feature-flagged admin routes. Admin API endpoints exist for CRUD, validation, and publish, but components will not be created/tested until feature flag is enabled for specific tenants. Page UI components render in per-instance iframes with restricted CSP and injected host environment APIs.

How I implemented it

New custom-component-service owns tenant-scoped component records and version lifecycle. assets-service only stores published runtime asset projection with component refs (not authoring data). Admin gateway routes are feature-flag gated before delegating to custom-component-service. Custom components render in iframes with limited CSP and inlined self-hosted React runtime. Parser-backed validation with acorn blocks imports, exports, and dangerous globals before publish.

Description for the changelog

Introduces new custom-component-service for component lifecycle management, adds feature-gated admin API for tenant-scoped component creation and publishing, establishes trust boundary by requiring component refs in runtime assets rather than raw code, implements per-instance iframe sandbox with strict CSP for custom component rendering, adds parser-backed source analysis using acorn to block security escape hatches during validation.

Custom Component Service - New Database Schema

critical7 files
New `custom_component_service` schema with typeid domains and three tables for tenant-scoped component records, version lifecycle states, and published asset references.

Assets Service - Component Reference API/Schemas

high2 files
Updates `CustomComponentDataSchema` and `CreateCustomComponentAssetInputSchema` to require paired `componentId` and `versionId` refs, and adds explicit `createCustomComponentRuntimeAsset` API for publish-only runtime asset creation.

Assets Service - Component Reference Migrations

high2 files
Adds `custom_component_id` and `custom_component_version_id` typeid columns with constraints to `assets_service.assets` to store published runtime asset references to validated custom component versions.

Admin Gateway - Custom Component Secure Admin Routes

high11 files
New admin gateway routes for CRUD, validation, and publish of custom components, all gated behind `custom-components-enabled` feature flag before delegating to `custom-component-service`.

Page UI - Custom Component Iframe Sandbox

high3 files
Custom components render in per-instance iframes with limited CSP (`allow-scripts` only) and an inlined self-hosted React runtime, preventing window/document exposure while enabling theme-prop environment injection.

Assets Service - Component Reference Implementation

medium4 files
Boolean returns for component refs being paired, repository query projections, strict runtime asset creation rejection, and asset retrieval schema expansion to include refs from published version history.

Page Gateway - Custom Component Runtime Module Building

medium3 files
Updates runtime module code builder to inject `"use strict"` and host environment variables, adds parser-backed source validation, and links to component-service for props schema and runtime asset lookup.

Page Orchestrator - Custom Component Service Client

medium15 files
Switches from `assets-service` to `custom-component-service` for custom component queries, documentation, and validation, requiring repo/service client injection updates and test refactors.

Service Application - Service Registration

low4 files
Registers `custom-component-service` factory, adds custom component service migration path to project config, and wires dependency imports across workspace packages.

Service RPC Registry - Custom Component Service Name

low1 file
Adds `ServiceName.CustomComponent` enum entry alongside other service names for RPC client interface.

Web Service - Custom Components Feature Flag

low1 file
Adds tenant-scoped boolean feature flag `custom-components-enabled` (default false) to feature flag registry for planning rollout to tenants.

Database Core - Custom Component Schema Enum

low1 file
Adds `CustomComponentService = "custom_component_service"` enum entry to DatabaseSchema.

Workspace Dependencies - Acorn Parser

low2 files
Adds `acorn: 8.16.0` to workspace dependencies for parser-backed source analysis of custom component JavaScript.

Sample Provisioner - Custom Component Seeding

low4 files
Adds `custom-component-service-api` to sample provisioner dependencies, creates seed data builder that validates component source before seeding, and refactors component creation to use validation flow with proper feature flag gating.

OpenAPI - External Actor Gateway Component Schema

low1 file
Updates `BodyPropsSchemaTypeSchema` in external-actor-gateway-service OpenAPI to include `body`, `componentId`, `versionId`, `propsSchema` and reference renamed to `BodyComponentIdPropsSchemaTypeVersionIdSchema`.

Custom Component Service - Code Export Mappings

low1 file
Adds `@architect/custom-component-service-*` code module alias mappings to tsconfig.base.json for improved module resolution in frontend and workspace apps.

Admin Gateway - Dependencies

low2 files
Adds `@architect/custom-component-service-api` to admin gateway dependencies and updates OpenAPI schema to reflect new component id/version fields in component assets.

Assets Service - TypeScript Types Generation

low2 files
Sapatos-generated TypeScript types for assets-service schema after adding custom component refs columns, regenerates on migration run.

Custom Component Service - API Package and Test Configs

low12 files
Complete setup for custom-component-service-api package including schema validation, source analysis, test suite, and Nx/ESLint configurations.

Custom Component Service - Implementation Package Configs

low10 files
Implementation package for custom-component-service orchestration including publish lifecycle, validation summary management, and assets-service integration.

Custom Component Service - migrations Package Configs

low8 files
Migrations package defining SQL schema for custom component service with typeid domains, component tables, constraints, and tests including Sapatos type generation verification.

Custom Component Service - repositories Package Configs

low10 files
Assets-service-compatible repository for custom component CRUD and publish orchestration, using Sapatos and handling tenant-scoped version lifecycle and published version retrieval.

Custom Component Service - TypeScript Type Definitions

low7 files
Sapatos-generated TypeScript type definitions for custom-component-service schema including component tables, version lifecycle metadata, typeid domains, and TypeScript access patterns.

Page Gateway Dependencies

low1 file
Adds `@architect/custom-component-service-api` to page-gateway-service dependencies for fetching component contracts and runtime module serving.

Web Service Dependencies

low1 file
Adds `@architect/custom-component-service-api` to web-service dependencies for domain API integration across routing subsystems.

Web Service - Assets Router Simplification

low2 files
Removes direct custom component asset creation rejection from assets router, assuming new admin routes will handle component lifecycle exclusively.

Custom Component Service - TypeScript Type Definitions

low1 file
Sapatos-generated TypeScript type definitions for custom-component-service schema including component tables, version lifecycle metadata, typeid domains, and TypeScript access patterns.

Custom Component Service - TypeScript Type Definitions and Test Setup

low
Sapatos-generated TypeScript type definitions for custom-component-service schema and test container configuration.

Assets Service Dependencies

low1 file
Adds `@architect/custom-component-service-api` dependency to assets-service API for component ref integration.