Files
tech-log-frontend/docs/operations/release-cache-rollback.md
T
DongHyeonka c80320dfc7 chore: sync the frontend template from ebea300 to af3d8e6
Carries 359 template commits, tag v0.2.0 plus one documentation commit: the
generator-built feature index with its app, bounded-context and feature
declarations, the src/platform kernel and scale tooling, the 2026-09-24 src
review fixes, and the 2026-09-25 maturity review round with its CHANGELOG
[보안]/[계약] rows. 691 of the 824 template paths are applied, 85 of them
merged with product changes; 127 are not carried.

Product identity is unchanged: name, version 0.1.0, routes, design and the
TechLog domain.

Three decisions worth naming. TechLog stays composed directly, as the last
two syncs recorded; its directory carries a NOT_INSTALLED marker that says so,
and every installed-* composer takes the template's projection with TechLog
added on top. The reference sample is no longer installed: the template now
installs a feature only through feature-module.ts and context-routes.ts,
which load the screens this product deleted, so its three operations, six
schemas and one topic leave the registries, recorded as registry change
evidence. And AppRouter mounts the platform and TechLog routes only; the
template's bounded-context route gateway waits for a generator-installed
feature.

Required fixes: readSubject on the BFF session owner (without it every HTTP
Studio session would close as integration-failed), zod through the facade in
nine TechLog files, noUnusedLocals, and public/config.json written out to
match the local profile. Derived baselines were recomputed after reproducing
both sides' values: CI contract 101 commands / 106 references / 141
artifacts, gate shape c9adcf85; registry approval 2dc6c3a3; the runtime
config schema baseline equals the schema at 8210d48.

Verified here: types, lint, architecture, adapter inventory, CI contract,
i18n, design system, diagnostics, browser security, dev release manifest,
TechLog contract and build pass; 220 component, 155 integration, 15
contract, 418 TechLog, 43 reference-feature, 18 recipe and 46
release-coherence tests pass, and 2381 of 2383 unit tests. Reproduced at
8210d48 first and unchanged: check:registries (byte-identical),
test:runtime-schema, verify:documentation. Brought by the template and
escalated rather than suppressed: check:request-fanout on TechLog's cursor
pagination, check:remediation-ledger (fails upstream too), the shared-chunk
hash test, and the registry-dependent sample removal and second-feature
tests. Playwright suites were not run.

Full record, the five open questions and the follow-ups in
docs/operations/template-sync-2026-09-29.md.

(cherry picked from commit b2170cf265dea45dc9cc05d3c61e627e97f31cdb)
2026-11-12 08:28:54 +09:00

6.1 KiB

Release, cache, and rollback contract

Each deployment is an immutable releases/<releaseId>/ artifact set. The provider adapter must upload assets, release manifest, runtime config, and verify asset reachability before atomically switching the active HTML pointer. The post-switch boot, route, API, telemetry, and reload-loop smoke checks close the deployment.

Rollback selects a prior release tuple, confirms its assets and runtime/API compatibility, atomically switches the complete set, performs the provider cache action, and repeats the smoke checks. Rebuilding an old commit, replacing HTML alone, or declaring recovery from cache-purge completion is prohibited. Recovery is established by old/new reachability probes.

Before deploying a promoted release later, or rolling back to one, re-verify its promoted bundle (the five files uploaded by the promotion job) with the archived mode (review 13-04). Provider evidence expires two hours after issue, so the normal mode refuses any release promoted before that. The archived mode still checks signatures, digests and the exact five members, and judges freshness at the release's recorded promotion time (promotion-verification.json verifiedAt, which may not lie in the future). New promotion never uses it (scripts/lib/exact-promotion-bundle.ts).

VULNERABILITY_PUBLIC_KEY_PATH=... VULNERABILITY_KEY_ID=... \
PROVENANCE_PUBLIC_KEY_PATH=... PROVENANCE_KEY_ID=... \
EXPECTED_PROMOTION_RUN_ID=<run id> EXPECTED_PROMOTION_RUN_ATTEMPT=<attempt> \
EXPECTED_PROMOTION_SOURCE_REVISION=<commit> \
EXPECTED_PROMOTION_ARCHIVE_SHA256=<archive sha256> \
corepack pnpm verify:promotion -- --root <promoted bundle directory> --archived

mkdir <release dir> && tar -xzf <promoted bundle directory>/release-candidate.tar.gz -C <release dir>
corepack pnpm drill:runbook -- FE-RB-005 --release-root <release dir>

The expected values come from the release record, not from the bundle. The drill then checks that release's build/config/manifest tuple and its assets, not the local build. It ends UNVERIFIED until the provider switch and smoke are recorded, because those happen outside this repository.

The provider-independent cache defaults are:

  • hashed assets: public, max-age=31536000, immutable
  • HTML: no-cache
  • runtime config and release manifest: no-store
  • public source maps: disabled
  • service worker/offline cache: disabled, unless the static selection in src/features/installed-runtime-capabilities.ts is ACTIVE or REMOVE_REGISTRATION; then dist holds exactly the selected service-worker.js, served no-cache so the browser's update check sees each release's worker

HTML, JSON config/manifest, and hashed JavaScript MIME types are also compared to the declared allowlist; a cache-correct response with a mismatched Content-Type still fails the hosting gate.

corepack pnpm verify:hosting-headers compares the declared headers with a deterministic fixture when HOSTING_BASE_URL is unset. That only shows the declarations agree with each other, so its result is UNVERIFIED (exit 3), not PASS (review 13-05, scripts/lib/hosting-probe.ts hostingVerdict). Only mode: "live" can pass. The live target must be its canonical, non-loopback HTTPS root URL. Each required surface must return HTTP 200 without leaving that origin before its cache, content-type, and security headers can count as deployment evidence. The hashed asset it requests is the entry script named by the served index.html, so it checks the release that is actually deployed.

FE-GATE-019 is therefore a production-stage gate (production_gate job, PROD_PROMOTION_READY). It runs after promotion and after the project has deployed the promoted release. This repository's workflow stops at promotion: uploading the release, switching the active pointer, and the post-switch smoke are the project's provider adapter, chosen with the hosting provider.

Keep a retired release's hashed assets reachable while any open tab may still request them. The minimum is the previous release while the next one is active (the rolling window modeled in tests/release/release-fixture.ts). Size it to the longest session the product supports; a tab older than that depends on the reload-once recovery (FE-RB-002).

Service Worker steps (only when the static selection is not null)

The worker is part of the release tuple: service-worker.js comes from the same build as the HTML and assets it caches.

  1. Rollback N+1 → N. Switching the tuple serves N's service-worker.js. The browser's update check installs it; the worker never calls skipWaiting() on install (src/adapters/service-worker/service-worker-entry.ts), so it waits until every tab of the scope closes or a page calls requestActivation(). The template has no page that calls it. The cache name is the asset-set digest, so if N's cache is still there as the retained previous cache, the install reuses it and never deletes it on failure (service-worker-static-assets.ts installStaticAssets). Tabs still on N+1 keep worker N+1, so N+1's assets stay reachable for the rolling window above.
  2. Turn the worker off without a rebuild. Set CAPABILITY_OVERRIDES.SERVICE_WORKER: "DISABLED" in the runtime config. The next boot unregisters the owned registration and registers nothing; owned caches stay (src/contracts/runtime-capabilities.ts resolveRuntimeCapabilities, service-worker-page-controller.ts start()). This needs a page that boots.
  3. A worker stops the page from booting. Deploy a release whose static selection is REMOVE_REGISTRATION. It ships a self-unregistering service-worker.js (scripts/build-frontend.ts, scripts/lib/self-unregistering-service-worker.ts): the update check installs it over the broken worker, it skips waiting, unregisters on activation and answers no fetch. The next load is uncontrolled (tests/e2e/service-worker-recovery.spec.ts). Runbook: docs/operations/browser-file-storage-recovery.md §8.
  4. Removing the worker takes three releases: REMOVE_REGISTRATION → PURGE_OWNED_RESOURCES (deletes owned caches) → null (src/contracts/service-worker.ts InstalledServiceWorkerSelection).