Skip to content

fix(build): make fresh parallel LPeg builds reproducible - #33

Merged
metaphorics merged 1 commit into
mainfrom
stabilize/01-reproducible-lpeg-build
Sep 21, 2026
Merged

metaphorics merged 1 commit into
mainfrom
stabilize/01-reproducible-lpeg-build

Conversation

@metaphorics

Copy link
Copy Markdown
Collaborator

Stack

First layer of the stabilization stack. Later terminal and startup fixes build on this branch.

Reproduced failure

A fresh cargo build --workspace --release failed in ox-lua/build.rs because it searched sibling Cargo output directories for LuaJIT headers while mlua-sys was still building. Choosing the newest directory could also select unrelated cached artifacts.

Change

Compile vendored LPeg against three unmodified Lua 5.1 C API headers from the exact locked luajit-src 210.7.2+b925b3e package. Preserve the upstream copyright, record source provenance and SHA-256 hashes, and remove output-directory scanning. The binary still links the single LuaJIT runtime built by mlua-sys.

Executed verification

Linux x86-64, Rust 1.98.0. Every Cargo command unsets CARGO_BUILD_BUILD_DIR and RUSTC_WRAPPER.

  • Before: fresh workspace release build failed with no mlua-sys vendored LuaJIT headers found ...; build mlua first.
  • After: workspace release build passed in a separate, initially empty CARGO_TARGET_DIR.
  • cargo test --release -p ox-lua --test stdlib lpeg: 2 passed, including the upstream LPeg 1.1.0 suite.
  • git diff --check: passed.

This fixes an additional clean-build blocker relevant to #28. It does not claim that the remaining Windows runtime code compiles or that the full Neovim compatibility gates pass.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-20T21:07:17.433470Z 09e3286 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3df9fe09-8893-4adc-8d32-7ebf645fb693

📥 Commits

Reviewing files that changed from the base of the PR and between 09e3286 and 09e3286.

📒 Files selected for processing (6)
  • crates/ox-lua/build.rs
  • third_party/lua51/COPYRIGHT
  • third_party/lua51/README.md
  • third_party/lua51/lauxlib.h
  • third_party/lua51/lua.h
  • third_party/lua51/luaconf.h

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8b1f002f-9848-4e9f-9bde-454b5f1acc69

📥 Commits

Reviewing files that changed from the base of the PR and between 3c7c175 and 09e3286.

📒 Files selected for processing (6)
  • crates/ox-lua/build.rs
  • third_party/lua51/COPYRIGHT
  • third_party/lua51/README.md
  • third_party/lua51/lauxlib.h
  • third_party/lua51/lua.h
  • third_party/lua51/luaconf.h

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (6)
third_party/lua51/lua.h (1)

1-402: LGTM!

third_party/lua51/lauxlib.h (1)

1-161: LGTM!

third_party/lua51/luaconf.h (1)

1-156: LGTM!

crates/ox-lua/build.rs (1)

164-168: LGTM!

third_party/lua51/README.md (1)

1-21: LGTM!

third_party/lua51/COPYRIGHT (1)

1-56: LGTM!


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved build reliability by using pinned Lua compatibility headers instead of searching generated build directories.
    • Added explicit rebuild tracking for all required Lua headers.
  • Documentation

    • Documented the bundled Lua headers, their provenance, licensing, checksums, and regeneration process.
  • Chores

    • Added Lua 5.1 and LuaJIT-compatible headers required for consistent builds.

Walkthrough

The pull request vendors Lua 5.1 headers and LuaJIT configuration data under third_party/lua51. The ox-lua build script now includes these headers directly and tracks all three header files for rebuilds. Documentation records their source, checksums, and licenses.

Changes

Lua 5.1 header integration

Layer / File(s) Summary
Lua 5.1 header contract
third_party/lua51/lua.h, third_party/lua51/lauxlib.h, third_party/lua51/luaconf.h
Adds Lua 5.1 API declarations, auxiliary-library APIs, compatibility macros, and LuaJIT configuration definitions.
Build include wiring
crates/ox-lua/build.rs
Uses the repository-local header directory derived from CARGO_MANIFEST_DIR and emits rebuild directives for lua.h, luaconf.h, and lauxlib.h.
Header provenance and licensing
third_party/lua51/README.md, third_party/lua51/COPYRIGHT
Documents the locked source paths and SHA-256 checksums. Adds license text for LuaJIT, Lua, and dlmalloc.

Priority: ⬇️ Low

Change: Bug fix

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses Conventional Commits format and clearly describes the build reproducibility fix for parallel LPeg builds.
Description check ✅ Passed The description directly explains the build failure, the vendored Lua header change, the reproducibility goal, and the verification results.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 70.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. (2 skipped: 2 …
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
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

@amazon-q-developer amazon-q-developer 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.

Review Summary

This PR successfully addresses the parallel build race condition by replacing dynamic header directory scanning with pinned Lua 5.1 headers from the locked LuaJIT source package. The solution is cleaner and more reproducible.

Critical Issues

Two issues need attention before merge:

  1. Missing header file validation in build.rs - Add explicit checks that headers exist before compilation to provide clear error messages instead of cryptic linker failures.

  2. SHA-256 hashes not verified - The documented hashes in README.md should be enforced during build to prevent supply chain attacks and detect file corruption.

Verification Needed

The PR claims testing passed on Linux x86-64. Ensure cross-platform builds (especially Windows mentioned in the PR description) are verified before merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread third_party/lua51/README.md
Comment thread crates/ox-lua/build.rs
@metaphorics

Copy link
Copy Markdown
Collaborator Author

/q review

@metaphorics

Copy link
Copy Markdown
Collaborator Author

@codex review

@amazon-q-developer amazon-q-developer 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.

This PR effectively resolves the parallel build reproducibility issue by replacing fragile directory-scanning logic with vendored Lua 5.1 C API headers. The implementation is clean, well-documented with provenance and SHA-256 hashes, and maintains proper licensing attribution.

The key improvements are:

  • Eliminates race conditions from scanning sibling build directories
  • Makes builds independent of Cargo's target-directory layout and build order
  • Adds explicit build input tracking with cargo:rerun-if-changed directives
  • Preserves upstream copyright and documents exact source package versions

The verification tests confirm this fixes the reported build failure while maintaining LPeg functionality. The approach is sound and ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 09e3286556

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@metaphorics
metaphorics merged commit 78285c8 into main Sep 21, 2026
5 checks passed
@metaphorics
metaphorics deleted the stabilize/01-reproducible-lpeg-build branch September 21, 2026 14:24
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