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.

291 lines
11 KiB

Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
# Active conventions
This document captures the **mandatory naming and structure
conventions** for the Active framework codebase. Every new module,
type, constant, and file must comply. Existing code that drifts from
these rules is treated as audit debt and migrated module by module.
The goal is single-rule homogeneity: a developer learns the convention
once and applies it everywhere. No exceptions without an explicit
decision recorded here.
---
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
## 1. Module identifier — full English word
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Every artifact and lib that pairs with one is identified by a stable
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
**full English word** that doubles as filesystem name, alias and
canonical wire identifier:
| Folder | Alias | Wire / value |
|---|---|---|
| `arts/active-app/`, `libs/active-app/` | `$active-app` | `'app'` |
| `arts/auth/`, `libs/auth/`, `svrs/auth/` | `$auth` | `'auth'` |
| `arts/bus/`, `libs/bus/` | `$bus` | `'bus'` |
| `arts/cache/`, `libs/cache/`, `svrs/cache/` | `$cache` | `'cache'` |
| `arts/connection/` | `$connection` | `'connection'` |
| `libs/dom/` | `$libs/dom` | `'dom'` |
| `libs/errs/` | `$libs/errs` | `'errs'` |
| `arts/frontend/` | `$frontend` | `'frontend'` |
| `arts/formats/` (+ `currency/`, `numbers/`, `units/`, `dates/`) | `$formats` | `'formats'` |
| `arts/http/`, `libs/http/` | `$http` | `'http'` |
| `arts/lang/`, `libs/lang/` | `$lang` | `'lang'` |
| `arts/logger/`, `libs/logger/` | `$logger` | `'logger'` |
| `arts/permissions/`, `libs/permissions/`, `svrs/permissions/` | `$permissions` | `'permissions'` |
| `arts/session/` | `$session` | `'session'` |
| `arts/sium/` | `$sium` | `'sium'` (proper name of the validator) |
| `arts/storage/` | `$storage` | `'storage'` |
| `arts/timer/`, `libs/timer/` | `$timer` | `'timer'` |
### Special cases
- **`active-app`** uses a hyphen in the alias because `$app` is a
reserved namespace in SvelteKit (`$app/stores`, `$app/navigation`).
The constants and class names still use `App` / `APP_*`; the
`active-` prefix only appears in filesystem and alias.
- **`lang`** and **`sium`** are kept as-is. `lang` is the standard
HTML/i18n term (`<html lang="…">`); `sium` is the proper name of
the validator (like `zod`, `valibot`). They are not abbreviations.
- **`errs`** is the framework's own error system. Kept short
intentionally because it sits at the foundation; lowering it to
`'errs'` keeps the wire format compact for codes like
`'errs::format_invalid'`.
### What this replaces
Earlier the codebase used 4-letter abbreviations (`buss`, `cach`,
`conn`, `sess`, `stor`, `timr`, `logr`, `aapp`, `fmts`, `fend`,
`perm`, `curr`, `unts`, `nums`). That convention has been removed:
abbreviations created cognitive load with no real benefit.
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
---
## 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>`
Every categorical module-level constant follows the pattern:
```
<MOD>_<CATEGORY>_<NAME>
```
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
- **`<MOD>`** — the module's identifier in caps. For most modules this
matches the filesystem (`STORAGE_*`, `BUS_*`, `CACHE_*`, `LOGGER_*`,
`TIMER_*`, `CONNECTION_*`, `SESSION_*`, `FORMATS_*`, `FRONTEND_*`,
`HTTP_*`, `LANG_*`, `AUTH_*`, `SIUM_*`, `DOM_*`, `ERRS_*`).
**Exception**: the `permissions` module uses `PERMISSION_*` (singular)
because the constants describe the concept ("a permission effect",
"a permission decision"), not the module collection. The `S` is
reserved for the folder/alias/wire which group the system as a
whole.
**Exception**: the `active-app` module uses `APP_*` (without the
`active-` prefix) because the `active-` prefix is purely a
disambiguator forced by SvelteKit's reserved `$app` namespace.
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
- **`<CATEGORY>`** — what kind of constant it is. Picked from the
fixed vocabulary in section 3.
- **`<NAME>`** — the specific value's identifier in
`UPPER_SNAKE_CASE`.
### Examples
```ts
// good
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
BUS_DIAGNOSTIC_EVENTS
BUS_DEFAULT_MAX_LISTENERS_PER_EVENT
BUS_ERR_DISPOSED
SESSION_EVENT_LIFECYCLE_ADOPTED
PERMISSION_METHOD_CHECK
TIMER_STATE_PENDING
CONNECTION_REASON_AUTH_FAILED
CACHE_LIMIT_DEFAULT_MAX_ENTRIES
STORAGE_MODULE // value: 'storage'
APP_MODULE // value: 'app'
PERMISSION_MODULE // value: 'permissions'
// bad
BUSS_DIAGNOSTIC_EVENTS // 4-letter alias is dead (rule 1)
DEFAULT_TIMER_SCOPE_SEPARATOR // category before module (rule 2)
PERMISSIONS_EFFECT_ALLOW // wrong shape: concept is singular
AUTO_REAUTH_USER_IDENTITY_CHANGE // missing module prefix (rule 1)
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
```
### Sub-categories
When a category needs internal hierarchy, append additional segments
in the `<NAME>` part, not in `<CATEGORY>`:
```ts
// good
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
BUS_LISTENER_ERROR_MODE_THROW
SESSION_EVENT_LIFECYCLE_ADOPTED
SESSION_EVENT_LIFECYCLE_REVOKED
PERMISSION_DEFAULT_REMOTE_FAILURE_BACKOFF_MS
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
// bad
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
BUS_LISTENER_ERR_MODE_THROW // category split across underscores
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
```
---
## 3. Category vocabulary — fixed list
Only these category tokens are allowed. Adding a new category is a
deliberate decision recorded in this document, not an ad-hoc choice
inside a module.
| Category | Use |
|---|---|
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `MODULE` | The module's identifier as a string constant. **Single source of truth** for the module's identity. Used wherever the module's identifier is needed: logger category, error message prefix, event scope, etc. Every module declares exactly one `<MOD>_MODULE = '<value>'`. |
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `ERR` | Error codes (`ErrCode` values from `$libs/errs`) |
| `EVENT` | Bus or lifecycle event names (string discriminators) |
| `DIAGNOSTIC_EVENTS` | Event values published through `Logger` (catalog object) |
| `METHOD` | Method labels for error messages (`ensureLive(METHOD)`) |
| `STATE` | Tagged-union state discriminators |
| `STATUS` | Tagged-union status discriminators |
| `KIND` | Tagged-union kind discriminators |
| `REASON` | Tagged-union reason discriminators |
| `TYPE` | Tagged-union type discriminators (when none of the above fits) |
| `MODE` | Mode discriminators (e.g. listener error mode) |
| `DEFAULT` | Default values for options |
| `LIMIT` | Maximum / minimum values |
| `ID_PREFIX` | Prefix used by ID factories |
| `LOG_MSG` | Log message strings |
Replace LOGGER_CATEGORY with <MOD>_MODULE single source of truth Phase 2B.1 of the convention pass. Establishes one canonical constant per module — `<MOD>_MODULE = '<alias>'` — as the single source for the module's identifier across logger category, error message prefixes, event scopes, and any other place the module's name is needed. What changed: 1. Renamed all `<MOD>_LOG_CATEGORY` constants to `<MOD>_MODULE` (the value semantics didn't change; only the name). Affected modules: buss, conn, sess, perm (libs+arts+svrs), timr, lang, auth, http, sium, cach, stor, aapp (libs+arts), and the four fmts sub-modules (fmts, fmts.curr, fmts.dates, fmts.nums, fmts.unts). 2. Aligned values with the 4-letter alias where they didn't already: - STOR_MODULE: 'storage' → 'stor' - FMTS_MODULE: 'formats' → 'fmts' - FMTS_CURR_MODULE: 'formats.currency' → 'fmts.curr' - FMTS_DATES_MODULE: 'formats.dates' → 'fmts.dates' - FMTS_NUMS_MODULE: 'formats.numbers' → 'fmts.nums' - FMTS_UNTS_MODULE: 'formats.units' → 'fmts.unts' 3. Unified the duplicate `AAPP_MODULE` declaration: arts/aapp/consts.ts now re-exports from libs/aapp/consts.ts (canonical source). Both files used to declare it independently with different values ('app' vs 'aapp'). 4. Replaced hardcoded `'[<alias>] ...'` literals in error messages with template strings using `<MOD>_MODULE`. Every error-message constant now derives the prefix from the module identifier instead of hardcoding it. Affected files: libs/aapp/consts.ts, arts/aapp/consts.ts, libs/buss/consts.ts, libs/lang/errors.ts, arts/stor/errors.ts, arts/sium/errors.ts, arts/fmts/errors.ts, and the ERROR_PREFIX constants in arts/conn, arts/sess, arts/http, arts/timr. 5. Updated diagnostic event values to use the new module aliases: - STOR_DIAGNOSTIC_EVENTS.ERROR: 'storage.error' → 'stor.error' - All FMTS_*_DIAGNOSTIC_EVENTS values to use 'fmts.X.*' 6. Updated tests that asserted against the old values (storage-integration.test and fmts/curr/test/barrel.test). 7. Updated docs/conventions.md: replaced the LOG_CATEGORY category with the new MODULE category. Added the rule that ERROR_MSG values must use the template `[${<MOD>_MODULE}]`, never a hardcoded literal. 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>
5 months ago
| `ERROR_MSG` | Error message strings (technical, dev-facing). Must use a template referencing `<MOD>_MODULE` for the prefix, never a hardcoded literal: `` `[${MOD_MODULE}] ...` ``. |
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `ERROR_MESSAGES` | Catalogue object (`<MOD>_ERROR_MESSAGES: ErrorMessages`) indexed by `ErrCode`. Static strings or `(...args) => string` factories. |
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `CONTEXT_KEY` | Svelte context keys |
Categories that are **not** in this list (e.g. `AUTO_REAUTH`,
`AUTO_INVALIDATE`, `BACKOFF`, `BUFFER_POLICY`, `CHANNEL_STATE`) must
fold into one of the above. Examples:
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
- `CONNECTION_AUTO_REAUTH_*` → `CONNECTION_REASON_AUTO_REAUTH_*` if
the value drives a "why this happened" branch, or
`CONNECTION_MODE_AUTO_REAUTH_*` if it configures behavior.
- `CACHE_AUTO_INVALIDATE_*` → `CACHE_MODE_AUTO_INVALIDATE_*`.
- `CONNECTION_BUFFER_POLICY_*` → `CONNECTION_MODE_BUFFER_*`.
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
When in doubt, propose the addition here before introducing it.
---
## 4. Error codes (`ErrCode`) — special case under rule 2
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Error codes from `$libs/errs` follow rule 2 with category `ERR`. Each
module declares one `<MOD>_ERR` seed and builds the individual codes
from it via `errCode(parent, segment)` so the module string never
appears as a literal in error declarations:
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
```ts
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
import { errCode, moduleSeed, type ErrCode, type ModuleSeed } from '$libs/errs';
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
export const BUS_ERR: ModuleSeed = moduleSeed('bus'); // 'bus::'
export const BUS_ERR_DISPOSED: ErrCode = errCode(BUS_ERR, 'disposed'); // 'bus::disposed'
export const BUS_ERR_INVALID_PAYLOAD: ErrCode = errCode(BUS_ERR, 'invalid_payload');
export const BUS_ERR_LISTENER: ErrCode = errCode(BUS_ERR, 'listener'); // 'bus::listener'
export const BUS_ERR_LISTENER_FAILED: ErrCode = errCode(BUS_ERR_LISTENER, 'failed'); // 'bus::listener.failed'
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
```
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
The constant's `<NAME>` part mirrors the path segments inside the
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
runtime value: `BUS_ERR_LISTENER_FAILED` ↔ `'bus::listener.failed'`.
The module name lives in exactly one place: `moduleSeed('bus')`.
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
The `::` separator distinguishes module from hierarchy. `errCode`
picks the right separator automatically — `::` after a seed, `.`
between segments. A helper `codeToLangPath(c)` converts
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
`'bus::listener.failed'` → `'bus.listener.failed'` for the i18n
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
path.
### Family matching
A single predicate `matches(err, family)` from `$libs/errs` covers
both common cases. `family` can be:
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
- A **module seed** (`BUS_ERR`) — matches any error from that
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
module regardless of hierarchy.
- An **`ErrCode`** — matches the code itself or any hierarchical
descendant within the same module.
```ts
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
matches(err, BUS_ERR_DISPOSED) // exact code
matches(err, BUS_ERR_LISTENER) // any descendant of bus::listener
matches(err, BUS_ERR) // any error declared by bus
```
### Error class names — full English word
Error classes use the full English word **of the concept**, not the
module's `<MOD>_*` prefix. The class name is consumer-facing API; the
constant prefix is internal organization:
```ts
// good
StorageInvalidTypeError // class
STORAGE_ERR_INVALID_TYPE // constant
BusDisposedError // class
BUS_ERR_DISPOSED // constant
PermissionDeniedError // class — singular concept
PERMISSION_ERR_DENIED // constant — singular prefix
AppAlreadyCreatedError // class — no Active prefix
APP_ERR_ALREADY_CREATED // constant
Migrate sium to CodeError + add ModuleSeed/errCode builders Pilot of phase 4 plus a libs/errs API change introduced after the user pointed out that `code('buss::disposed')` repeats the module name redundantly across every declaration. libs/errs additions: - New `ModuleSeed` branded type — string of the form `'<module>::'` produced once per module. - `moduleSeed(module)` factory: validates the module name and returns a `ModuleSeed`. - `errCode(parent, segment)` builder: composes a child `ErrCode` from a `ModuleSeed` (uses `::` separator) or another `ErrCode` (uses `.` separator). The builder picks the right separator automatically. - `isModuleSeed(value)` discriminator. - `matches(err, family)` now accepts `ModuleSeed | ErrCode`. Passing a seed matches any error from that module; passing a code matches hierarchically within the same module. Replaces the `matchesModule(err, 'buss')` helper introduced earlier in this session — that helper was redundant once seeds entered the API. Sium pilot: - arts/sium/consts.ts: declares `SIUM_ERR = moduleSeed('sium')` plus the two child codes via `errCode(SIUM_ERR, 'validation')` and `errCode(SIUM_ERR, 'async_schema')`. Module name appears exactly once. - arts/sium/core/types.ts: `SiumValidationError` and `SiumAsyncSchemaError` extend `CodeError`. Hardcoded `this.name = 'SiumValidationError'` literals removed. Subclass- specific fields (`issues`, `schemaKind`) preserved. - Adds `isSiumValidationError` / `isSiumAsyncSchemaError` guards (closes audit-1-5 section 3.2 for sium). - 12 tests in arts/sium/test/errors.test.ts cover subclass shape, identity, `matches` against seed and exact code, and the fluent decorator chain. docs/conventions.md updated: - Section 4 rewritten around the `moduleSeed`/`errCode` pattern. - "Family root" wording removed (was misleading — `BUSS_ERR='buss::base'` was a sibling, not an ancestor of its module's codes). - `matches` documented as accepting either a seed or an ErrCode. Verification: svelte-check 1403 files / 0 errors. Server 1315 tests (+10 from previous), client 19 tests — all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
```
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
---
## 5. String values inside diagnostic / event constants
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Every string value emitted as an event identifier must start with the
module's identifier (rule 1) followed by `.` and the value-specific
path:
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
```ts
// good — value carries the module scope
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
export const CONNECTION_DIAGNOSTIC_EVENTS = {
AUTH_FAILED: 'connection.auth_failed',
RECONNECT_EXHAUSTED: 'connection.reconnect_exhausted'
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
} as const;
// bad — bare value collides across modules
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
export const CONNECTION_DIAGNOSTIC_EVENTS = {
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
AUTH_FAILED: 'auth_failed', // collides with auth.* events
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
LISTENER_THREW: 'listener_threw' // collides with session and timer
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
} as const;
```
---
## 6. File and folder structure
| Layer | Rule |
|---|---|
| `libs/<mod>/` | Pure contracts: types, constants, error classes, helpers. No Svelte runes, no engine state. |
| `arts/<mod>/` | Runtime engine + `*.svelte.ts` active wrappers. May import from `$libs/<mod>` and from its own files. |
| `arts/<mod>/index.ts` | Public barrel. Re-exports the artifact's surface. |
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `arts/<mod>/errors.ts` | Single home for the module's error infrastructure: `<MOD>_ERR` seed, `<MOD>_ERR_*` codes, `<MOD>_ERROR_MESSAGES` catalog, error classes and `is*Error` guards. **Do not split** these across `consts.ts` and `errors.ts`; everything error-related lives together. |
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `arts/<mod>/test/` | Tests for engine and active wrappers. |
| `svrs/<mod>/` | Server-side counterparts (cookies, db adapters, route handlers). |
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
| `arts/active-app/` | Composition root. Allowed to import any `$<mod>`. |
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
**Cross-artifact imports are forbidden** (`arts/X` cannot import
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
`$Y`). Sole exception: `arts/active-app/`.
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
---
## 7. When this document is updated
- A new category in section 3 requires a record-of-decision: who, when,
why.
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
- Module names are frozen: a new artifact picks a name not yet taken;
renaming an existing module is a breaking change.
Reorganize docs: move working/audit files to docs/ and add conventions Working documents and audits were spread across the project root, mixing with standard npm/GitHub files (README, CHANGELOG, CONTRIBUTING, SECURITY, BRAND). Moves them under docs/ for a clean root and adds docs/conventions.md as the canonical document for codebase-wide naming and structure rules. Files moved to docs/ (via git mv, history preserved): - audit-1-5.md (current ecosystem audit) - AUDIT_KIMI.md - AUDIT_OPENCODE.md - AUDIT_claude.md (historical audits from prior tools) - before_0_1.md (pre-0.1 release checklist) - buss.md (bus design doc, no longer live) - NEXT_STEPS.md (roadmap) Files staying in root (npm/GitHub convention): - README.md, CHANGELOG.md, CONTRIBUTING.md, SECURITY.md, BRAND.md References updated to point at docs/: - CHANGELOG.md (line 11) - README.md (line 105) - SECURITY.md (line 3) - src/web/routes/active/security/+page.svelte (line 46) docs/conventions.md captures three rules accepted as binding for the codebase: 1. Module identifier — every artifact and lib uses its 4-letter alias (BUSS, CONN, SESS, PERM, TIMR, LOGR, CACH, STOR, FMTS, FEND, ADOM, AAPP, AUTH, LANG, HTTP, SIUM, ERRS) for both string values and constant name prefixes. Drift from this rule (BUS_*, CONNECTION_*, SESSION_*, …) is being closed in the next audit pass. 2. Constant naming — `<MOD>_<CATEGORY>_<NAME>` strictly. No exceptions (no DEFAULT_TIMER_* style). 3. Category vocabulary — fixed list of category tokens (ERR, EVENT, DIAGNOSTIC_EVENTS, METHOD, STATE, STATUS, KIND, REASON, TYPE, MODE, DEFAULT, LIMIT, ID_PREFIX, LOG_CATEGORY, LOG_MSG, ERROR_MSG, ERROR_NAME, CONTEXT_KEY). Ad-hoc categories (AUTO_REAUTH, AUTO_INVALIDATE, BUFFER_POLICY, CHANNEL_STATE) fold into one of these. The document also formalizes the layer rules and ErrCode shape that will be implemented in upcoming commits. svelte-check 1395/0 errors. No code-side regressions; the moves are file-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
- Drift found in the codebase that violates these rules is filed as an
audit finding and resolved in a dedicated commit.
Rename modules from 4-letter aliases to full English words Drops the 4-letter alias convention in favour of a single homogeneous naming axis: full English words across filesystem, alias, wire format and constants. Module renames: - arts/aapp → arts/active-app (libs/aapp also) - arts/buss → arts/bus (libs/buss also) - arts/cach → arts/cache (libs/cach + svrs/cach also) - arts/conn → arts/connection - arts/fend → arts/frontend - arts/fmts → arts/formats (curr→currency, nums→numbers, unts→units) - arts/logr → arts/logger (libs/logr also) - arts/perm → arts/permissions (libs/perm + svrs/perm also) - arts/sess → arts/session - arts/stor → arts/storage - arts/timr → arts/timer (libs/timers → libs/timer) Modules left as-is: auth, dom, errs, http, lang, sium (already match their canonical name or are proper names). Special case: `aapp` could not become `app` because `$app` is reserved by SvelteKit (`$app/stores`, `$app/navigation`, ...). Compromise: - Filesystem and alias use `active-app` / `$active-app`. - Constants and class names use `App` / `APP_*` (no `active-` prefix). The `active-` prefix only disambiguates the alias from SvelteKit's namespace; the module is App. Special case: `permissions` keeps the plural for filesystem/alias/wire but constants and classes use the singular `PERMISSION_*` / `Permission*` because they describe the concept ("a permission effect"), not the module collection. Constants follow the new module name in caps: `STORAGE_*`, `BUS_*`, `CACHE_*`, `CONNECTION_*`, `FORMATS_*`, `LOGGER_*`, `SESSION_*`, `TIMER_*`, etc. Module values: `STORAGE_MODULE = 'storage'`, `BUS_MODULE = 'bus'`, `APP_MODULE = 'app'`, `PERMISSION_MODULE = 'permissions'`, etc. Wire/code format moved accordingly: `'storage::*'`, `'bus::*'`, `'session::*'`, `'permissions::*'`, etc. Diagnostic event values updated: `'storage.error'`, `'bus.event.published'`, `'connection.auth_failed'`, etc. App events use `'app.*'`: `AAPP_EVENT_* → APP_EVENT_*` with values `'app.user.identity.changed'`. Class renames (where they used the abbreviation): - AappAlreadyCreatedError → AppAlreadyCreatedError - BussError* → BusError* (where applicable) - Cach* → Cache* - Conn* → Connection* (e.g. ConnDisposedError → ConnectionDisposedError; ConnConnection* collapsed to Connection*) - Logr*Error → Logger*Error - Sess* → Session* (SessInvalidSessionError → SessionInvalidError) - Stor* → Storage* - Timr* → Timer* (TimrInactiveTimerError → TimerInactiveError) - AuthCachPort → AuthCachePort - AuthClientCach* → AuthClientCache* - AuthPermPort → AuthPermissionsPort Property renames in option types: - `cach?:` → `cache?:` in AuthClient options - `logr:` → `logger:` in svrs/auth ports - `timr:` → `timer:` in svrs/auth ports `docs/conventions.md` rewritten: - Rule 1 dropped the 4-letter alias mandate; lists the full English module names and special-cases active-app, lang, sium, permissions. - Rule 2 documents the new constant prefix convention and its two exceptions (APP_* for active-app, PERMISSION_* singular for permissions). - Rule 6 codifies that all error infrastructure (codes, messages, classes, guards) lives in a single `errors.ts` per module — removing the `consts.ts` / `errors.ts` split for error-related symbols. `libs/errs` adds `ErrorMessages` type so every module can declare its catalog as `<MOD>_ERROR_MESSAGES: ErrorMessages` instead of repeating the `Readonly<Record<ErrCode, string | (...args) => string>>` shape. Storage migrated as the first proof of the canonical pattern. All 1334 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Last updated: `2026-05-02` — full English word convention, dropping
the 4-letter alias rule.

Powered by TurnKey Linux.