Continues phase 4 — sweeps the next batch of modules onto the
canonical CodeError base. Same mechanical pattern as sium:
- Add `<MOD>_ERR` module seed and `<MOD>_ERR_*` codes via
`moduleSeed` + `errCode`.
- Convert error classes to `extends CodeError`. Drop the hardcoded
`this.name = 'XxxError'` literals — `name` derives from the code.
- Drop the `<MOD>_ERROR_NAME_*` constants that only existed to feed
those literals.
- Type guards keep using `instanceof Class` (works through the
CodeError prototype chain).
- Subclass-specific fields (envelope, failures, depth, type, key,
channel, connection, decision, invariant, etc.) preserved.
Modules migrated this commit:
- libs/buss (4 classes): BusDisposedError, BusAggregateListenerError,
BusReentrancyLimitError, BusInvalidPayloadError
- arts/timr (5 classes): TimrDisposedError, TimrInvalidKeyError,
TimrDuplicateKeyError, TimrInvalidDelayError, TimrInactiveTimerError
(codes live in libs/timers; classes stay in arts/timr)
- arts/conn (8 classes): ConnDisposedError, ConnConnectionAlreadyExistsError,
ConnConnectionNotFoundError, ConnInvalidConnectionNameError,
ConnInvalidFrameError, ConnChannelAlreadyExistsError,
ConnChannelNotFoundError, ConnWebSocketUnavailableError. Adds the
two missing guards flagged by audit-1-5 section 3.2
(isConnChannelAlreadyExistsError, isConnChannelNotFoundError).
- arts/sess (3 classes): SessDisposedError, SessAlreadyCreatedError,
SessInvalidSessionError. Sess test updated to assert against the
new code-based name.
- libs/perm + arts/perm + svrs/perm (3+4+2 classes): PermissionDeniedError,
PermissionSchemaError, PermissionRuntimeError, PermInvalidEndpointError,
PermNoContextError, PermRemoteRequestError, PermDisposedError (×2),
PermInvalidBodyError. Codes live in libs/perm; arts and svrs reach
into them.
- libs/cach + arts/cach + svrs/cach (3+1+1 classes): CacheKeyError,
CacheScopeError, CachePolicyError, CachActiveEntryDisposedError,
CachDisposedError. Codes consolidated in libs/cach.
Plus audit-1-5 section 3.2 cleanup outside the migration:
- libs/auth/errors.ts: adds the 10 missing type guards
(isAuthAccountNotLinkedError, isAuthSessionRevokedError,
isAuthAssuranceRequiredError, isAuthRateLimitedError,
isAuthTenantBoundaryError, isAuthOAuthStateInvalidError,
isAuthOAuthProviderError, isAuthOtpInvalidError,
isAuthMfaRequiredError, isAuthWebAuthnError). Auth's own
`code`/`messageKey` shape is preserved for now — full migration
to CodeError needs more thought because of the existing
AUTH_ERROR_CODES/AUTH_SAFE_MESSAGES dual structure.
Verification: svelte-check 1403 files / 0 errors. Server 1315 tests,
client 19 tests — all green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 2B.3 of the convention pass — closes the gap between rule 2
(`<MOD>_<CATEGORY>_<NAME>`) and the codebase. Adds the module's
4-letter alias to constants that previously had none or used a
non-canonical category prefix. ~190 constants renamed across 7
modules.
Bulk renames per module (sed with `\b...\b` word boundaries):
- arts/timr — ENGINE_METHOD_*, LOG_MSG_*, ERROR_PREFIX,
ERROR_NAME_*, ERROR_MSG_* now carry TIMR_ prefix
- arts/conn — TRANSPORT_KIND_*, FRAME_KEY_*, DEFAULT_*,
TIMR_KEY_*, BROWSER_EVENT_*, DOCUMENT_*,
WEBSOCKET_*, MOCK_TRANSPORT_*, LOG_MSG_*,
ERROR_*, FRAME_TYPE_*, METHOD_*, CLOSE_REASON_*
etc. now carry CONN_ prefix
- arts/sess — DEFAULT_*, AUTO_REFRESH_TIMER_KEY,
BROWSER_EVENT_*, DOCUMENT_*, BROADCAST_TYPE,
IDENTITY_*, REVOKE_SCOPE_*, REFRESH_STATUS_*,
ADOPT_REASON_*, SKIP_REASON_*, REVOKE_REASON_*,
INVARIANT_*, ACTOR_*, FIELD_*, ENGINE_METHOD_*,
ERROR_PREFIX/NAME/MSG, LOG_MSG_*, EVENT_* (the
lifecycle ones — see disambiguation below) now
carry SESS_ prefix
- arts/stor — ENTRY_CHANGE_SOURCE_*, DEFAULT_*, BROWSER_EVENT_*,
ENVELOPE_KEY/ERROR_*, NAMESPACE_SEPARATOR now
carry STOR_ prefix
- arts/http — DEFAULT_RETRY*, RETRY_AFTER_HEADERS,
DEFAULT_TIMEOUT, MAX_ERROR_BODY_BYTES, LOG_MSG_*,
ERROR_*, TIMEOUT_SCOPE_*, RESULT_KIND_* now
carry HTTP_ prefix
- arts/fmts — DEFAULT_LOCALE, AUTO_VALUE → FMTS_DEFAULT_LOCALE,
FMTS_AUTO_VALUE
- libs/timers — DEFAULT_BACKOFF_* → TIMR_DEFAULT_BACKOFF_*
- libs/lang — 4 unprefixed → LANG_ prefix
- libs/cach — 1 unprefixed → CACH_ prefix
Lifecycle vs bus event disambiguation (sess):
`arts/sess` had two distinct constant sets that collided after the
prefix add: `EVENT_*` (lifecycle, value `'sess.lifecycle.X'`) and
`SESS_EVENT_*` (bus, value `'sess.X'`). Both ended up with the same
SESS_EVENT_* name. To preserve the distinction:
- Lifecycle declarations renamed to SESS_EVENT_LIFECYCLE_* (matching
the path component already in their values).
- Bus declarations stay as SESS_EVENT_*.
- Consumers split correctly: code that switches on `change.event`
uses LIFECYCLE_ variants; code that publishes/subscribes to bus
uses bus variants.
Conn-side lifecycle redeclarations (`SESS_EVENT_REFRESHED` etc. with
`'sess.lifecycle.X'` values inside arts/conn/consts.ts) became
CONN_SESS_EVENT_* — these are conn-local copies; future cleanup
should import from sess instead of redeclaring.
Verification: svelte-check 1395 / 0 errors. Server 1230 tests, client
19 tests — all green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>