feat(analysis): add Work DAG analysis suite#32
Conversation
Add DagAnalysis.ts with pure functions for DAG structure analysis: level assignment, DAG width, greedy worker scheduling, transitive reduction/closure, anti-chain decomposition, reverse reachability, and provenance tracing. Add generate-work-dag.ts script that uses the WARP graph API directly for data extraction and DagAnalysis/DepAnalysis functions for analysis. Generates SVG visualizations (all/per-campaign/backlog/graveyard in LR+TB orientations) and a comprehensive work.md analysis document. - 42 new tests across all DagAnalysis functions - `npm run graph:work` script added to package.json
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The docs/work/ directory contains SVGs and analysis docs generated by `npm run graph:work`. These are regenerated on demand and should not be tracked.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ceb3de4d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/domain/services/DagAnalysis.ts
Outdated
| for (const t of tasks) { | ||
| hoursMap.set(t.id, t.hours); |
There was a problem hiding this comment.
Exclude completed tasks from worker scheduling
scheduleWorkers records full t.hours for every task and then schedules every sorted node with that duration, regardless of status. In this commit, generate-work-dag.ts passes all task summaries (including DONE) into this function, so already-completed prerequisites still consume simulated worker time and inflate makespan/utilization (for example, a DONE 8h prerequisite plus one 1h active task is reported as 9h). That makes the work-planning numbers in work.md materially inaccurate whenever the graph contains completed tasks.
Useful? React with 👍 / 👎.
scheduleWorkers was using full t.hours for DONE tasks, inflating makespan and utilization numbers in work.md. Now matches the pattern used by computeCriticalPath: DONE tasks weigh 0. Addresses Codex review P1 on PR #32.
actions/checkout@v4 defaults to fetch-depth: 1 (shallow clone). git-warp materialization walks commit parent chains that don't exist in shallow clones, causing exit code 128. Also requires a committer identity for auto-checkpoint commits. Adds fetch-depth: 0 and local git identity config.
Review FixesCodex P1 — DONE tasks inflated scheduling makespan (b9c33b8): CI traceability job failure (d21e1cb): ✅ All addressed. |
|
@coderabbitai review please 🥕 |
|
🧠 Learnings used✅ Actions performedReview triggered.
|
git-warp's traversal API should be the sole source of graph algorithms. If a needed primitive is missing, request it upstream rather than reimplementing on flat arrays that assume the full DAG fits in memory.
- Replace userland Kahn's topo sort with graph.traverse.topologicalSort() (P1-01) - Remove unused reverseReachability import (P2-01) - Remove dead allNodes set in computeProvenance (P2-02) - Replace non-null assertions with guard patterns (P3-01/02/04) - Extract DEFAULT_COLORS constant to eliminate redundant assertion (P3-03) - Remove 237KB SVG from tracking, add docs/assets/*.svg to .gitignore (P4-01)
Summary
DagAnalysis.ts— 8 pure functions for DAG structure analysis: level assignment, DAG width, greedy worker scheduling, transitive reduction/closure, anti-chain decomposition, reverse reachability, and provenance tracinggenerate-work-dag.ts— generator script that uses the WARP graph API directly for data extraction, produces SVG visualizations (all/per-campaign/backlog/graveyard in LR+TB orientations) and a comprehensivework.mdanalysis documentnpm run graph:work— convenience scriptDesign Decision
The WARP graph already provides native traversal primitives (topo sort, BFS, DFS, reachability, commonAncestors). Rather than wrapping these in a redundant abstraction layer, the generator script calls
graph.traverse.*directly. Only genuinely new domain algorithms (scheduling, width, reduction, closure, anti-chains, reachability, provenance, levels) live inDagAnalysis.tsas pure functions.Test plan
npm run build— clean TypeScript compilationnpm run lint— 0 errors, 0 warningsnpm run test:local— 787 tests pass (42 new)npm run graph:work— generates SVGs + work.md indocs/work/