Skip to content

chore(ci): faster localdev iteration#3767

Open
404Wolf wants to merge 2 commits into
mainfrom
wolf/rebuild-and-swap
Open

chore(ci): faster localdev iteration#3767
404Wolf wants to merge 2 commits into
mainfrom
wolf/rebuild-and-swap

Conversation

@404Wolf

@404Wolf 404Wolf commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Add a just command to rebuild + swap the binary so you don't have to totally rebuild the container. Also make vite / redirect to /app

Note that we are doing all the builds in a "builder" container so that we know that they can run in our containers (e.g. I use nix, my nix binaries will not run in our not nix containers)

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 99fbe3ae-d9b2-4279-90a9-ec76e66cf5b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR enables hot-reload development workflows by establishing Docker Compose infrastructure for incremental service rebuilds and adding frontend routing configuration. The docker-compose.yml updates mount source directories and introduce a persistent rust-builder service with Cargo caching. A new Vite proxy configuration routes frontend root-path requests. A just dev-rebuild recipe orchestrates rebuilds by performing incremental compilation in either the target container or builder container, copying binaries, and restarting services.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore(ci): faster localdev iteration' follows conventional commits format with a 'chore' prefix and is 36 characters, well under the 72-character limit.
Description check ✅ Passed The description accurately describes the changeset: adding a just command for faster rebuilds and hot-swapping, modifying vite configuration, and using a builder container for consistent builds.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

@404Wolf 404Wolf requested a review from synoet June 4, 2026 16:01

@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: 1

🧹 Nitpick comments (1)
docker-compose.yml (1)

414-414: ⚡ Quick win

Pin the Rust image used by rust-builder (and other rust:latest Dockerfiles) to a fixed tag instead of rust:latest.

docker-compose.yml uses rust:latest for the persistent rust-builder container, and just dev-rebuild runs cargo build inside that long-lived container—so a moving tag can make dev rebuilds non-deterministic across time/machines. rust/cloud-storage/** also contains multiple FROM rust:latest ... Dockerfiles.

rust-builder:
  image: rust:latest

Align the tag with rust/rust-toolchain.toml (channel = "1.94.0"), e.g. rust:1.94.0 (or the repo’s preferred variant).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker-compose.yml` at line 414, Replace the floating rust:latest image
references with a fixed Rust toolchain tag to ensure deterministic builds:
update the docker-compose service named rust-builder to use rust:1.94.0 (or the
exact channel in rust/rust-toolchain.toml) and update any Dockerfiles under
rust/cloud-storage that use FROM rust:latest to the same pinned tag; ensure the
chosen tag matches the channel value in rust/rust-toolchain.toml so both the
long-lived rust-builder container and all Dockerfiles use the identical pinned
Rust image.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@js/app/packages/app/vite.base.ts`:
- Around line 189-192: The proxy target for the root route '^/$' is hardcoded to
http://localhost:3000 while server.port is derived from Number(process.env.PORT
|| 3000); update the proxy config so it uses the same port value instead of
3000. Replace the literal target string in the proxy entry (the '^/$' mapping)
to construct the host using the server port value (from process.env.PORT or the
server.port variable) so that requests forwarded by the proxy go to the actual
configured port.

---

Nitpick comments:
In `@docker-compose.yml`:
- Line 414: Replace the floating rust:latest image references with a fixed Rust
toolchain tag to ensure deterministic builds: update the docker-compose service
named rust-builder to use rust:1.94.0 (or the exact channel in
rust/rust-toolchain.toml) and update any Dockerfiles under rust/cloud-storage
that use FROM rust:latest to the same pinned tag; ensure the chosen tag matches
the channel value in rust/rust-toolchain.toml so both the long-lived
rust-builder container and all Dockerfiles use the identical pinned Rust image.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a167fd09-01b6-4016-a0f4-0312639463f9

📥 Commits

Reviewing files that changed from the base of the PR and between dc52c92 and 83cf4a3.

📒 Files selected for processing (3)
  • docker-compose.yml
  • js/app/packages/app/vite.base.ts
  • justfile

Comment on lines +189 to +192
proxy: {
// always redirect root to /app
'^/$': { target: 'http://localhost:3000', rewrite: () => '/app' },
},

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="js/app/packages/app/vite.base.ts"

echo "== File exists? =="
ls -la "$FILE"

echo
echo "== Relevant line range (around 160-220) =="
nl -ba "$FILE" | sed -n '160,220p'

echo
echo "== Find PORT usage in file =="
rg -n "PORT" "$FILE" || true

echo
echo "== Find proxy configuration in file =="
rg -n "proxy|rewrite|target" "$FILE"

Repository: macro-inc/macro

Length of output: 266


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="js/app/packages/app/vite.base.ts"

echo "== Relevant line range (160-220) =="
cat -n "$FILE" | sed -n '160,220p'

echo
echo "== PORT usage in file =="
rg -n "PORT" "$FILE" || true

echo
echo "== proxy/rewrite/target usage in file =="
rg -n "(proxy|rewrite|target)" "$FILE"

Repository: macro-inc/macro

Length of output: 2457


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="js/app/packages/app/vite.base.ts"

echo "== Lines around NO_MINIFY =="
rg -n "NO_MINIFY" "$FILE"
echo
# show a window around first occurrence
LINE=$(rg -n "NO_MINIFY" "$FILE" | head -n1 | cut -d: -f1)
START=$((LINE-20))
END=$((LINE+20))
sed -n "${START},${END}p" "$FILE" | cat -n

echo
echo "== Show proxy block context =="
# show around the proxy '^/$' line
PROXYLINE=$(rg -n "'\\^/\\$':|\\^/\\$" "$FILE" | head -n1 | cut -d: -f1)
START=$((PROXYLINE-15))
END=$((PROXYLINE+15))
sed -n "${START},${END}p" "$FILE" | cat -n

Repository: macro-inc/macro

Length of output: 2739


Root proxy hardcodes 3000 despite PORT override
js/app/packages/app/vite.base.ts sets server.port from Number(process.env.PORT || 3000), but the '^/$' proxy target is hardcoded to http://localhost:3000, so / forwards to the wrong port when PORT != 3000.

Suggested fix
@@
-    const NO_MINIFY = process.env.NO_MINIFY === 'true';
+    const NO_MINIFY = process.env.NO_MINIFY === 'true';
+    const DEV_PORT = Number(process.env.PORT || 3000);
@@
-        port: Number(process.env.PORT || 3000),
+        port: DEV_PORT,
@@
-          '^/$': { target: 'http://localhost:3000', rewrite: () => '/app' },
+          '^/$': { target: `http://localhost:${DEV_PORT}`, rewrite: () => '/app' },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@js/app/packages/app/vite.base.ts` around lines 189 - 192, The proxy target
for the root route '^/$' is hardcoded to http://localhost:3000 while server.port
is derived from Number(process.env.PORT || 3000); update the proxy config so it
uses the same port value instead of 3000. Replace the literal target string in
the proxy entry (the '^/$' mapping) to construct the host using the server port
value (from process.env.PORT or the server.port variable) so that requests
forwarded by the proxy go to the actual configured port.

Comment thread justfile
#!/usr/bin/env bash
set -euo pipefail

container="macro-{{ service }}-1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this always the container name or will this depend on what worktree/workspace you are in?

Comment thread docker-compose.yml
auth:
external: true

volumes:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we make this volume external so it can be used across workspaces/worktrees to improve shared caching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants