Files
hub/tasks/architecture/storage/add-partial-indexes.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

2.0 KiB

id, name, status, depends_on, scope, risk, impact, level
id name status depends_on scope risk impact level
add-partial-indexes Add Partial Indexes and Call Graph Index Improvements completed
add-missing-indexes-identity
add-missing-indexes-observability
add-missing-indexes-sessions
narrow low component implementation

Description

Four related index/constraint improvements across different domains:

  1. S02: Add partial indexes for common access patterns — active API keys (WHERE revoked_at IS NULL AND enabled = true), connected spokes (WHERE status = 'connected'), non-archived sessions, active tasks (WHERE status IN ('pending', 'in-progress', 'blocked')).

  2. S04: Add accounts.displayName index for user search/autocomplete UIs. Without it, user search requires full table scans.

  3. S17: Add call_graph_nodes.startedAt index alongside or instead of createdAt for p99 latency analysis queries.

  4. S18: Add unique constraint on call_graph_edges(sourceId, targetId, edgeType) to prevent duplicate edges from retries/reconnections.

Acceptance Criteria

  • Partial indexes defined in table-reference.md for: active API keys, connected spokes, non-archived sessions, active tasks
  • displayName index added to accounts table in identity.md and table-reference.md
  • startedAt index added to call_graph_nodes in call-graph.md and table-reference.md
  • Unique constraint on (sourceId, targetId, edgeType) added to call_graph_edges in call-graph.md and table-reference.md
  • All indexes documented with WHERE clauses/purpose in per-domain docs

References

  • docs/reviews/storage-architecture-review-2026-04-21.md#S02
  • docs/reviews/storage-architecture-review-2026-04-21.md#S04
  • docs/reviews/storage-architecture-review-2026-04-21.md#S17
  • docs/reviews/storage-architecture-review-2026-04-21.md#S18
  • docs/architecture/storage/table-reference.md
  • docs/architecture/storage/identity.md
  • docs/architecture/storage/call-graph.md

Notes

To be filled by implementation agent

Summary

To be filled on completion