Files
hub/tasks/architecture/storage/document-mappings-task-denorm-invariant.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

1.6 KiB

id, name, status, depends_on, scope, risk, impact, level
id name status depends_on scope risk impact level
document-mappings-task-denorm-invariant Document mappings.task denormalization sync strategy completed
narrow medium component implementation

Description

The mappings table has both taskId (FK → tasks.id) and task (denormalized display name). No mechanism keeps them in sync. If taskId points to a task whose slug or name changes, mappings.task becomes stale. When taskId is SET NULL (task deleted), what happens to task?

The review recommends documenting the invariant: "mappings.task is set to tasks.slug at insert time and is not automatically updated when the task's slug changes. When taskId is SET NULL (task deleted), task should also be SET NULL. This is a cache, not a source of truth." Alternatively, remove the denormalized column and use a VIEW that joins.

Acceptance Criteria

  • coordination.md documents the invariant for mappings.task: it is a cache of tasks.slug, set at insert time, not auto-updated
  • The behavior when taskId is SET NULL is documented: task should also be SET NULL (application-level or trigger)
  • If keeping the column: add a note that stale task values are acceptable (cache semantics)
  • If removing the column: replace with a VIEW definition and update coordination.md
  • tasks.md:209 reference to mappings.task is updated to be consistent

References

  • docs/reviews/storage-architecture-review-2026-04-21.md#C06
  • docs/architecture/storage/coordination.md:22
  • docs/architecture/storage/tasks.md:209

Notes

To be filled by implementation agent

Summary

To be filled on completion