Skip to content

Critical-path ordering (sub-project 2): agreed deferrals from the final branch review #51

Description

@vnovick

Sub-project 2 (graph-aware dispatch ordering, cycle detection, escalation — spec: `docs/superpowers/specs/2026-08-04-critical-path-ordering-design.md`) shipped with these items explicitly deferred at final review. None block merge; measured tick cost at 500 issues / 2000 edges is ~4.9ms.

Performance / structure

  • `kahnTopoOrder` sorts its queue per-enqueue — O(V² log V) worst case vs the intended O(V+E)+sorts. Immaterial at tick scale (measured); revisit if candidate sets grow into the thousands.
  • Tarjan runs twice per tick (once in `ComputeGraphMetrics`, once in `ExtractCycles`) and metrics compute even in `ordering: simple` mode where the sort ignores them. Fusing is a small refactor.

Semantics notes (self-consistent, deliberate)

  • `DependencyAttention` derives from the previous tick's `DependencyAudit` (one-tick lag, self-correcting).
  • Cycle `DetectedAt` re-stamps on daemon restart (derived state, per spec); operator-visible cycle age resets.
  • The audit-row Identifier index in `DeriveDependencyAttention` has a fallback to the raw map key for empty-Identifier rows — reachable only from hand-built fixtures; a within-pass duplicate row during ID-key migration could pick a one-tick-stale BlockedSince (read-only, self-correcting).

Cosmetic

  • `cycleKindFromSet` default branch labels a malformed kind-set "tracker" instead of failing loudly (unreachable via `BuildTickGraph`).
  • `copyDependencyCycles`/`copyDependencyAttention` return nil for nil where map siblings return empty maps.
  • Issue-detail attention badge uses one severity for both kinds; LiveOps tile differentiates.
  • Deps legend cycle swatch always visible (matches existing legend convention).
  • Heartbeat renders `Cycles:`/`Attention:` as two conditional lines and sources blocked-count from snapshot rows rather than literally "the tick graph" — spec wording drift, semantics satisfied.

Test-shape lesson (recorded for future reviews)

Both this sub-project and the previous one had their sole production-fatal bug hidden by unit fixtures hand-built in a shape production never produces (here: `DependencyAudit` keyed by Identifier in fixtures vs `issue.ID` in production). The fix's regression test now drives the real `auditIssueDependencies` write path with `ID != Identifier`. New tests around orchestrator state should prefer production write paths over hand-keyed maps.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions