Skip to content

fix(build): repoint Makefile at the live checkout - #473

Merged
TinDang97 merged 1 commit into
mainfrom
fix/makefile-stale-repo-path
Aug 13, 2026
Merged

fix(build): repoint Makefile at the live checkout#473
TinDang97 merged 1 commit into
mainfrom
fix/makefile-stale-repo-path

Conversation

@TinDang97

@TinDang97 TinDang97 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

REPO pointed at /Users/tindang/workspaces/tind-repo/moon — the stale second checkout CLAUDE.md warns about, at #126 (hash-ttl era) while main is at #472. Every target built, tested and ran ~350 PRs of the wrong code. The dangerous one is make ci: it advertises CI parity and would report green against a tree nobody is shipping.

Fixes

  • REPO/Volumes/Games/tindang-repo/moon, with a comment naming the stale path so it doesn't get "restored".
  • CARGO_TARGET_DIR=target-linux on every cargo target — the VM and host compile the same shared checkout, so without it Linux ELF artifacts clobber the macOS Mach-O ones (required by CLAUDE.md). Declared as export … && rather than a bare VAR=x prefix, which would only apply to the first command of each chain — make ci and make clippy each run two cargo invocations.
  • pkill -x moonpkill -f "$(REPO)/target-linux/release/moon" — matching by bare process name kills any process named moon, not just the one this Makefile built.

Verified

  • make fmt runs clean end-to-end in the moon-dev VM against the live checkout.
  • make -n ci shows the export surviving the full && chain.

No src/ changes; dev tooling only.

Summary by CodeRabbit

  • Chores
    • Updated build, test, lint, formatting, and CI workflows to use a consistent Linux-specific build environment.
    • Improved local server start and stop commands for more reliable process management.
    • Aligned development tooling with the current Moon checkout for smoother builds and checks.

REPO pointed at /Users/tindang/workspaces/tind-repo/moon — the stale second
checkout CLAUDE.md warns about, sitting at #126 (hash-ttl era) while main is
at #472. Every target built, tested and ran ~350 PRs of the wrong code. The
dangerous one is `make ci`, which advertises CI parity and would report green
against a tree nobody is shipping.

Three fixes:

- REPO -> /Volumes/Games/tindang-repo/moon, with a comment naming the stale
  path so the next person does not "restore" it.
- CARGO_TARGET_DIR=target-linux on every cargo target. The VM and the host
  compile the same shared checkout, so without this the Linux ELF artifacts
  clobber the macOS Mach-O ones (CLAUDE.md requires it). Declared with
  `export ... &&` rather than a bare VAR=x prefix, which would only have
  applied to the first command of each `&&` chain — `make ci` and `make clippy`
  each run two cargo invocations.
- `pkill -x moon` -> `pkill -f "$(REPO)/target-linux/release/moon"`. Matching
  by bare process name kills any process called `moon`, not just the one this
  Makefile built.

Verified: `make fmt` runs clean end-to-end in the moon-dev VM against the live
checkout; `make -n ci` shows the export surviving the full && chain.

author: Tin Dang
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Makefile now exports CARGO_TARGET_DIR=target-linux, applies it to build and validation commands, and uses target-linux/release/moon with repository-scoped process matching for server commands.

Changes

Linux target isolation

Layer / File(s) Summary
Cargo target configuration
Makefile
The Makefile points REPO to the live Moon checkout and exports CARGO_TARGET_DIR=target-linux. Build, check, lint, format, and test recipes use this target directory.
Server and CI command updates
Makefile
Server recipes use target-linux/release/moon and repository-path process matching. CI applies the Linux target directory to formatting, lint, and test commands.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: 🟡 Moderate · up to 07022

The updated development commands may fail to stop the server they previously launched, leaving stale processes running and causing subsequent starts to fail when ports are already occupied. The executable path should be defined once and used consistently for both launching and stopping before merge.

Possibly related PRs

  • pilotspace/moon#376: Updates integration-test harnesses to standardize the target/release/moon binary path.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary Makefile change: switching it to the live checkout.
Description check ✅ Passed The description explains the changes and verification, but it omits the template checklist and an explicit Performance Impact section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/makefile-stale-repo-path

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@Makefile`:
- Around line 59-68: Update the start, start-bg, start-ephemeral, and stop
targets to define and use one absolute runtime MOON_BIN path for both launching
and process matching. Anchor the pkill pattern to the executable command at the
beginning, construct it from MOON_BIN so the wrapper shell is not matched, and
invoke the binary through the same absolute value in every start target.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a14492fa-fbfb-4300-bdb8-cf4113806776

📥 Commits

Reviewing files that changed from the base of the PR and between 292269a and 07022c3.

📒 Files selected for processing (1)
  • Makefile

Comment thread Makefile
Comment on lines +59 to +68
$(ORB) '$(CARGO_ENV) && cd $(REPO) && pkill -f "$(REPO)/target-linux/release/moon" 2>/dev/null; sleep 0.5; mkdir -p $(DATA_DIR) && ./target-linux/release/moon --port $(PORT) --shards $(SHARDS) --admin-port $(ADMIN_PORT) $(PERSIST_ARGS) $(EXTRA_ARGS)'

start-bg: build
$(ORB) '$(CARGO_ENV) && cd $(REPO) && pkill -x moon 2>/dev/null; sleep 0.5; mkdir -p $(DATA_DIR) && nohup ./target/release/moon --port $(PORT) --shards $(SHARDS) --admin-port $(ADMIN_PORT) $(PERSIST_ARGS) $(EXTRA_ARGS) &>/tmp/moon.log & echo "Moon started (PID $$!), log: /tmp/moon.log"'
$(ORB) '$(CARGO_ENV) && cd $(REPO) && pkill -f "$(REPO)/target-linux/release/moon" 2>/dev/null; sleep 0.5; mkdir -p $(DATA_DIR) && nohup ./target-linux/release/moon --port $(PORT) --shards $(SHARDS) --admin-port $(ADMIN_PORT) $(PERSIST_ARGS) $(EXTRA_ARGS) &>/tmp/moon.log & echo "Moon started (PID $$!), log: /tmp/moon.log"'

start-ephemeral: build
$(ORB) '$(CARGO_ENV) && cd $(REPO) && pkill -x moon 2>/dev/null; sleep 0.5; ./target/release/moon --port $(PORT) --shards $(SHARDS) --admin-port $(ADMIN_PORT) $(EXTRA_ARGS)'
$(ORB) '$(CARGO_ENV) && cd $(REPO) && pkill -f "$(REPO)/target-linux/release/moon" 2>/dev/null; sleep 0.5; ./target-linux/release/moon --port $(PORT) --shards $(SHARDS) --admin-port $(ADMIN_PORT) $(EXTRA_ARGS)'

stop:
$(ORB) 'pkill -x moon 2>/dev/null && echo "Moon stopped" || echo "Moon not running"'
$(ORB) 'pkill -f "$(REPO)/target-linux/release/moon" 2>/dev/null && echo "Moon stopped" || echo "Moon not running"'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Make the process match use the same executable path as the launch.

pkill -f matches the full command line. The server is launched as ./target-linux/release/moon, but the match uses /Volumes/Games/tindang-repo/moon/target-linux/release/moon. The existing server is therefore not reliably matched. start* can leave the old process running and then fail to bind its ports. stop can report the wrong state.

Use one absolute runtime MOON_BIN value for both matching and launching. Anchor the match. Construct the pattern at runtime, or compare /proc/<pid>/exe, so the wrapper shell is not matched by its own command text.

Based on the supplied Makefile: the termination pattern and launch command use different path forms.

Safer command shape
bin="/Volumes/Games/tindang-repo/moon/target-linux/release/moon"
pkill -f -- "^${bin}([[:space:]]|$)" 2>/dev/null || true
"${bin}" ...
🤖 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 `@Makefile` around lines 59 - 68, Update the start, start-bg, start-ephemeral,
and stop targets to define and use one absolute runtime MOON_BIN path for both
launching and process matching. Anchor the pkill pattern to the executable
command at the beginning, construct it from MOON_BIN so the wrapper shell is not
matched, and invoke the binary through the same absolute value in every start
target.

@TinDang97 TinDang97 added the skip-changelog Skip the CHANGELOG.md update gate for this PR label Aug 13, 2026
@TinDang97
TinDang97 merged commit 8d369e5 into main Aug 13, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Skip the CHANGELOG.md update gate for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant