master
${ noResults }
4 Commits (master)
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
4db6bd2b3b |
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 |
|
|
a849d00bff |
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 |
|
|
a01ef0f63d |
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 |
|
|
6908f82f09 |
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 |