Closes the remaining items from segunda_auditoria-codex.md the user explicitly called out as still pending after N1. Layer fix (audit blocker #8): `createEngineCache`, `EngineCache`, `EngineCacheOptions`, the cache diagnostics catalog and the disposed-engine error infrastructure move from `svrs/cache/*` into `libs/cache/*` (renamed `engine-*` to distinguish from the existing pure-runtime files). Nothing in those files is server-specific — only `Logger` integration and a dispose guard, both universal. `arts/cache` now imports from `$libs/cache` directly; `svrs/cache/index.ts` becomes a transparent re-export of the same names so historical `$svrs/cache` consumers keep working. The arts → svrs layer inversion the audit flagged is now structurally impossible for the cache module. Route migration (audit blocker #1): The `/test/{aapp,cach,conn,perm,http}` pages are migrated from the pre-`createActiveApp({ services })` API surface to the current service-schema shape: - `App.createSiumEngine()` → `defineEngineSium()` in services + `App.sium`. - `App.createActiveSession(...)` → `defineActiveSession(...)` + `App.session`. - `App.createActivePerms(...)` → `defineActivePerm(...)` + `App.perm`. - `App.createActiveConnections<...>()` → `defineActiveConnections(...)` + `App.connections`. - Top-level option blocks (`lang: {...}`, `http: {...}`, `cache: {...}`, `frontend: {...}`, `storage: {...}`, `permissions: {...}`, `connections: {...}`) now wrap their factories under `services: {...}`. - `App.setLocale` / `App.getLocale` migrate to `App.lang.*`. - `density: 'normal'` → `'comfortable'` (post-L1 vocabulary). - Each page's `+page.ts` prerender opt-out is removed; they now build statically and are reachable from the test index. `/test/ecosystem` is the one outlier: its 1387-line scenario harness threads through Auth + Session + Perms + Cache + Connections in ways that need API-port stubbing (AuthClientHttpPort, an EcosystemConnections generic shape that no longer exists, etc.). The factory wiring is already migrated in the file (services schema, App.sium / App.auth / App.session / App.perm / App.connections / cache scope locale via a synced `currentLocale` cell), but the consumer code still uses `App.format` / `App.dom` / `App.createActiveConnections<...>()` shapes that don't typecheck against the new schema. Re-excluded from typecheck + prerender with a follow-up note; the page still loads in dev. Migration of the remaining call sites is its own commit. Suite: 1695 / 1695 passing. check / build / bundle / aliases all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>master
parent
ca01324f67
commit
843c7087e7
@ -1,5 +1,5 @@
|
||||
import { CodeError } from '$libs/errs';
|
||||
import { CACHE_ERR_DISPOSED } from '$libs/cache';
|
||||
import { CACHE_ERR_DISPOSED } from './errors.ts';
|
||||
|
||||
export const CACHE_ERROR_MSG_DISPOSED_SUFFIX = '() called on a disposed cache engine';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { CACHE_ERROR_MSG_DISPOSED_SUFFIX } from './errors.ts';
|
||||
import { CACHE_ERROR_MSG_DISPOSED_SUFFIX } from './engine-errors.ts';
|
||||
|
||||
export function disposedCacheMessage(method: string): string {
|
||||
return `${method}${CACHE_ERROR_MSG_DISPOSED_SUFFIX}`;
|
||||
@ -1,155 +1,10 @@
|
||||
export { createEngineCache } from './engine-cache.ts';
|
||||
export { createCacheDiagnostics, emitCacheDiagnostic } from './diagnostics.ts';
|
||||
export { CACHE_ERR_DISPOSED } from '$libs/cache';
|
||||
export {
|
||||
CACHE_LOG_MESSAGE_ADAPTER_ERROR,
|
||||
CACHE_LOG_MESSAGE_BY_EVENT,
|
||||
CACHE_LOG_MESSAGE_DELETE,
|
||||
CACHE_LOG_MESSAGE_EVICTION,
|
||||
CACHE_LOG_MESSAGE_HIT,
|
||||
CACHE_LOG_MESSAGE_INVALIDATE,
|
||||
CACHE_LOG_MESSAGE_MISS,
|
||||
CACHE_LOG_MESSAGE_REFRESH_ERROR,
|
||||
CACHE_LOG_MESSAGE_REFRESH_START,
|
||||
CACHE_LOG_MESSAGE_REFRESH_SUCCESS,
|
||||
CACHE_LOG_MESSAGE_SCHEMA_MISMATCH,
|
||||
CACHE_LOG_MESSAGE_SCOPE_ERROR,
|
||||
CACHE_LOG_MESSAGE_SET,
|
||||
CACHE_LOG_MESSAGE_SINGLEFLIGHT_JOIN,
|
||||
CACHE_LOG_MESSAGE_STALE_HIT,
|
||||
CACHE_LOG_MESSAGE_STALE_IF_ERROR,
|
||||
CACHE_METHOD_CLEAR,
|
||||
CACHE_METHOD_EXPLAIN,
|
||||
CACHE_METHOD_GET,
|
||||
CACHE_METHOD_INVALIDATE,
|
||||
CACHE_METHOD_MUTATE,
|
||||
CACHE_METHOD_ON,
|
||||
CACHE_METHOD_QUERY,
|
||||
CACHE_METHOD_SET,
|
||||
CACHE_METHOD_STATS,
|
||||
CACHE_MODULE
|
||||
} from './consts.ts';
|
||||
export {
|
||||
CACHE_ERROR_MSG_DISPOSED_SUFFIX,
|
||||
CacheDisposedError,
|
||||
isCacheDisposedError
|
||||
} from './errors.ts';
|
||||
export { disposedCacheMessage } from './helpers.ts';
|
||||
export type { EngineCache, EngineCacheOptions } from './types.ts';
|
||||
export type { CacheDiagnosticEvent, CacheDiagnostics } from './diagnostics.ts';
|
||||
|
||||
export {
|
||||
CACHE_ADAPTER_MEMORY,
|
||||
CACHE_ADAPTER_STORAGE,
|
||||
CACHE_DECISION_ACTION_DELETE_AND_FETCH,
|
||||
CACHE_DECISION_ACTION_FETCH,
|
||||
CACHE_DECISION_ACTION_SERVE,
|
||||
CACHE_DECISION_ACTION_SERVE_AND_REFRESH,
|
||||
CACHE_DECISION_ACTION_SKIP_CACHE,
|
||||
CACHE_DECISION_REASON_BYPASS_CACHE,
|
||||
CACHE_DECISION_REASON_CACHE_MISS,
|
||||
CACHE_DECISION_REASON_EXPIRED,
|
||||
CACHE_DECISION_REASON_FRESH,
|
||||
CACHE_DECISION_REASON_NO_STORE,
|
||||
CACHE_DECISION_REASON_PREFIX_EPOCH_CHANGED,
|
||||
CACHE_DECISION_REASON_SCHEMA_VERSION_MISMATCH,
|
||||
CACHE_DECISION_REASON_SCOPE_MISMATCH,
|
||||
CACHE_DECISION_REASON_STALE_WINDOW_VALID,
|
||||
CACHE_DECISION_REASON_TAG_EPOCH_CHANGED,
|
||||
CACHE_ENVELOPE_STATE_DEGRADED,
|
||||
CACHE_ENVELOPE_STATE_EXPIRED,
|
||||
CACHE_ENVELOPE_STATE_FRESH,
|
||||
CACHE_ENVELOPE_STATE_INVALIDATED,
|
||||
CACHE_ENVELOPE_STATE_STALE,
|
||||
CACHE_EVENT_ADAPTER_ERROR,
|
||||
CACHE_EVENT_ALL,
|
||||
CACHE_EVENT_DELETE,
|
||||
CACHE_EVENT_EVICTION,
|
||||
CACHE_EVENT_HIT,
|
||||
CACHE_EVENT_INVALIDATE,
|
||||
CACHE_EVENT_MISS,
|
||||
CACHE_EVENT_REFRESH_ERROR,
|
||||
CACHE_EVENT_REFRESH_START,
|
||||
CACHE_EVENT_REFRESH_SUCCESS,
|
||||
CACHE_EVENT_SCHEMA_MISMATCH,
|
||||
CACHE_EVENT_SCOPE_ERROR,
|
||||
CACHE_EVENT_SET,
|
||||
CACHE_EVENT_SINGLEFLIGHT_JOIN,
|
||||
CACHE_EVENT_STALE_HIT,
|
||||
CACHE_EVENT_STALE_IF_ERROR,
|
||||
CACHE_POLICY_CATALOG,
|
||||
CACHE_POLICY_IMMUTABLE,
|
||||
CACHE_POLICY_INTERACTIVE,
|
||||
CACHE_POLICY_PRIVATE_SESSION,
|
||||
CACHE_POLICY_REALTIME,
|
||||
CACHE_READ_MODE_BYPASS_CACHE,
|
||||
CACHE_READ_MODE_CACHE_FIRST,
|
||||
CACHE_READ_MODE_MUST_REVALIDATE,
|
||||
CACHE_READ_MODE_NO_STORE,
|
||||
CACHE_READ_MODE_STALE_WHILE_REVALIDATE,
|
||||
CACHE_SCOPE_ACTOR,
|
||||
CACHE_SCOPE_CUSTOM,
|
||||
CACHE_SCOPE_PERMISSION,
|
||||
CACHE_SCOPE_PUBLIC,
|
||||
CACHE_SCOPE_TENANT,
|
||||
CacheKeyError,
|
||||
CachePolicyError,
|
||||
CacheScopeError,
|
||||
createMapStorage,
|
||||
defaultCachePolicies,
|
||||
durationToMs,
|
||||
isCacheKeyError,
|
||||
isCachePolicyError,
|
||||
isCacheScopeError,
|
||||
memoryCacheAdapter,
|
||||
normalizeKey,
|
||||
normalizeKeyPrefixes,
|
||||
normalizeTag,
|
||||
normalizeTags,
|
||||
resolveScope,
|
||||
stableHash,
|
||||
stableStringify,
|
||||
storageCacheAdapter
|
||||
} from '$libs/cache';
|
||||
|
||||
export type {
|
||||
CacheAdapter,
|
||||
CacheAdapterSetOptions,
|
||||
CacheClock,
|
||||
CacheDecision,
|
||||
CacheDecisionAction,
|
||||
CacheDecisionReason,
|
||||
CacheEnvelope,
|
||||
CacheEnvelopeState,
|
||||
CacheEvent,
|
||||
CacheEventHandler,
|
||||
CacheEventSelector,
|
||||
CacheEventType,
|
||||
CacheExplain,
|
||||
CacheKey,
|
||||
CachePolicy,
|
||||
CacheReadMode,
|
||||
CacheRuntime,
|
||||
CacheRuntimeConfig,
|
||||
CacheScopeInput,
|
||||
CacheScopeMode,
|
||||
CacheStats,
|
||||
CacheTagLike,
|
||||
CacheTagObject,
|
||||
CustomCacheScope,
|
||||
ExplainOptions,
|
||||
GetOptions,
|
||||
InvalidateOptions,
|
||||
MemoryCacheAdapter,
|
||||
MemoryCacheAdapterOptions,
|
||||
MemoryCacheEvictReason,
|
||||
MutateOptions,
|
||||
QueryOptions,
|
||||
ResolvedCachePolicy,
|
||||
ResolvedCacheScope,
|
||||
ResolvedScopeValues,
|
||||
ScopeResolver,
|
||||
SetOptions,
|
||||
StorageCacheAdapterOptions,
|
||||
StorageLike
|
||||
} from '$libs/cache';
|
||||
/**
|
||||
* Server-side surface for `cache`. After the codex audit blocker #8 fix,
|
||||
* the engine factory + diagnostics + types live in `$libs/cache` (the
|
||||
* pure layer) so `arts/cache` can consume them without inverting layers.
|
||||
*
|
||||
* This module re-exports the same names from `$libs/cache` so historical
|
||||
* `import { ... } from '$svrs/cache'` callers keep working — production
|
||||
* compositions, READMEs, docs and ecosystem tests all flow through here.
|
||||
*/
|
||||
export * from '$libs/cache';
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Skip static prerender for the legacy aapp demo. The page still
|
||||
* relies on pre-service-schema App methods that the current runtime
|
||||
* no longer exposes; until it is migrated to
|
||||
* `createActiveApp({ services })`, render it on-demand only so the
|
||||
* static gate stays green and the page remains reachable in dev.
|
||||
*/
|
||||
export const prerender = false;
|
||||
@ -1,2 +0,0 @@
|
||||
/** Skip static prerender — uses pre-service-schema App API. See /test/aapp. */
|
||||
export const prerender = false;
|
||||
@ -1,2 +0,0 @@
|
||||
/** Skip static prerender — uses pre-service-schema App API. See /test/aapp. */
|
||||
export const prerender = false;
|
||||
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Skip static prerender for the legacy http demo. The page still
|
||||
* relies on pre-service-schema App methods that the current runtime
|
||||
* no longer exposes; render it on-demand only.
|
||||
*/
|
||||
export const prerender = false;
|
||||
@ -1,2 +0,0 @@
|
||||
/** Skip static prerender — uses pre-service-schema App API. See /test/aapp. */
|
||||
export const prerender = false;
|
||||
Loading…
Reference in new issue