@astram/guide 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CAPABILITIES.md +37 -0
  2. package/package.json +1 -1
package/CAPABILITIES.md CHANGED
@@ -317,12 +317,48 @@ upload(@Req() req: Record<string, unknown>) {
317
317
  - Not provided: malware scanning, per-tenant encryption of file bytes (SSE-S3 only), streaming
318
318
  downloads, dedup (each upload is its own record; `sha256` is returned so you can detect repeats).
319
319
 
320
+ ## Database names and several environments on one server (`SHIELD_DB_NAMESPACE`, ADR-0037)
321
+ - The framework uses four databases, `<ns>_app`, `<ns>_identity`, `<ns>_authz` and `<ns>_audit`,
322
+ with its own accounts (`<ns>_core`, `<ns>_migrate`, `<ns>_audit_ops`, …). If you leave
323
+ `SHIELD_DB_NAMESPACE` unset, `<ns>` is `shield` (`shield_app`, …), which is unchanged from
324
+ earlier releases.
325
+ - **To run dev and beta on one MariaDB server**, give each environment its own namespace. It must
326
+ be lowercase letters and digits only (`beta`, `staging2`; no `_`). Then:
327
+ 1. Provision it with the framework's `db-provision --namespace beta` (from the astram-framework
328
+ repo, runbook §6). Use distinct passwords per namespace.
329
+ 2. Set `SHIELD_DB_NAMESPACE=beta` for both the server and `npm run migration:run`. The same
330
+ value must reach both.
331
+ 3. Run migrations (the ledger is `beta_app.schema_migrations`), then start the server.
332
+ - Defaults follow the namespace: `APP_DB_USER` ⇒ `<ns>_core`, `APP_DB_NAME` ⇒ `<ns>_identity`,
333
+ `DDL_DB_USER` ⇒ `<ns>_migrate`. Explicit values win.
334
+ - **Rules your app must follow:**
335
+ - `APP_DB_NAME` must be one of the four framework databases, even with the namespace unset.
336
+ Any other value refuses to boot.
337
+ - An invalid namespace refuses to boot and to migrate.
338
+ - Use a separate Redis (instance or DB index) per environment: Redis keys are not namespaced.
339
+ - Your own object types keep a literal `schema` or none. Do not hard-code `shield_*` names in
340
+ app SQL or migrations: read them from the injected `FRAMEWORK_SCHEMAS` (`@astram/guard`).
341
+ - **Boot check:** outside development/test (an unset `NODE_ENV` counts as production), the server
342
+ refuses to start when framework migrations are missing from the ledger, no ledger is found, or
343
+ the ledger is unreachable. Run `migration:run` before starting. With the namespace unset, the
344
+ server looks for the ledger in `DDL_DB_NAME`, its own `APP_DB_NAME`, then `shield_app`, so
345
+ `migration:run` with the server's `.env` is found. If your migrate job uses a different
346
+ `APP_DB_NAME`, set the same `DDL_DB_NAME` for migrate and the server.
347
+ - The `<ns>_backup` and `<ns>_monitor` accounts keep server-wide grants and can see every
348
+ namespace on the server.
349
+ - One database per account (some managed hosts) is NOT supported yet (needs the four databases).
350
+
320
351
  ## Migrations (`@astram/migrate`)
321
352
  - `migrate` / `migrate:revert` / `migrate:status` with the deploy-time DDL account (`DDL_DB_*`);
322
353
  the running app never holds DDL. Framework migrations merge with yours (`APP_MIGRATION_DIR`).
323
354
  - Numeric ordering, duplicate-id detection, a database lock so concurrent deploys never apply a
324
355
  migration twice (`APP_MIGRATION_LOCK_TIMEOUT`, default 120 s), and drift detection (a changed
325
356
  applied file is reported; `--strict` fails on it). Never edit a migration that already ran.
357
+ - Upgrade `@astram/migrate` together with `@astram/guard` and `@astram/identity`. The framework
358
+ migrations read the database names from the migrate context (`ctx.schemas`). An older migrate
359
+ works only while `SHIELD_DB_NAMESPACE` is unset, and stops with "upgrade @astram/migrate"
360
+ otherwise. On upgrade, `migrate:status --strict` reports the framework's rewritten migrations as
361
+ SUPERSEDED, not drift, and `migrate` updates their ledger rows without re-running them.
326
362
 
327
363
  ## Frontend (`@astram/frontend-core`, `@astram/sdk`, scaffolded `frontend/`)
328
364
  - `@astram/frontend-core`: auth, account, identity, audit, record-policy, share, cross-tenant and
@@ -353,5 +389,6 @@ upload(@Req() req: Record<string, unknown>) {
353
389
  - External identity providers (OIDC, SAML, LDAP, Entra ID, Cognito, Okta, Google Workspace) and
354
390
  WebAuthn ceremonies.
355
391
  - Tenant- or role-mandated MFA (MFA is enforced for users who enrolled a device).
392
+ - Single-database hosting (all framework tables in one database per account).
356
393
 
357
394
  If you need one of these, STOP and flag it in `.astram/guide/gaps.md` (Rule 4).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astram/guide",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "license": "MIT",
5
5
  "description": "Astram framework — the AI/dev GUIDE layer (ADR-0025). Ships the framework's hard rules + capabilities manifest as installed, upgrade-refreshed docs. A consumer app's CLAUDE.md references FRAMEWORK_RULES.md from this package; `npm update` replaces it wholesale so new rules arrive cleanly, while the app's own .astram/guide/ layer is never touched. This is the framework-owned FLOOR: an app rule may tighten it, never weaken it.",
6
6
  "type": "commonjs",