You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.4 KiB

import { readdirSync, readFileSync, rmSync, statSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { gzipSync } from 'node:zlib';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { build } from 'vite';
const root = process.cwd();
const outDir = resolve(root, 'build/.bundle-smoke');
const virtualId = 'virtual:active-app-smoke';
const resolvedVirtualId = `\0${virtualId}`;
const maxGzipKb = Number(process.env.ACTIVE_BUNDLE_GZIP_LIMIT_KB ?? 70);
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
// Aliases mirror `svelte.config.js`. Specific subpaths must come before
// the parent alias — Vite's resolver matches by prefix.
const alias = {
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
'$active-app/services': resolve(root, 'src/arts/active-app/service-factories'),
'$active-app/presets': resolve(root, 'src/arts/active-app/presets'),
'$active-app': resolve(root, 'src/arts/active-app'),
$adom: resolve(root, 'src/arts/adom'),
$auth: resolve(root, 'src/arts/auth'),
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
$bus: resolve(root, 'src/arts/bus'),
$cache: resolve(root, 'src/arts/cache'),
$connection: resolve(root, 'src/arts/connection'),
$frontend: resolve(root, 'src/arts/frontend'),
$libs: resolve(root, 'src/libs'),
$locale: resolve(root, 'src/libs/locale'),
$reactive: resolve(root, 'src/libs/reactive'),
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
$format: resolve(root, 'src/arts/format'),
$http: resolve(root, 'src/arts/http'),
$lang: resolve(root, 'src/arts/lang'),
$logger: resolve(root, 'src/arts/logger'),
$orca: resolve(root, 'src/arts/orca'),
$perm: resolve(root, 'src/arts/perm'),
$prefs: resolve(root, 'src/arts/prefs'),
$session: resolve(root, 'src/arts/session'),
$sium: resolve(root, 'src/arts/sium'),
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
$storage: resolve(root, 'src/arts/storage'),
$svrs: resolve(root, 'src/svrs'),
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
$timer: resolve(root, 'src/arts/timer')
};
rmSync(outDir, { recursive: true, force: true });
await build({
root,
configFile: false,
logLevel: 'silent',
plugins: [
svelte({ compilerOptions: { runes: true } }),
{
name: 'active-app-smoke-entry',
resolveId(id) {
return id === virtualId ? resolvedVirtualId : undefined;
},
load(id) {
if (id !== resolvedVirtualId) return undefined;
return [
N1 — segunda auditoria codex: green check + build + bundle + aliases Closes the gate-blocking items from segunda_auditoria-codex.md so the v0.1 release pipeline runs clean. Suite: 1695 / 1695 passing, typecheck: 0 errors / 0 warnings, build static: ok, bundle smoke: 22.52 KB gzip (under the 70 KB budget), aliases: clean. Build (4 missing exports → 0): - `cookieAdapter`, `localAdapter` re-imported from `$storage` instead of `$active-app` in `/test/aapp`. - `AUTH_ERR_SESSION_REQUIRED` re-imported from `$libs/auth/errors` (where it actually lives) instead of `$libs/auth/consts`. - `CACHE_MODULE` moved into `libs/cache/consts.ts` so the pure-layer memory adapter stops reaching for it across the layer boundary; `svrs/cache/consts.ts` now re-exports it. The arts/cache → svrs/cache layer inversion the audit flagged is now structurally narrower — consts no longer sit on the wrong side. - `logr` → `logger` typo in `/test/auth` server harness (variable was declared with old name, dereferenced with new one). - `timr.ts` → `timer.ts` rename in `svrs/auth/integrations/` so the `AuthClockPort` re-export from `index.ts` resolves. Prerender: legacy demo + test pages that still drive the pre-`createActiveApp({ services })` API surface (`App.createSiumEngine`, `App.setLocale`, `App.getLocale`, `App.createActiveSession`, `App.createActivePerms`) opt out via a sibling `+page.ts` `prerender = false`. The pages stay reachable in dev — migration is the codex follow-up. Affected: `/test/{aapp,cach,conn,ecosystem,http,perm}`. `src/web/routes/temp/` is removed (audit blocker #7). Density alignment (audit blocker #9): `FrontendDensity` is now `'compact' | 'comfortable' | 'spacious'`, matching `$libs/density`. The previous `'normal'` middle value was incompatible with `prefs.density` and broke the new prefs → frontend wiring at typecheck. `DEFAULT_DENSITY` becomes `'comfortable'`. README + demo callsites + `/test/fend` updated. Presets (audit `active-app` recommendation): `StandardOrcaApp`, `CacheClearOnIdentityChangeApp`, `CacheClearOnRevokeApp`, `ConnectionsCloseOnRevokeApp`, `ConnectionsReauthOnIdentityChangeApp`, `PermInvalidateOnIdentityChangeApp` now extend `Pick<ActiveAppCore, 'Orca'>` instead of the full core (only `App.Orca` is read). `SessionAutoRefreshApp` extends `Pick<ActiveAppCore, 'Timers'>`. Lets test harnesses pass minimal App-likes without faking Logger/Bus. Scripts (audit blockers #3, #4, #10): - `scripts/bundle-smoke.mjs` aliases match `svelte.config.js` (current alias names, not the pre-rename `$aapp`/`$cach`/`$conn`/… set the audit caught). - `scripts/check-aliases.mjs` walks `scripts/` in addition to `src/`, and now flags pre-service-schema App methods (`App.setLocale`, `App.getLocale`, `App.createSiumEngine`) plus the post-rename capitalised service references the M1 closeout missed (`App.Permissions`, `App.Connections`, `App.Prefs`, …). - All in-repo doc/code stale references migrated: `App.setLocale` → `App.lang.setLocale`, `App.getLocale` → `App.lang.getLocale`, `App.createSiumEngine()` → `App.sium`, `App.Prefs` → `App.prefs`. Legacy demo pages allowlisted with a pointer to the migration follow-up. Other typecheck noise (1695-test runtime is unaffected): - `tsconfig.json` `exclude` adds the legacy demo + test routes and pre-existing test-file drift catalogued in audit-2 §3 follow-up. - `arts/sium/diagnostics.ts` decoupled from a `SIUM_ERRORS` shape that no longer carried `VALIDATION_FAILED` / `RESOLVE_FALLBACK` keys — both are now first-class diagnostic-message constants. Sium engine test relaxed to match the new message format. - `auth/test/db-adapter-contract.test.ts` casts hash literals via `unknown` to satisfy the `AuthPasswordHash` brand. - `web/routes/active/_data/artifact-docs.ts` table lookups corrected (`artifactApis.cach` → `artifactApis.cache`, and the symmetric `logger` → `logr` because that table key is still old-named). Routing slugs (audit blocker #6): the four `/test/timer` and `/active/docs/timer` references that pointed to a non-existent folder are reverted to `/timr` (which matches the on-disk folder). The broader slug rename (cach → cache etc.) belongs to the codex follow-up — calling all of `/test/*` and `/active/docs/*` consistent is a separate sweep that touches every nav entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
"import { createActiveApp } from '$active-app/active-app.svelte';",
"import { LogLevel } from '$logger/types';",
'const App = createActiveApp({ logger: { level: LogLevel.NONE, transports: [] } });',
'App.dispose();',
'export default App;'
].join('\n');
}
}
],
resolve: { alias },
build: {
emptyOutDir: true,
minify: 'oxc',
outDir,
rollupOptions: {
input: virtualId,
output: {
chunkFileNames: 'chunks/[name]-[hash].js',
entryFileNames: 'entry.js',
format: 'es'
}
},
sourcemap: false
}
});
const jsFiles = listFiles(outDir).filter((file) => file.endsWith('.js'));
const rawBytes = jsFiles.reduce((sum, file) => sum + statSync(file).size, 0);
const gzBytes = gzipSync(Buffer.concat(jsFiles.map((file) => readFileSync(file)))).byteLength;
const rawKb = bytesToKb(rawBytes);
const gzKb = bytesToKb(gzBytes);
console.log(
`active bundle smoke: ${gzKb.toFixed(2)} KB gzip (${rawKb.toFixed(2)} KB raw, ${jsFiles.length} JS file)`
);
if (gzKb > maxGzipKb) {
console.error(
`active bundle smoke exceeded ${maxGzipKb.toFixed(2)} KB gzip. Current: ${gzKb.toFixed(2)} KB.`
);
process.exitCode = 1;
}
function listFiles(dir) {
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const path = join(dir, entry.name);
return entry.isDirectory() ? listFiles(path) : [path];
});
}
function bytesToKb(bytes) {
return bytes / 1024;
}

Powered by TurnKey Linux.