Skip to content

feat(analysis): add Work DAG analysis suite#32

Merged
flyingrobots merged 6 commits intomainfrom
feat/work-dag-analysis
Mar 4, 2026
Merged

feat(analysis): add Work DAG analysis suite#32
flyingrobots merged 6 commits intomainfrom
feat/work-dag-analysis

Conversation

@flyingrobots
Copy link
Owner

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 tracing
  • generate-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 comprehensive work.md analysis document
  • npm run graph:work — convenience script
  • 42 new tests covering all DagAnalysis functions with diamond, linear, empty, single-node, and isolated-node graphs

Design 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 in DagAnalysis.ts as pure functions.

Test plan

  • npm run build — clean TypeScript compilation
  • npm run lint — 0 errors, 0 warnings
  • npm run test:local — 787 tests pass (42 new)
  • npm run graph:work — generates SVGs + work.md in docs/work/
  • Spot-check SVG rendering and work.md content

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
@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Warning

Rate limit exceeded

@flyingrobots has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 705e5c98-3e1c-4c77-b5a2-268ed29b0479

📥 Commits

Reviewing files that changed from the base of the PR and between f1ec489 and 9dc96cf.

⛔ Files ignored due to path filters (1)
  • docs/assets/work-dag.svg is excluded by !**/*.svg
📒 Files selected for processing (8)
  • .github/workflows/ci.yml
  • .gitignore
  • CHANGELOG.md
  • CLAUDE.md
  • package.json
  • scripts/generate-work-dag.ts
  • src/domain/services/DagAnalysis.ts
  • test/unit/DagAnalysis.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/work-dag-analysis

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +118 to +119
for (const t of tasks) {
hoursMap.set(t.id, t.hours);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.
@flyingrobots
Copy link
Owner Author

Review Fixes

Codex P1 — DONE tasks inflated scheduling makespan (b9c33b8):
scheduleWorkers now treats DONE tasks as weight 0, matching computeCriticalPath semantics. Added regression test: DONE 8h + active 1h → makespan 1h, not 9h.

CI traceability job failure (d21e1cb):
Added fetch-depth: 0 and git identity config to the traceability workflow. Shallow clones lack commit objects needed by git-warp materialization.

✅ All addressed.

@flyingrobots
Copy link
Owner Author

@coderabbitai review please 🥕

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

@flyingrobots: On it! 🥕 Kicking off a fresh review of the PR now.


🧠 Learnings used
Learnt from: CR
Repo: flyingrobots/xyph PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-04T06:00:24.991Z
Learning: Use the WARP graph for all project planning and progress tracking via the `xyph-actuator.ts` CLI
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.
@flyingrobots flyingrobots merged commit fa85965 into main Mar 4, 2026
8 checks passed
@flyingrobots flyingrobots deleted the feat/work-dag-analysis branch March 4, 2026 11:06
flyingrobots added a commit that referenced this pull request Mar 4, 2026
- 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant