Files
hub/tasks/architecture/storage/add-caller-account-id.md
glm-5.1 2b63cda1c7 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.
2026-05-25 10:56:32 +00:00

36 lines
1.2 KiB
Markdown

---
id: add-caller-account-id
name: Add callerAccountId to Call Graph Nodes
status: completed
depends_on: []
scope: narrow
risk: low
impact: component
level: implementation
---
## Description
W19: `call_graph_nodes.identity` stores `{ id, scopes, resources }` as a JSONB snapshot, but there's no FK to `accounts.id`. Querying "all calls made by account X" requires JSONB containment, which is slow without a GIN index.
Add a `callerAccountId` text column with FK → accounts.id (SET NULL) for efficient querying, or add a GIN index on `identity` if JSONB queries are the intended access pattern.
## Acceptance Criteria
- [ ] `call-graph.md` adds `callerAccountId` column (text, nullable, FK → accounts.id, ON DELETE SET NULL), OR
- [ ] Alternative documented: GIN index on `identity` column with justification
- [ ] If `callerAccountId` added: `table-reference.md` cascade table updated with the new FK
- [ ] Query pattern documented: "all calls by account X" uses `callerAccountId`
## References
- docs/reviews/storage-architecture-review-2026-04-21.md#W19
- docs/architecture/storage/call-graph.md:20
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion