Skip to content

Build packages in dependency order in pnpm build#287

Merged
hackerwins merged 1 commit into
mainfrom
fix/build-dependency-order
May 24, 2026
Merged

Build packages in dependency order in pnpm build#287
hackerwins merged 1 commit into
mainfrom
fix/build-dependency-order

Conversation

@hackerwins

@hackerwins hackerwins commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

pnpm build failed with exit code 1: the slides and backend package
builds errored on missing exports.

slides:  @wafflebase/docs has no exported member 'detectUnit' / 'getGridConfig'
         / 'drawTicks' / 'RulerUnit' / 'GridConfig' / 'TickDensity'
backend: @wafflebase/slides has no exported member 'Guide';
         'guides' does not exist on type 'SlidesDocument'

Root cause — these symbols were added in #285 (slides ruler + guides) and
are correctly exported from source, but cross-package type resolution reads each
dependency's built dist/*.d.ts (gitignored, often stale), not its source. The
root build script (a) never built @wafflebase/docs at all, and (b) ran every
package build concurrently with no dependency ordering, so slides compiled
against docs' stale dist and backend against slides' stale dist.

Dependency graph:

docs    (leaf)
sheets  (leaf)
slides   -> docs
frontend -> docs, sheets, slides
backend  -> docs, sheets, slides
cli      -> docs, slides

Fix — build in topological order: (docs, sheets) -> slides -> (frontend, backend, cli), so every package compiles against freshly built
dependency declarations.

Test plan

  • rm -rf packages/*/dist && pnpm build → exit 0 (was exit 1 before, from a clean dist state)
  • pnpm verify:fast → exit 0 (792 tests pass)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Updated root build script execution sequence to optimize the build process
  • Documentation

    • Added new task documentation for build improvement
    • Updated task tracking and archive records

Review Change Stack

The root "build" script never built @wafflebase/docs and ran every
package build concurrently with no ordering. Since cross-package type
resolution reads each dependency's built dist/*.d.ts (gitignored, often
stale) rather than its source, consumers compiled against outdated
declarations: slides failed on missing docs ruler exports and backend
failed on the slides Guide/guides symbols added in #285.

Build in topological order instead: (docs, sheets) -> slides ->
(frontend, backend, cli), so every package compiles against freshly
built dependency declarations. Verified from a clean dist state.
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4df3885f-f284-4119-b71d-1319fea56074

📥 Commits

Reviewing files that changed from the base of the PR and between eb79963 and 82a69f5.

📒 Files selected for processing (4)
  • docs/tasks/README.md
  • docs/tasks/archive/2026/05/20260524-build-dependency-order-todo.md
  • docs/tasks/archive/README.md
  • package.json

📝 Walkthrough

Walkthrough

The PR documents and fixes a pnpm build failure caused by concurrent builds without respecting inter-package dependencies and stale type resolution. The root build script is reordered to enforce topological ordering, and a task document records the problem analysis and solution. Task indices are updated to reflect the resolved task and active work item.

Changes

Build Dependency Order Fix and Task Archival

Layer / File(s) Summary
Build script dependency ordering fix
package.json
The root build script is refactored from fully parallel execution to a staged approach: @wafflebase/docs and sheets sequentially, then slides, then frontend, backend, and cli in parallel, enforcing the topological build order required by package dependency relationships.
Build dependency order issue analysis and solution
docs/tasks/archive/2026/05/20260524-build-dependency-order-todo.md
Comprehensive task document explaining the root cause of the build failure (stale dist/*.d.ts type resolution from concurrent builds), the correct topological dependency graph, the new staged build command structure, and verification steps using a clean dist state and pnpm verify:fast.
Task index updates
docs/tasks/README.md, docs/tasks/archive/README.md
Active tasks index adds the "pptx shape blipfill (2026-05-23)" entry and updates archive metadata (202 → 203 total tasks, latest active task marker). Archive index increments the 2026/05 section count and registers the new "build dependency order (2026-05-24)" archived task.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • wafflebase/wafflebase#208: Updates task-index documentation (docs/tasks/README.md) by changing archived task counts and active-task table entries.
  • wafflebase/wafflebase#116: Updates the task indices and archive documentation with similar structural changes to active/archived task counts and latest task markers.

Poem

🐰 A mighty build now flows in order true,
With docs and sheets leading the way through,
Then slides take their turn, oh so neat,
While others race—concurrency complete!
The task is logged, the fix is sealed,
A broken build forever healed.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-dependency-order

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.

@hackerwins
hackerwins merged commit f5a5191 into main May 24, 2026
1 check passed
@hackerwins
hackerwins deleted the fix/build-dependency-order branch May 24, 2026 11:00
@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 166.4s

Lane Status Duration
sheets:build ✅ pass 9.8s
docs:build ✅ pass 9.8s
slides:build ✅ pass 11.0s
verify:fast ✅ pass 99.0s
frontend:build ✅ pass 15.2s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 3.9s
cli:build ✅ pass 1.6s
verify:entropy ✅ pass 15.8s

Verification: verify:integration

Result: ✅ PASS

@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

hackerwins added a commit that referenced this pull request May 24, 2026
The rebase auto-resolution overwrote the topological build order
introduced in #287 (concurrent docs+sheets, then slides, then
concurrent frontend+backend+cli) with the simpler all-concurrent
form this branch had branched from. Restore the topological flow
and keep `pnpm tokens build` as the first step so tokens compile
before any consumer that imports them.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@hackerwins hackerwins mentioned this pull request May 24, 2026
2 tasks
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