Setup repo: migrate architecture specs, code stubs, and tasks from alkhub_ts

Copy architecture docs, ADRs, storage domain specs, research, reviews,
and 56 storage architecture tasks from the alkhub_ts monorepo. Adapt for
standalone @alkdev/hub repo structure (src/ not packages/hub/).

Sanitize all sensitive information:
- Replace private IPs (10.0.0.1) with localhost defaults
- Remove internal server hostnames (dev1, ns528096)
- Replace /workspace/ private paths with npm package references
- Remove hardcoded credentials from examples
- Rewrite infrastructure.md without private network details

Add Deno project scaffolding: deno.json (pinned deps), .gitignore,
AGENTS.md, entry point. Migrate existing code stubs (crypto, config
types, logger) with updated import paths.
This commit is contained in:
2026-05-25 10:56:32 +00:00
parent 3e3f12d2d5
commit 2b63cda1c7
120 changed files with 11714 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
---
id: resolve-sessions-accountid-cascade
name: Resolve sessions.accountId NOT NULL + SET NULL contradiction
status: completed
depends_on: []
scope: narrow
risk: critical
impact: phase
level: implementation
---
## Description
`sessions.accountId` is declared `text NOT NULL` in `sessions.md:17` but has `onDelete: SET NULL` in `table-reference.md:80`. PostgreSQL will reject the DELETE because it cannot nullify a NOT NULL column. This is a foundational schema decision — the resolution determines whether sessions survive account deletion and affects downstream cascade work.
## Decision (D1)
**Make the column nullable** with `SET NULL` cascade. Orphaned sessions (account deleted) are still valuable data for audit and debugging. This follows the "live session data: nullable FK + SET NULL" cascade pattern.
## Acceptance Criteria
- [ ] `sessions.accountId` is declared `text` (nullable) in `sessions.md` with an explicit note explaining why
- [ ] `table-reference.md` cascade entry for `sessions.accountId → accounts.id` uses `SET NULL` and the column is documented as nullable
- [ ] No other doc references `sessions.accountId` as `NOT NULL` without acknowledging the nullable change
- [ ] The doc note explains the semantic: "orphaned sessions preserve conversation history for audit and debugging"
- [ ] Any downstream tasks that depend on this decision (e.g., resolve-org-dual-ownership) can proceed
## References
- docs/reviews/storage-architecture-review-2026-04-21.md#C01
- docs/decisions/storage-spec-phase1-resolutions.md#D1
- docs/architecture/storage/sessions.md:17
- docs/architecture/storage/table-reference.md:80
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion