Skip to content

chore: clean up bun dev startup warnings - #30

Merged
HusseinBaraja merged 6 commits into
mainfrom
chore/dev-warning-cleanup
Apr 4, 2026
Merged

chore: clean up bun dev startup warnings#30
HusseinBaraja merged 6 commits into
mainfrom
chore/dev-warning-cleanup

Conversation

@HusseinBaraja

@HusseinBaraja HusseinBaraja commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • removes deprecated Turbo --parallel usage from the root dev scripts
  • fixes api and worker dev watch roots so shared workspace edits trigger restarts
  • documents how to interpret the Baileys initial-sync warning without suppressing it

Validation

  • bun test ./scripts/root-package.test.ts
  • bun check
  • bun dev
  • manual shared-file hot-reload smoke test via root dev:api

Notes

  • repo-owned startup warnings fixed: Turbo deprecation and Bun watch-root warnings
  • bun dev on this machine still shows environment/runtime noise such as occupied ports and normal Baileys startup logs

Out of scope

  • WhatsApp session conflict error: conflict type="replaced"

Summary by CodeRabbit

  • Documentation

    • Clarified workspace watch behavior and guidance on a benign bot startup log in development docs.
  • Chores

    • Standardized dev run scripts across apps and removed parallelized fanout.
    • Added cross-platform watcher scripts to run dev from the repo root.
    • Updated ignore rules to include additional Bun lockfiles.
  • Tests

    • Adjusted conventions and tests to validate the new watcher invocation.

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1347eb5b-be42-456d-b75e-f328a4611e4d

📥 Commits

Reviewing files that changed from the base of the PR and between 3b14659 and 13d0120.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • .gitignore
📜 Recent review details
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run all repo scripts from the repository root with `bun`
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: After each mini-step, run the applicable repo-root `bun` commands before committing
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run `bun dev` after code changes
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run `bun dev` after code changes

Applied to files:

  • .gitignore
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run all repo scripts from the repository root with `bun`

Applied to files:

  • .gitignore
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: `bun check` must pass before considering general code tasks complete

Applied to files:

  • .gitignore
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: After each mini-step, run the applicable repo-root `bun` commands before committing

Applied to files:

  • .gitignore
🔇 Additional comments (1)
.gitignore (1)

3-3: Good addition for Bun lockfile hygiene.

Ignoring bun.lock aligns with the PR’s lockfile tracking cleanup and helps prevent noisy accidental commits.


📝 Walkthrough

Walkthrough

Replace direct Bun --watch calls in workspace dev scripts with a repository-root watcher (TS + PowerShell) that runs Bun with --cwd and --env-file; remove --parallel from root turbo dev commands; update tests and docs to reflect watcher use and Baileys log guidance.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Added two checklist items: warn that running bun --watch from apps/api or apps/worker won't watch sibling workspace imports (advise running Bun from repo root via --cwd), and clarify acceptable Baileys AwaitingInitialSync startup log when bot reaches state: "open"; do not suppress via fragile log filtering.
Workspace dev scripts
apps/api/package.json, apps/worker/package.json
Switched dev scripts from bun --env-file=../../.env --watch src/index.ts to bun ../../scripts/watch-from-root.ts src/index.ts (delegate watch and env-file handling to watcher).
Root orchestration
package.json
Removed --parallel from dev and dev:bot turbo run commands.
Watcher implementation
scripts/watch-from-root.ts, scripts/watch-from-root.ps1
Added TypeScript and PowerShell watcher scripts that validate and resolve entry paths, determine repo root, and spawn Bun with --cwd=<repoRoot> --env-file=<repoRoot>/.env --watch <entry>, forwarding IO and exit codes.
Tests
scripts/root-package.test.ts
Updated expected root script strings (no --parallel), added assertion that scripts/watch-from-root.ps1 contains the path-resolution sequence, and validated api/worker dev scripts use the watcher invocation.
Repo config
.gitignore
Added bun.lock and bun.lockb to ignored files.

Sequence Diagram(s)

sequenceDiagram
    participant DevCLI as Developer CLI
    participant WatchTS as watch-from-root.ts
    participant BunChild as Bun (child)
    participant RepoFS as Repository FS

    DevCLI->>WatchTS: bun ../../scripts/watch-from-root.ts src/index.ts
    WatchTS->>RepoFS: resolve script dir -> determine repo root
    WatchTS->>RepoFS: validate & resolve EntryPath (src/index.ts)
    WatchTS->>BunChild: spawn bun --cwd=<repoRoot> --env-file=<repoRoot>/.env --watch <entry>
    BunChild->>RepoFS: read .env and workspace files
    Note right of BunChild: On file change -> Bun restarts/updates
    BunChild-->>WatchTS: exit / error code
    WatchTS-->>DevCLI: exit with Bun's exit code
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped from app to root with nimble paws,
Watched paths and envs to fix the dev-time laws,
No parallel scurries, one tidy start,
Bun listens from the root — a steady heart.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main objective: removing Bun dev startup warnings through script cleanup and documentation updates across multiple configuration files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/dev-warning-cleanup

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/worker/package.json`:
- Line 7: The dev script in package.json currently shells out to a PowerShell
wrapper (watch-from-root.ps1) which prevents non-Windows contributors from
running it; replace that with a cross-platform invocation that runs the same bun
--watch behavior without PowerShell. Update the "dev" script to call bun --watch
(or a small Node/posix shell wrapper) with correct path resolution to the repo
root instead of using watch-from-root.ps1, and remove the PowerShell dependency;
look for the "dev" script entry in package.json and the helper script
watch-from-root.ps1 to replicate its path-resolution logic in a shell/Node
approach so linux/mac users can run the dev script.

In `@scripts/watch-from-root.ps1`:
- Line 7: The script currently calls Resolve-Path on $EntryPath which will throw
a terminating error if the path does not exist; add an explicit existence check
using Test-Path on $EntryPath before calling Resolve-Path, and if it returns
false emit a clear error via Write-Error or Write-Host with a descriptive
message and exit/return (so $resolvedEntry is never assigned from a failing
Resolve-Path); then only call $resolvedEntry = (Resolve-Path $EntryPath).Path
when the Test-Path check succeeds to provide deterministic, user-friendly error
handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 132233cb-07d7-4926-bb93-e9a6d1ad0d0f

📥 Commits

Reviewing files that changed from the base of the PR and between 1e94fa9 and e018e8f.

📒 Files selected for processing (6)
  • AGENTS.md
  • apps/api/package.json
  • apps/worker/package.json
  • package.json
  • scripts/root-package.test.ts
  • scripts/watch-from-root.ps1
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use the @cs/* path aliases from tsconfig.base.json for cross-package imports

Files:

  • scripts/root-package.test.ts
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: After each mini-step, run the applicable repo-root `bun` commands before committing
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run all repo scripts from the repository root with `bun`
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run `bun dev` after code changes

Applied to files:

  • apps/api/package.json
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Run all repo scripts from the repository root with `bun`

Applied to files:

  • scripts/watch-from-root.ps1
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: After each mini-step, run the applicable repo-root `bun` commands before committing

Applied to files:

  • scripts/watch-from-root.ps1
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: If you encounter something surprising, tell the developer and add it to this file so future agents do not repeat the same mistake

Applied to files:

  • AGENTS.md
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Applies to convex/**/*.ts : Convex runtime files must not import the broad `cs/ai` barrel. In Convex runtime code, import the specific `packages/ai/src/*` module you need instead

Applied to files:

  • AGENTS.md
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Applies to convex/tsconfig.json : Convex package typecheck uses `convex/tsconfig.json`, not just `tsconfig.base.json`. When adding a safe Convex `cs/ai/*` subpath alias, mirror it in `convex/tsconfig.json` or `bun check` will fail in `cs/convex`

Applied to files:

  • AGENTS.md
📚 Learning: 2026-04-01T13:22:06.563Z
Learnt from: CR
Repo: HusseinBaraja/CS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-01T13:22:06.563Z
Learning: Applies to convex/schema.ts : Run `bun generate` after any Convex schema change

Applied to files:

  • AGENTS.md
🔇 Additional comments (6)
scripts/watch-from-root.ps1 (1)

1-11: Script logic is correct for the intended purpose.

The script properly:

  • Resolves the repo root relative to the script location
  • Converts the entry path to absolute (required since --cwd changes the working directory)
  • Passes the .env file and enables watch mode
  • Propagates bun's exit code

This addresses the limitation where bun --watch inside workspace apps doesn't observe changes in sibling packages/* directories.

apps/api/package.json (1)

7-7: Consistent with apps/worker/package.json change.

The same PowerShell wrapper approach is applied here. The cross-platform concern raised for apps/worker/package.json applies equally to this file.

scripts/root-package.test.ts (2)

30-30: Test expectations correctly updated for --parallel removal.

The assertions now match the updated root package.json scripts without the deprecated --parallel flag.

Also applies to: 33-33


84-84: Test coverage added for new PowerShell watcher scripts.

The assertions verify that api and worker dev scripts invoke the new watch-from-root.ps1 script with the correct entry path.

Also applies to: 93-93

package.json (1)

12-12: Correct removal of deprecated --parallel flag.

In Turbo 2.x, tasks without dependsOn already run concurrently by default. The turbo.json shows the dev task has no dependencies, so removing --parallel eliminates the deprecation warning without changing runtime behavior.

Also applies to: 15-15

AGENTS.md (1)

63-64: Useful documentation of known behaviors and workarounds.

Line 63 clearly explains the bun --watch workspace limitation that motivated the PowerShell wrapper changes. Line 64 provides actionable triage guidance for a common Baileys startup warning, distinguishing it from actual errors.

Comment thread apps/worker/package.json Outdated
Comment thread scripts/watch-from-root.ps1
@HusseinBaraja
HusseinBaraja merged commit 71856ca into main Apr 4, 2026
1 check passed
@HusseinBaraja
HusseinBaraja deleted the chore/dev-warning-cleanup branch April 4, 2026 11:45
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