Merge branch 'main' into feature/techlog-ui-migration
Integrates the frontend template sync (a0fbafb → 5434760) into the TechLog UI migration. Merged in this direction so every conflict is resolved and proved in the worktree; main is only fast-forwarded afterwards and never holds a state that was not verified here. 15 conflicts. The rule throughout: keep the template's mechanism, keep the product's content, and never invent a third state neither branch would accept. The template's product manifest and its runtime feature kill switch are adopted. The route registry is deliberately not composed from contract.routes: the reference feature still declares screens this product deleted, and reducing over them would register paths with no component behind them. ROUTE_FEATURE_OWNER is narrowed to registered routes for the same reason. The first resolution did compose from contract.routes and was rejected by product-features.test.ts. Three files pinned counts and a digest describing the gate contract. Neither side's numbers describe the merged config/ci/gates.json, so they were recomputed from it rather than chosen: 27 gates, 82 commands, 94 command references, 107 evidence references, 128 artifacts, shape sha256 5063586d. README.md and docs/accessibility/manual-checklist.md now enumerate this product's 27 routes, which the template's own verify:documentation requires. product-feature-switch.test.tsx was rewritten around the invariant that still applies here — no registered route without a component — rather than deleted with the screens it used to exercise. docs/operations/template-merge-2026-08-17.md records every decision, the gate results, and the three follow-ups this merge deliberately did not decide. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,8 @@ import {
|
||||
type InstalledContractPackageIdentity,
|
||||
} from "../contracts/external-contract-runtime.ts";
|
||||
import { REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION } from "./reference-feature/contracts/reference-feature-contract-contribution.ts";
|
||||
import { REFERENCE_FEATURE_ID } from "./reference-feature/contracts/reference-feature-contract.ts";
|
||||
import { INSTALLED_PRODUCT_FEATURE_IDS } from "./installed-product-manifest.ts";
|
||||
|
||||
/**
|
||||
* §4.8. Static contract selection SSOT.
|
||||
@@ -13,7 +15,11 @@ import { REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION } from "./reference-feature/con
|
||||
* `src/features/<feature>/contracts/<service>-contract-contribution.ts`.
|
||||
*/
|
||||
export const INSTALLED_CONTRACT_CONTRIBUTIONS: readonly InstalledContractContribution[] =
|
||||
Object.freeze([REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION]);
|
||||
Object.freeze(
|
||||
INSTALLED_PRODUCT_FEATURE_IDS.includes(REFERENCE_FEATURE_ID)
|
||||
? [REFERENCE_FEATURE_TEMPLATE_CONTRIBUTION]
|
||||
: [],
|
||||
);
|
||||
|
||||
export const COMPOSED_CONTRACT_CONTRIBUTIONS = composeContractContributions(
|
||||
INSTALLED_CONTRACT_CONTRIBUTIONS,
|
||||
|
||||
@@ -3,21 +3,34 @@ import { createReferenceFeatureInstalledInput } from "./reference-feature/adapte
|
||||
import { REFERENCE_FEATURE_ID } from "./reference-feature/contracts/reference-feature-contract.ts";
|
||||
import { createTechLogFeatureInstalledInput } from "./tech-log/adapters/create-tech-log-feature-input.ts";
|
||||
import { TECH_LOG_FEATURE_ID } from "./tech-log/application/tech-log-feature-input.ts";
|
||||
import { INSTALLED_PRODUCT_FEATURE_IDS } from "./installed-product-manifest.ts";
|
||||
|
||||
/**
|
||||
* §3.5. Partial on purpose: a feature the manifest did not select supplies no
|
||||
* driving input, so consumers have to narrow before calling one. A total type
|
||||
* here would let feature code compile against an input that is not there.
|
||||
*/
|
||||
type InstalledFeatureInputs = Readonly<
|
||||
Pick<
|
||||
ApplicationFeatureInputs,
|
||||
typeof REFERENCE_FEATURE_ID | typeof TECH_LOG_FEATURE_ID
|
||||
>
|
||||
// Template merge. The reference feature is optional — the manifest may
|
||||
// narrow it out — so its input stays `Partial`. TechLog is this product's
|
||||
// own UI and is always installed, so its input is total.
|
||||
Partial<Pick<ApplicationFeatureInputs, typeof REFERENCE_FEATURE_ID>> &
|
||||
Pick<ApplicationFeatureInputs, typeof TECH_LOG_FEATURE_ID>
|
||||
>;
|
||||
|
||||
export function createInstalledFeatureInputs(
|
||||
context: Parameters<typeof createReferenceFeatureInstalledInput>[0],
|
||||
): InstalledFeatureInputs {
|
||||
const referenceFeature = createReferenceFeatureInstalledInput(context);
|
||||
const techLogFeature = createTechLogFeatureInstalledInput();
|
||||
if (!INSTALLED_PRODUCT_FEATURE_IDS.includes(REFERENCE_FEATURE_ID)) {
|
||||
// A build that narrowed the reference feature out still ships TechLog.
|
||||
return Object.freeze({
|
||||
[techLogFeature.featureId]: techLogFeature.input,
|
||||
}) as InstalledFeatureInputs;
|
||||
}
|
||||
const referenceFeature = createReferenceFeatureInstalledInput(context);
|
||||
return Object.freeze({
|
||||
[referenceFeature.featureId]: referenceFeature.input,
|
||||
[techLogFeature.featureId]: techLogFeature.input,
|
||||
});
|
||||
}) as InstalledFeatureInputs;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import type { RouteRuntimeDefinition } from "../contracts/route-runtime-contract.ts";
|
||||
import type { RouteDefinition } from "../contracts/routes.ts";
|
||||
import {
|
||||
PLATFORM_ROUTE_RUNTIME_CONTRACT,
|
||||
type RouteRuntimeDefinition,
|
||||
} from "../contracts/route-runtime-contract.ts";
|
||||
import {
|
||||
PLATFORM_ROUTE_REGISTRY,
|
||||
type RouteDefinition,
|
||||
} from "../contracts/routes.ts";
|
||||
import {
|
||||
composeSchemaRegistry,
|
||||
PLATFORM_SCHEMA_REGISTRY,
|
||||
} from "../contracts/schema-registry.ts";
|
||||
import { REFERENCE_FEATURE_CONTRACT } from "./reference-feature/contracts/reference-feature-contract.ts";
|
||||
import {
|
||||
INSTALLED_PRODUCT_FEATURES,
|
||||
} from "./installed-product-manifest.ts";
|
||||
import {
|
||||
composeApiOperations,
|
||||
validateApiRuntimeBindings,
|
||||
@@ -18,14 +26,36 @@ import {
|
||||
TECH_LOG_ROUTE_SCHEMA_REGISTRY,
|
||||
} from "./tech-log/contracts/tech-log-route-contract.ts";
|
||||
|
||||
export const INSTALLED_FEATURE_CONTRACTS = Object.freeze([
|
||||
REFERENCE_FEATURE_CONTRACT,
|
||||
]);
|
||||
/**
|
||||
* §3.5. Composed from the product manifest rather than from a literal list, so
|
||||
* a feature the build did not select contributes no routes, no operations, no
|
||||
* schemas and no messages — and is therefore not reachable from any registry.
|
||||
*/
|
||||
export const INSTALLED_FEATURE_CONTRACTS = INSTALLED_PRODUCT_FEATURES;
|
||||
|
||||
/**
|
||||
* Template merge. Two intents meet here and both are kept.
|
||||
*
|
||||
* The template's manifest is retained above, so narrowing the selection still
|
||||
* withdraws a feature's operations, schemas, mappers and invalidation edges.
|
||||
*
|
||||
* The route registry is *not* composed from `contract.routes`, though. The
|
||||
* reference feature still declares `REFERENCE_RESOURCE_*` routes, but this
|
||||
* product deleted their screens during the UI migration, so reducing over those
|
||||
* routes would register paths with no component behind them — a deep link that
|
||||
* resolves to nothing. The registry therefore lists the platform routes (empty
|
||||
* on this branch) and TechLog's, which are the routes that actually exist.
|
||||
*
|
||||
* Re-adding the reference screens, or dropping the reference feature's route
|
||||
* declarations, is a product decision; a merge only has to avoid inventing a
|
||||
* third state where a route is registered and unmountable.
|
||||
*/
|
||||
export const ROUTE_REGISTRY = Object.freeze({
|
||||
...PLATFORM_ROUTE_REGISTRY,
|
||||
...TECH_LOG_ROUTE_REGISTRY,
|
||||
}) satisfies Readonly<Record<string, RouteDefinition>>;
|
||||
export const ROUTE_RUNTIME_CONTRACT = Object.freeze({
|
||||
...PLATFORM_ROUTE_RUNTIME_CONTRACT,
|
||||
...TECH_LOG_ROUTE_RUNTIME_CONTRACT,
|
||||
}) satisfies Readonly<Record<string, RouteRuntimeDefinition>>;
|
||||
export const API_OPERATIONS = composeApiOperations(
|
||||
@@ -73,6 +103,28 @@ export const API_RUNTIME_BINDINGS_VALID = validateApiRuntimeBindings(
|
||||
MAPPER_REGISTRY,
|
||||
);
|
||||
|
||||
/**
|
||||
* §3.5. Which feature owns each route.
|
||||
*
|
||||
* A route contributed by a feature disappears with it at build time, and has to
|
||||
* be withdrawn from navigation and from the router when the runtime document
|
||||
* disables that feature. Platform routes have no owner and are always present.
|
||||
*/
|
||||
export const ROUTE_FEATURE_OWNER: Readonly<Record<string, string>> =
|
||||
Object.freeze(
|
||||
Object.fromEntries(
|
||||
INSTALLED_FEATURE_CONTRACTS.flatMap((contract) =>
|
||||
Object.keys(contract.routes)
|
||||
// Template merge. Ownership describes routes this product actually
|
||||
// registered. The reference feature still declares screens this
|
||||
// product removed; attributing an unregistered route to a feature
|
||||
// would claim the kill switch governs something no router can mount.
|
||||
.filter((routeId) => routeId in ROUTE_REGISTRY)
|
||||
.map((routeId) => [routeId, contract.featureId] as const),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
export const NAVIGATION_ROUTES = Object.freeze(
|
||||
Object.values(ROUTE_REGISTRY)
|
||||
.filter(isNavigableRoute)
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
import { REFERENCE_MESSAGE_CATALOGS } from "./reference-feature/contracts/reference-message-catalog.ts";
|
||||
import { TECH_LOG_MESSAGE_CATALOGS } from "./tech-log/contracts/tech-log-message-catalog.ts";
|
||||
|
||||
/**
|
||||
* §3.5. Messages are deliberately *not* gated on the manifest. The catalog's
|
||||
* key type is what makes `message()` total, so dropping keys would turn every
|
||||
* lookup partial for the sake of a few unreachable strings.
|
||||
*
|
||||
* Template merge. TechLog's catalog is merged in on the same terms: it is this
|
||||
* product's own UI and is never narrowed out.
|
||||
*/
|
||||
const reference = REFERENCE_MESSAGE_CATALOGS;
|
||||
|
||||
export const INSTALLED_MESSAGE_CATALOGS = Object.freeze({
|
||||
"ko-KR": Object.freeze({
|
||||
...REFERENCE_MESSAGE_CATALOGS["ko-KR"],
|
||||
...reference["ko-KR"],
|
||||
...TECH_LOG_MESSAGE_CATALOGS["ko-KR"],
|
||||
}),
|
||||
"en-US": Object.freeze({
|
||||
...REFERENCE_MESSAGE_CATALOGS["en-US"],
|
||||
...reference["en-US"],
|
||||
...TECH_LOG_MESSAGE_CATALOGS["en-US"],
|
||||
}),
|
||||
} as const);
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
import { PLATFORM_ROUTE_CODECS } from "../presentation/routes/platform-route-codecs.ts";
|
||||
import { TECH_LOG_ROUTE_CODECS } from "./tech-log/presentation/tech-log-route-codecs.ts";
|
||||
import { TECH_LOG_ROUTE_RUNTIME } from "./tech-log/presentation/tech-log-route-runtime.tsx";
|
||||
import { PLATFORM_ROUTE_RUNTIME } from "../presentation/routes/route-runtime.tsx";
|
||||
|
||||
/**
|
||||
* §3.5. A feature the manifest did not select contributes no codec and no route
|
||||
* component, so the router has nothing to mount for it.
|
||||
*
|
||||
* Template merge. The template gated the reference feature's codecs and route
|
||||
* components on the manifest. This product deleted that feature's presentation
|
||||
* layer during the UI migration, so there is nothing left to gate — the import
|
||||
* would not resolve. The gating belongs back here the day those screens return.
|
||||
* TechLog is spread unconditionally: it is this product's own UI, not a
|
||||
* selectable feature. The platform entries are empty on this branch and are
|
||||
* kept in the spread so a later platform route lands here without another edit.
|
||||
*/
|
||||
export const ROUTE_CODECS = Object.freeze({
|
||||
...PLATFORM_ROUTE_CODECS,
|
||||
...TECH_LOG_ROUTE_CODECS,
|
||||
});
|
||||
|
||||
export const ROUTE_RUNTIME = Object.freeze({
|
||||
...PLATFORM_ROUTE_RUNTIME,
|
||||
...TECH_LOG_ROUTE_RUNTIME,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import {
|
||||
selectCompiledProductFeatures,
|
||||
type SelectableProductFeature,
|
||||
} from "../contracts/product-features.ts";
|
||||
import { REFERENCE_FEATURE_CONTRACT } from "./reference-feature/contracts/reference-feature-contract.ts";
|
||||
|
||||
/**
|
||||
* §3.5. The product manifest: the single declaration of which features this
|
||||
* build contains.
|
||||
*
|
||||
* Before this file the reference feature was spread directly into the route,
|
||||
* API, schema and message registries, so the only way to ship without it was to
|
||||
* edit five registries by hand and hope nothing still referred to it. The
|
||||
* removability gate proved that editing worked; nothing made it a decision you
|
||||
* could express.
|
||||
*
|
||||
* Adding an entry here is what installs a feature. `VITE_PRODUCT_FEATURES` may
|
||||
* then narrow the list at build time — a comma-separated subset, `none` for an
|
||||
* empty selection, absent meaning "all of them". A narrowed-out feature reaches
|
||||
* no registry, so it is not routed, not navigable and not callable.
|
||||
*
|
||||
* It is not deleted. The import above is static, and a value cannot undo a
|
||||
* static import; making the import itself conditional on configuration is the
|
||||
* thing §3.5 exists to prevent. FE-GATE-020 is what proves the feature can be
|
||||
* physically removed, by removing it and rebuilding the whole project.
|
||||
*/
|
||||
|
||||
const COMPILED_PRODUCT_FEATURES = Object.freeze([
|
||||
REFERENCE_FEATURE_CONTRACT,
|
||||
] as const);
|
||||
|
||||
/**
|
||||
* Every feature this source tree declares, selected or not. The platform
|
||||
* overview reports on this set so an operator can tell a feature that was built
|
||||
* out from one that never existed.
|
||||
*/
|
||||
export const COMPILED_PRODUCT_FEATURE_IDS: readonly string[] = Object.freeze(
|
||||
COMPILED_PRODUCT_FEATURES.map((feature) => feature.featureId),
|
||||
);
|
||||
|
||||
/**
|
||||
* `import.meta.env` exists in a Vite build and not under Node, and this module
|
||||
* is read by release scripts as well as by the app. A missing environment means
|
||||
* "nothing was narrowed", which is the same answer a plain developer build
|
||||
* gives.
|
||||
*/
|
||||
function declaredFeatureSelection(): string | undefined {
|
||||
const environment = (
|
||||
import.meta as unknown as {
|
||||
env?: Readonly<Record<string, string | undefined>>;
|
||||
}
|
||||
).env;
|
||||
return environment?.["VITE_PRODUCT_FEATURES"];
|
||||
}
|
||||
|
||||
export const INSTALLED_PRODUCT_FEATURES = selectCompiledProductFeatures(
|
||||
COMPILED_PRODUCT_FEATURES as readonly SelectableProductFeature[],
|
||||
declaredFeatureSelection(),
|
||||
) as readonly (typeof COMPILED_PRODUCT_FEATURES)[number][];
|
||||
|
||||
export const INSTALLED_PRODUCT_FEATURE_IDS: readonly string[] = Object.freeze(
|
||||
INSTALLED_PRODUCT_FEATURES.map((feature) => feature.featureId),
|
||||
);
|
||||
Reference in New Issue
Block a user