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.
52 lines
2.4 KiB
Markdown
52 lines
2.4 KiB
Markdown
---
|
|
id: add-missing-cascade-entries
|
|
name: Add missing FK cascade entries to table-reference.md
|
|
status: completed
|
|
depends_on: [resolve-sessions-accountid-cascade, resolve-audit-logs-ownerid-cascade, split-operations-into-definitions-and-registrations, add-call-graph-edges-indexes-cascades]
|
|
scope: moderate
|
|
risk: critical
|
|
impact: project
|
|
level: implementation
|
|
---
|
|
|
|
## Description
|
|
|
|
Five FK relationships are documented in per-domain docs but **absent** from the cascade reference table in `table-reference.md:53-83`:
|
|
|
|
| Missing Relationship | Source Doc |
|
|
|---|---|
|
|
| `mappings.workspaceId → workspaces.id` | coordination.md:19 |
|
|
| `detections.sessionId → sessions.id` | coordination.md:36 |
|
|
| `call_graph_edges.sourceId → call_graph_nodes.id` | call-graph.md:39 |
|
|
| `call_graph_edges.targetId → call_graph_nodes.id` | call-graph.md:41 |
|
|
| `api_keys.rotatedToId → api_keys.id` | identity.md:80 |
|
|
|
|
Without documented cascade behavior, PostgreSQL defaults to `RESTRICT`, which may not be the intended behavior for all of these.
|
|
|
|
This task depends on other cascade decisions being resolved first: C01 (sessions.accountId, audit_logs.ownerId), C03 (op specs cascade rationale), and C10 (call_graph_edges cascade behavior). Once those are stable, add all missing entries in a consistent pass.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] `mappings.workspaceId → workspaces.id` cascade is added to table-reference.md with explicit onDelete behavior and rationale
|
|
- [ ] `detections.sessionId → sessions.id` cascade is added with explicit onDelete behavior and rationale
|
|
- [ ] `call_graph_edges.sourceId → call_graph_nodes.id` cascade is added (CASCADE, as documented in call-graph.md)
|
|
- [ ] `call_graph_edges.targetId → call_graph_nodes.id` cascade is added (CASCADE, as documented in call-graph.md)
|
|
- [ ] `api_keys.rotatedToId → api_keys.id` cascade is added — review recommends SET NULL (old key keeps its data, rotation link broken if new key is deleted)
|
|
- [ ] All cascade entries include rationale column explaining the design decision
|
|
- [ ] No other FK relationships documented in per-domain docs are missing from the cascade table
|
|
|
|
## References
|
|
|
|
- docs/reviews/storage-architecture-review-2026-04-21.md#C14
|
|
- docs/architecture/storage/table-reference.md:53-83
|
|
- docs/architecture/storage/coordination.md:19,36
|
|
- docs/architecture/storage/call-graph.md:39,41
|
|
- docs/architecture/storage/identity.md:80
|
|
|
|
## Notes
|
|
|
|
> To be filled by implementation agent
|
|
|
|
## Summary
|
|
|
|
> To be filled on completion |