Repository navigation
fix(melpa): serialize forge's sqlite3 module build across the oracle's two editors - #429
Conversation
…s two editors
The batch oracle evaluates GNU Emacs and Neovm concurrently
(thread::scope in run_elisp_oracle_batch) against one shared prepared
package tree. forge's dependency sqlite3 lazily compiles its native
module (sqlite3-api.so) in that tree on first load, and each make run
deletes the intermediate sqlite3-api.o after linking. With both builds
running on a cold cache, one editor's cleanup removes the .o between
the other's compile and link, so the slower link fails:
Building sqlite3-api module with "make all"
Failed to compile module using: make all: ...
ld.bfd: cannot find sqlite3-api.o: No such file or directory
The race is nondeterministic and can hit either editor, which is why
forge surfaced as an intermittent RestartProbe exit 255.
Point SQLITE3_API_BUILD_COMMAND at
flock -w 600 <workspace>/tmp/forge-sqlite3-build.lock make all
so the first build completes before the second make runs; the second
then observes an up-to-date module and both editors load the same .so.
Melpa sweep locally: 939/942.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe Forge parity test sets ChangesForge SQLite build serialization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change makes Forge’s SQLite native-module build wait on a workspace lock, intended to prevent concurrent cold-cache build failures. No concrete merge-blocking risk is currently established. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The lock is forge-specific and set only in forge's PRELUDE, so it cannot serialize against closql/org_roam, which build the identical shared sqlite3-api.so with no lock, leaving the documented cross-suite race unaddressed.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
This PR addresses an intermittent MELPA CI failure (ld.bfd: cannot find sqlite3-api.o) in the forge parity suite. forge's sqlite3 dependency lazily compiles its native module on first (require 'sqlite3), and the batch oracle evaluates GNU Emacs and Neomacs concurrently against a shared package tree; because make deletes the intermediate sqlite3-api.o after linking, the two concurrent builds race. The fix sets SQLITE3_API_BUILD_COMMAND in forge's PRELUDE to wrap make all in flock against a workspace-scoped lock file so the two editors serialize their module build.
Changes:
- Prepend a
(setenv "SQLITE3_API_BUILD_COMMAND" ...)form to forge's PRELUDE that runs the module build underflock -w 600 <workspace>/tmp/forge-sqlite3-build.lock make all. - Add an explanatory comment documenting the module-build race and the serialization intent.
| File | Description |
|---|---|
| crates/neomacs-melpa-tests/src/parity_tests/forge.rs | Wraps forge's lazy sqlite3 native-module build in a flock-guarded command to serialize the two concurrent oracle editors. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| (setenv "SQLITE3_API_BUILD_COMMAND" | ||
| (format "flock -w 600 %s make all" | ||
| (expand-file-name "tmp/forge-sqlite3-build.lock" | ||
| (getenv "NEOMACS_TEST_WORKSPACE_ROOT")))) |

Root cause of the intermittent forge red (seen as
RestartProbe (exit Some(255))):run_elisp_oracle_batchevaluates GNU Emacs and Neovm concurrently (thread::scope) against one shared prepared package tree.makedeletes the intermediatesqlite3-api.oafter linking..obetween the other's compile and link →ld.bfd: cannot find sqlite3-api.o.Fix: point
SQLITE3_API_BUILD_COMMANDatflock -w 600 <workspace>/tmp/forge-sqlite3-build.lock make all. The first editor builds the module; the second'smakesees it up to date. Both inevitably load the same artifact.Verified cold (artifacts deleted):
forge_practical_workflows_batchpasses; the module is present afterwards. Melpa sweep locally 939/942.