Skip to content

dev: build using plain-ish build.rs#571

Merged
OGKevin merged 2 commits into
masterfrom
ogkevin/push/ozwlrkrznxlp
Jun 7, 2026
Merged

dev: build using plain-ish build.rs#571
OGKevin merged 2 commits into
masterfrom
ogkevin/push/ozwlrkrznxlp

Conversation

@OGKevin

@OGKevin OGKevin commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Replace tarball-based thirdparty downloads with git submodules and a build-deps crate

Thirdparty C/C++ dependencies (zlib, bzip2, libpng, libjpeg, openjpeg, jbig2dec, libwebp, freetype2, harfbuzz, gumbo, djvulibre, mupdf) are now tracked as git submodules in .gitmodules instead of being downloaded at build time from tarballs or pre-built release assets. The per-library build-kobo.sh shell scripts and the Makefile-kobo for bzip2 have been removed.

A new crates/build-deps crate centralises all thirdparty build logic previously spread across xtask/src/tasks/util/thirdparty.rs, xtask/src/tasks/util/mupdf_wrapper.rs, and xtask/src/tasks/setup_native.rs. It exposes:

  • build::kobo — cross-compilation recipes for each library targeting arm-unknown-linux-gnueabihf, final libmupdf.so link step, and ensure_kobo_artifacts as the single entry point.
  • build::native — native host builds of libwebp and MuPDF using system libraries, with ensure_native_artifacts as the entry point.
  • build::mupdf_wrapper — compiles mupdf_wrapper.c via the cc crate for both targets.
  • build::mupdf — shared WebP patch application logic used by both flows.
  • markers, cmd, versions — marker-file helpers, shell-out wrappers, and pinned version/path constants.

crates/core/build.rs now calls into build-deps directly to build and link thirdparty artifacts, replacing the previous manual shell invocations. A CADMUS_SKIP_THIRDPARTY_DEPS environment variable allows skipping the build and link steps for workflows that only need Rust source analysis (e.g. cargo doc).

The cargo xtask setup-native command and its SetupNativeArgs have been removed. Native dependency building is now handled automatically by build.rs when cargo build runs. run-emulator and install-importer no longer call setup_native as a prerequisite. The --slow and --skip flags on build-kobo have been removed; the build script handles caching via .built marker files and skips submodule initialisation on warm caches.

Build patches previously under thirdparty/<lib>/ have been moved to build-scripts/<lib>/. The shared cargo artifact cache key now includes build-scripts/**, .gitmodules, mupdf_wrapper/mupdf_wrapper.c, and crates/build-deps/**, and the libs/ directory is added to the cached paths. Renovate is updated to track submodule versions via the git-submodules manager instead of regex matches against version constants in thirdparty.rs.

Change-Id: b03e8f80c2eab7a3d9fedc4c8892c1cb
Change-Id-Short: ozwlrkrznxlp

OGKevin commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch 2 times, most recently from f38a093 to 7401f89 Compare June 3, 2026 16:53
@OGKevin OGKevin changed the title refactor: migrate thirdparty to git submodules and native Rust builds dev: build using plain-ish build.rs Jun 3, 2026
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch 8 times, most recently from 0c807f0 to 73494e9 Compare June 4, 2026 07:04
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 4, 2026 07:07 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 73494e9 to 8d2c29d Compare June 4, 2026 09:34
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 4, 2026 09:36 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 8d2c29d to e3f7ebe Compare June 4, 2026 11:10
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from e3f7ebe to 1ce7024 Compare June 4, 2026 12:07
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 4, 2026 12:14 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 1ce7024 to 785092b Compare June 4, 2026 14:14
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 4, 2026 14:17 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 785092b to 5d193d1 Compare June 4, 2026 14:25
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 4, 2026 14:32 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch 4 times, most recently from a943e80 to 47e3b4f Compare June 5, 2026 08:33
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 5, 2026 08:36 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 47e3b4f to df8a030 Compare June 5, 2026 09:01
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 5, 2026 09:04 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 3927b1e to c41f0f0 Compare June 6, 2026 16:51
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 6, 2026 16:54 — with GitHub Actions Inactive

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

🤖 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 @.github/workflows/build-release-candidate.yml:
- Line 51: Replace the mutable tag for the GitHub Action usage so the workflow
no longer references actions/cache/restore@v5; update the `uses` reference to
the action's immutable full commit SHA (e.g.,
`actions/cache/restore@<full-commit-sha>`) to pin the exact release, ensuring
any invocation of the actions/cache/restore step uses the commit SHA instead of
the `v5` tag.

In @.github/workflows/cadmus-docs.yml:
- Line 76: The workflow currently references the reusable action with a floating
tag "actions/cache/restore@v5"; replace that reference with a full immutable
commit SHA (e.g. actions/cache/restore@<full-commit-sha>) to prevent
supply-chain drift by finding the corresponding commit in the actions/cache
repository and using its SHA in place of "`@v5`".

In @.github/workflows/cargo.yml:
- Around line 162-166: The workflow currently guards the "cargo xtask
download-assets" step with "if: steps.cache.outputs.cache-hit != 'true'",
causing the Kobo warmup (the "Warmup build (native)" step and any subsequent
"cargo xtask build-kobo" runs) to proceed with a stale asset list; remove the
conditional so cargo xtask download-assets runs unconditionally and ensure this
step precedes the Warmup build (native) and the cargo xtask build-kobo
invocation to keep the generated asset list accurate.
- Line 112: The workflow uses mutable action tags (actions/cache@v5,
actions/cache/restore@v5, and awalsh128/cache-apt-pkgs-action@latest); replace
each `uses:` entry with the corresponding repository@<commit-sha> pinned to a
specific immutable commit SHA (for example, actions/cache@<sha>,
actions/cache/restore@<sha>, and awalsh128/cache-apt-pkgs-action@<sha>) so all
occurrences of those three references in the file are updated to their
respective commit SHAs to eliminate mutable tags.

In @.github/workflows/release.yml:
- Line 78: Replace the mutable action ref "actions/cache/restore@v5" with an
immutable full commit SHA (or digest) to prevent upstream drift; locate the
occurrence of the string "actions/cache/restore@v5" in the workflow and update
it to the pinned form "actions/cache/restore@<full-commit-sha>" (obtain the SHA
from the action's repository tags or GitHub UI), and apply the same pinning
pattern to any other workflows that use this mutable ref.

In `@crates/build-deps/src/build/kobo/mupdf.rs`:
- Around line 95-103: The cleanup loop that iterates over std::fs::read_dir in
mupdf.rs swallows errors by calling .ok() on std::fs::remove_dir_all and
std::fs::remove_file; change these to propagate failures so cleanup errors fail
fast (e.g., replace .ok() with ? or convert the error into a descriptive Err)
for the remove_dir_all and remove_file calls inside the loop so any deletion
failure returns from the surrounding function instead of being ignored.
🪄 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 YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: a7b36195-19c6-49ba-8be8-ff4a5694e6f6

📥 Commits

Reviewing files that changed from the base of the PR and between 3927b1e and c41f0f0.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (75)
  • .devin/wiki.json
  • .github/actions/build-kobo/action.yml
  • .github/actions/cache-thirdparty/action.yml
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cadmus-docs.yml
  • .github/workflows/cargo.yml
  • .github/workflows/copilot-setup-steps.yml
  • .github/workflows/release.yml
  • .gitmodules
  • Cargo.toml
  • build-scripts/djvulibre/kobo.patch
  • build-scripts/harfbuzz/kobo-options.txt
  • build-scripts/harfbuzz/kobo.patch
  • build-scripts/mupdf/README.md
  • build-scripts/mupdf/kobo.patch
  • build-scripts/mupdf/webp-image-h-kobo.patch
  • build-scripts/mupdf/webp-load-webp-deviations-kobo.patch
  • build-scripts/mupdf/webp-upstream-697749-kobo.patch
  • crates/build-deps/Cargo.toml
  • crates/build-deps/src/build/kobo.rs
  • crates/build-deps/src/build/kobo/mupdf.rs
  • crates/build-deps/src/build/kobo/recipes.rs
  • crates/build-deps/src/build/kobo/source.rs
  • crates/build-deps/src/build/mod.rs
  • crates/build-deps/src/build/mupdf.rs
  • crates/build-deps/src/build/mupdf_wrapper.rs
  • crates/build-deps/src/build/native.rs
  • crates/build-deps/src/cmd.rs
  • crates/build-deps/src/lib.rs
  • crates/build-deps/src/markers.rs
  • crates/build-deps/src/versions.rs
  • crates/cadmus/Cargo.toml
  • crates/core/Cargo.toml
  • crates/core/build.rs
  • crates/emulator/Cargo.toml
  • crates/fetcher/Cargo.toml
  • crates/importer/Cargo.toml
  • renovate.json
  • thirdparty/bzip2
  • thirdparty/bzip2/Makefile-kobo
  • thirdparty/bzip2/build-kobo.sh
  • thirdparty/djvulibre
  • thirdparty/djvulibre/build-kobo.sh
  • thirdparty/freetype2
  • thirdparty/freetype2/build-kobo.sh
  • thirdparty/gumbo
  • thirdparty/gumbo/build-kobo.sh
  • thirdparty/harfbuzz
  • thirdparty/harfbuzz/build-kobo.sh
  • thirdparty/jbig2dec
  • thirdparty/jbig2dec/build-kobo.sh
  • thirdparty/libjpeg
  • thirdparty/libjpeg/build-kobo.sh
  • thirdparty/libpng
  • thirdparty/libpng/build-kobo.sh
  • thirdparty/libwebp
  • thirdparty/libwebp/build-kobo.sh
  • thirdparty/mupdf
  • thirdparty/mupdf/build-kobo.sh
  • thirdparty/openjpeg
  • thirdparty/openjpeg/build-kobo.sh
  • thirdparty/zlib
  • thirdparty/zlib/build-kobo.sh
  • xtask/Cargo.toml
  • xtask/src/lib.rs
  • xtask/src/tasks/build_kobo.rs
  • xtask/src/tasks/dist.rs
  • xtask/src/tasks/docs.rs
  • xtask/src/tasks/install_importer.rs
  • xtask/src/tasks/mod.rs
  • xtask/src/tasks/run_emulator.rs
  • xtask/src/tasks/setup_native.rs
  • xtask/src/tasks/util/mod.rs
  • xtask/src/tasks/util/mupdf_wrapper.rs
  • xtask/src/tasks/util/thirdparty.rs
💤 Files with no reviewable changes (19)
  • thirdparty/zlib/build-kobo.sh
  • xtask/src/tasks/mod.rs
  • thirdparty/harfbuzz/build-kobo.sh
  • xtask/src/tasks/util/mupdf_wrapper.rs
  • thirdparty/djvulibre/build-kobo.sh
  • thirdparty/openjpeg/build-kobo.sh
  • thirdparty/libjpeg/build-kobo.sh
  • thirdparty/bzip2/build-kobo.sh
  • thirdparty/gumbo/build-kobo.sh
  • thirdparty/bzip2/Makefile-kobo
  • xtask/src/tasks/util/mod.rs
  • thirdparty/libwebp/build-kobo.sh
  • thirdparty/mupdf/build-kobo.sh
  • thirdparty/libpng/build-kobo.sh
  • thirdparty/jbig2dec/build-kobo.sh
  • xtask/src/tasks/util/thirdparty.rs
  • .github/actions/cache-thirdparty/action.yml
  • xtask/src/tasks/setup_native.rs
  • thirdparty/freetype2/build-kobo.sh
✅ Files skipped from review due to trivial changes (8)
  • thirdparty/bzip2
  • thirdparty/harfbuzz
  • crates/importer/Cargo.toml
  • xtask/Cargo.toml
  • thirdparty/libpng
  • crates/cadmus/Cargo.toml
  • .devin/wiki.json
  • Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (33)
  • thirdparty/gumbo
  • thirdparty/openjpeg
  • crates/build-deps/Cargo.toml
  • thirdparty/jbig2dec
  • crates/emulator/Cargo.toml
  • .github/workflows/copilot-setup-steps.yml
  • thirdparty/libwebp
  • crates/fetcher/Cargo.toml
  • xtask/src/tasks/dist.rs
  • thirdparty/libjpeg
  • xtask/src/tasks/docs.rs
  • .gitmodules
  • thirdparty/mupdf
  • thirdparty/zlib
  • crates/build-deps/src/build/mod.rs
  • thirdparty/djvulibre
  • .github/actions/build-kobo/action.yml
  • crates/core/Cargo.toml
  • xtask/src/tasks/install_importer.rs
  • crates/build-deps/src/build/mupdf_wrapper.rs
  • crates/build-deps/src/versions.rs
  • thirdparty/freetype2
  • xtask/src/lib.rs
  • crates/build-deps/src/markers.rs
  • crates/build-deps/src/build/kobo/source.rs
  • crates/build-deps/src/build/mupdf.rs
  • crates/build-deps/src/lib.rs
  • crates/build-deps/src/cmd.rs
  • renovate.json
  • crates/build-deps/src/build/kobo.rs
  • crates/build-deps/src/build/native.rs
  • crates/core/build.rs
  • crates/build-deps/src/build/kobo/recipes.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (38)
  • GitHub Check: test (profiling + tracing, ubuntu-latest)
  • GitHub Check: test (emulator + kobo + test, ubuntu-latest)
  • GitHub Check: test (emulator + kobo + profiling + tracing, ubuntu-latest)
  • GitHub Check: test (kobo + tracing, ubuntu-latest)
  • GitHub Check: test (emulator, ubuntu-latest)
  • GitHub Check: test (emulator + profiling, ubuntu-latest)
  • GitHub Check: test (emulator + test, ubuntu-latest)
  • GitHub Check: test (emulator + kobo + profiling, ubuntu-latest)
  • GitHub Check: test (kobo + profiling, ubuntu-latest)
  • GitHub Check: test (emulator + kobo, ubuntu-latest)
  • GitHub Check: clippy (emulator + profiling + test + tracing, ubuntu-latest)
  • GitHub Check: test (profiling, ubuntu-latest)
  • GitHub Check: test (default, ubuntu-latest)
  • GitHub Check: clippy (emulator + kobo + test + tracing, ubuntu-latest)
  • GitHub Check: clippy (emulator + kobo + tracing, ubuntu-latest)
  • GitHub Check: clippy (emulator + kobo + test, ubuntu-latest)
  • GitHub Check: clippy (kobo + profiling + tracing, ubuntu-latest)
  • GitHub Check: clippy (emulator + profiling + tracing, ubuntu-latest)
  • GitHub Check: clippy (profiling + test, ubuntu-latest)
  • GitHub Check: clippy (test + tracing, ubuntu-latest)
  • GitHub Check: clippy (profiling + tracing, ubuntu-latest)
  • GitHub Check: clippy (tracing, ubuntu-latest)
  • GitHub Check: clippy (emulator + kobo + profiling + test, ubuntu-latest)
  • GitHub Check: clippy (emulator + profiling + test, ubuntu-latest)
  • GitHub Check: clippy (kobo + profiling + test, ubuntu-latest)
  • GitHub Check: clippy (kobo + tracing, ubuntu-latest)
  • GitHub Check: clippy (test, ubuntu-latest)
  • GitHub Check: clippy (emulator + kobo + profiling, ubuntu-latest)
  • GitHub Check: clippy (emulator + test, ubuntu-latest)
  • GitHub Check: clippy (kobo + profiling, ubuntu-latest)
  • GitHub Check: clippy (profiling, ubuntu-latest)
  • GitHub Check: clippy (kobo, ubuntu-latest)
  • GitHub Check: clippy (default, ubuntu-latest)
  • GitHub Check: clippy (emulator + kobo, ubuntu-latest)
  • GitHub Check: clippy (emulator + profiling, ubuntu-latest)
  • GitHub Check: clippy (emulator, ubuntu-latest)
  • GitHub Check: build-kobo
  • GitHub Check: build-kobo-test
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Prefer ? operator over unwrap() / expect() in library and app code
Use thiserror for custom error types and anyhow for ad-hoc errors in Rust
Use iterators over index-based loops in Rust
Use &str over String in function parameters when ownership is not needed
Prefer borrowing over cloning in Rust
Inline expressions directly into struct fields — avoid intermediate bindings solely to pass them into a struct literal
Avoid unsafe unless required and documented in Rust
Avoid premature collect() — keep iterators lazy in Rust
Ensure Rust code compiles without warnings
Prefer newtype wrappers over raw primitives for domain concepts (e.g., Fingerprint(String) instead of bare String)
Wrap String, i64, and similar primitives when the value represents a specific domain concept (fingerprints, file kinds, identifiers, etc.)
Implement Display, FromStr, and other standard traits on newtype wrappers to keep them ergonomic
Match on enum variants instead of string comparisons — the compiler catches missing arms
Comment why, not what. Avoid inline comments — extract code into well-named, documented functions instead
Avoid dead-code comments (commented-out code) in Rust
Avoid changelog comments (Modified by X on date) in Rust
Avoid divider comments (//=====) in Rust
Annotations (TODO, FIXME, HACK, NOTE) are acceptable with context in Rust
Use structured fields with the tracing crate — never use string formatting for log data
Use only structured fields for logging — data goes in fields, not format strings
Do not use module prefixes in logs — instrumentation scope provides context
Do not mix structured fields with format arguments in logging
Use debug log level for development and troubleshooting detail
Use info log level for important runtime events
Use warn log level for recoverable issues (retries, fallbacks)
Use error log level for failures requiring attention
Return domain types directly from sqlx queries instead of parsin...

Files:

  • xtask/src/tasks/run_emulator.rs
  • xtask/src/tasks/build_kobo.rs
  • crates/build-deps/src/build/kobo/mupdf.rs
.github/workflows/cargo.yml

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/cargo.yml: The clippy and test jobs in .github/workflows/cargo.yml use a matrix to check every feature flag individually and in combination
For workspace-wide feature flags in CI, use --workspace --all-targets --features <name> in .github/workflows/cargo.yml
For crate-specific feature flags in CI, use -p <crate> --all-targets --features <name> in .github/workflows/cargo.yml
All feature flag combinations should run on ubuntu-latest in .github/workflows/cargo.yml
Only default and test features should produce build artifacts in .github/workflows/cargo.yml

Files:

  • .github/workflows/cargo.yml
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/{build-kobo.sh,*-kobo.patch} : Prefer using kobo.patch for working around upstream issues rather than modifying build-kobo.sh — patches make the delta explicit and reviewable
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: In CI, `cargo xtask download-assets` must run before `cargo xtask build-kobo` so the generated asset list stays accurate
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Library versions must be defined as constants in xtask/src/tasks/util/thirdparty.rs — never hard-code URLs in build scripts
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Respect the build order defined by LIBRARY_NAMES in xtask/src/tasks/util/thirdparty.rs — libraries later in the list may link against earlier ones, and new libraries must be inserted at the correct position
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 511
File: crates/core/build.rs:129-131
Timestamp: 2026-05-25T12:43:50.793Z
Learning: In `crates/core/build.rs`, the `generate_bundled_assets()` function intentionally skips missing asset directories (`if !dir.exists() { return; }`) to support emulator/non-Kobo builds where OTA is not used and asset directories may not be present. Any fail-fast guard for missing required directories (e.g., `bin/`, `resources/`, `hyphenation-patterns/`) should be gated on the Kobo target (`TARGET == "arm-unknown-linux-gnueabihf"`) to avoid breaking emulator builds.
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: After modifying `Cargo.toml`, run `cargo xtask clippy` and `cargo xtask test --features default`

Applied to files:

  • xtask/src/tasks/run_emulator.rs
  • xtask/src/tasks/build_kobo.rs
  • .github/workflows/cargo.yml
📚 Learning: 2026-05-25T12:43:50.793Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 511
File: crates/core/build.rs:129-131
Timestamp: 2026-05-25T12:43:50.793Z
Learning: In `crates/core/build.rs`, the `generate_bundled_assets()` function intentionally skips missing asset directories (`if !dir.exists() { return; }`) to support emulator/non-Kobo builds where OTA is not used and asset directories may not be present. Any fail-fast guard for missing required directories (e.g., `bin/`, `resources/`, `hyphenation-patterns/`) should be gated on the Kobo target (`TARGET == "arm-unknown-linux-gnueabihf"`) to avoid breaking emulator builds.

Applied to files:

  • xtask/src/tasks/run_emulator.rs
  • xtask/src/tasks/build_kobo.rs
  • crates/build-deps/src/build/kobo/mupdf.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : For crate-specific feature flags in CI, use `-p <crate> --all-targets --features <name>` in `.github/workflows/cargo.yml`

Applied to files:

  • xtask/src/tasks/run_emulator.rs
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cargo.yml
  • .github/workflows/release.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Library versions must be defined as constants in xtask/src/tasks/util/thirdparty.rs — never hard-code URLs in build scripts

Applied to files:

  • xtask/src/tasks/run_emulator.rs
  • xtask/src/tasks/build_kobo.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : For workspace-wide feature flags in CI, use `--workspace --all-targets --features <name>` in `.github/workflows/cargo.yml`

Applied to files:

  • xtask/src/tasks/run_emulator.rs
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cadmus-docs.yml
  • .github/workflows/cargo.yml
  • .github/workflows/release.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : The `clippy` and `test` jobs in `.github/workflows/cargo.yml` use a matrix to check every feature flag individually and in combination

Applied to files:

  • xtask/src/tasks/run_emulator.rs
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cargo.yml
  • .github/workflows/release.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: In CI, `cargo xtask download-assets` must run before `cargo xtask build-kobo` so the generated asset list stays accurate

Applied to files:

  • xtask/src/tasks/build_kobo.rs
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/{build-kobo.sh,*-kobo.patch} : Prefer using kobo.patch for working around upstream issues rather than modifying build-kobo.sh — patches make the delta explicit and reviewable

Applied to files:

  • xtask/src/tasks/build_kobo.rs
  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Respect the build order defined by LIBRARY_NAMES in xtask/src/tasks/util/thirdparty.rs — libraries later in the list may link against earlier ones, and new libraries must be inserted at the correct position

Applied to files:

  • xtask/src/tasks/build_kobo.rs
📚 Learning: 2026-05-26T20:10:56.991Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 456
File: crates/core/src/document/mupdf_sys.rs:7-10
Timestamp: 2026-05-26T20:10:56.991Z
Learning: In `crates/core/src/document/mupdf_sys.rs` (OGKevin/cadmus), the project owner prefers safety/soundness documentation for unsafe code to be written as `///` Rust doc comments on the function (so they appear in generated rustdoc), rather than as inline `// SAFETY:` comments inside the unsafe block.

Applied to files:

  • crates/build-deps/src/build/kobo/mupdf.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : Only `default` and `test` features should produce build artifacts in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cadmus-docs.yml
  • .github/workflows/cargo.yml
  • .github/workflows/release.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : All feature flag combinations should run on `ubuntu-latest` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
  • .github/workflows/release.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: When adding a new feature flag, add it to the relevant `Cargo.toml` and update `.github/workflows/cargo.yml` with matrix entries for both the feature alone and combined with every other feature

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/+(build-kobo.sh|kobo.patch|*-kobo.patch|README-kobo.md|README-cadmus.md|Makefile-kobo) : Each library subdirectory may contain build-kobo.sh, kobo.patch, *-kobo.patch files, README-kobo.md, README-cadmus.md, and additional build system files

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/** : Build scripts and patches for third-party libraries must be placed in the thirdparty directory, with no downloaded source trees committed — only build scripts and patches

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to **/*.rs : Ensure Rust code compiles without warnings

Applied to files:

  • .github/workflows/cargo.yml
🪛 Betterleaks (1.3.1)
.github/workflows/cargo.yml

[high] 115-115: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 GitHub Actions: PR `#571` / 0_Analyze (rust).txt
crates/build-deps/src/build/kobo/mupdf.rs

[warning] 41-41: CodeQL rust autobuild warning: macro expansion failed for 'format'.


[warning] 55-55: CodeQL rust autobuild warning: macro expansion failed for 'vec'.


[warning] 157-157: CodeQL rust autobuild warning: macro expansion failed for 'format'.


[warning] 204-204: CodeQL rust autobuild warning: macro expansion failed for 'assert'.


[warning] 205-205: CodeQL rust autobuild warning: macro expansion failed for 'assert'.


[warning] 212-212: CodeQL rust autobuild warning: macro expansion failed for 'assert'.

🪛 GitHub Actions: PR `#571` / Analyze (rust)
crates/build-deps/src/build/kobo/mupdf.rs

[warning] 41-41: CodeQL Rust extraction: macro expansion failed for 'format'


[warning] 55-55: CodeQL Rust extraction: macro expansion failed for 'vec'


[warning] 157-157: CodeQL Rust extraction: macro expansion failed for 'format'


[warning] 204-204: CodeQL Rust extraction: macro expansion failed for 'assert'


[warning] 205-205: CodeQL Rust extraction: macro expansion failed for 'assert'


[warning] 212-212: CodeQL Rust extraction: macro expansion failed for 'assert'

🪛 zizmor (1.25.2)
.github/workflows/build-release-candidate.yml

[error] 51-51: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

.github/workflows/cadmus-docs.yml

[error] 76-76: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

.github/workflows/cargo.yml

[error] 106-106: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 112-112: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 106-106: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): always restores from cache

(cache-poisoning)


[error] 112-112: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)


[error] 142-142: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 154-154: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 142-142: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)


[error] 301-301: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

.github/workflows/release.yml

[error] 78-78: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🔇 Additional comments (2)
xtask/src/tasks/run_emulator.rs (1)

3-5: LGTM!

Also applies to: 33-33

xtask/src/tasks/build_kobo.rs (1)

3-19: LGTM!

Also applies to: 24-27, 41-47, 102-103

Comment thread .github/workflows/build-release-candidate.yml Outdated
Comment thread .github/workflows/cadmus-docs.yml Outdated
Comment thread .github/workflows/cargo.yml Outdated
Comment thread .github/workflows/cargo.yml
Comment thread .github/workflows/release.yml Outdated
Comment thread crates/build-deps/src/build/kobo/mupdf.rs
Change-Id: b03e8f80c2eab7a3d9fedc4c8892c1cb
Change-Id-Short: ozwlrkrznxlp
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from c41f0f0 to 56568ac Compare June 6, 2026 19:55
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 6, 2026 19:58 — with GitHub Actions Inactive

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/cargo.yml (1)

12-20: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Include submodule-backed build inputs in pull_request.paths.

Right now a PR that only bumps a third-party submodule revision, updates .gitmodules, or changes mupdf_wrapper/mupdf_wrapper.c can skip this workflow entirely, even though those inputs now affect the native/Kobo build path. That leaves a straight path for dependency-source changes to merge without running the cargo/clippy/test/build-kobo checks.

Suggested fix
   pull_request:
     paths:
       - "**/*.rs"
       - "Cargo.*"
       - "**/Cargo.*"
       - ".github/workflows/cargo.yml"
       - ".github/actions/build-kobo/**"
       - ".github/actions/build-docs-epub/**"
       - ".github/actions/install-doc-tools/**"
       - "build-scripts/**"
+      - ".gitmodules"
+      - "mupdf_wrapper/**"
+      - "thirdparty/**"
🤖 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 @.github/workflows/cargo.yml around lines 12 - 20, The pull_request.paths
list omits submodule-backed inputs so PRs that only change submodule refs,
.gitmodules, or files inside submodule trees can skip the workflow; update the
pull_request.paths array to include patterns that cover .gitmodules and any
submodule directories and their files (for example add "**/.gitmodules",
"mupdf_wrapper/**", "third_party/**" or the actual submodule directory globs and
specific files like "mupdf_wrapper/mupdf_wrapper.c") so changes to submodule
refs or files will trigger the cargo/clippy/test/build-kobo workflow; ensure the
new patterns are added alongside the existing entries under pull_request.paths.
🤖 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 @.github/workflows/cargo.yml:
- Around line 48-50: The cache key currently uses hashFiles(...) including
'.gitmodules' but misses submodule gitlink revisions; update the cache key
generation (the key and restore-keys that reference
steps.rust-toolchain.outputs.cachekey and the hashFiles(...) list) to
incorporate actual submodule commit SHAs (for example by adding the output of a
job/step that runs a Git command such as git submodule status --recursive or git
ls-tree/ rev-parse per submodule and exposing that as a step output) so the
produced cache key changes when submodule revisions change; ensure both the
primary key and restore-keys include that new submodule-derived value.

In `@crates/build-deps/src/build/native.rs`:
- Around line 61-95: The cache marker check in ensure_native_artifacts allows
stale MuPDF outputs to bypass version and patch validation; update
ensure_native_artifacts to revalidate the cached mupdf build before taking the
fast path: call read_mupdf_version(&version_header) (compare to MUPDF_VERSION)
and run mupdf::apply_webp_patches_if_needed(&mupdf_build, root) even when
native_cache_complete(root) is true (or alternatively include the MUPDF_VERSION
in the cache marker when creating it), and if validation fails fall back to
copying/building (build_mupdf_native, kobo::cp_r) and update the marker so
link_mupdf_artifacts always sees a current, validated tree.
- Around line 179-186: The final ranlib invocation is hard-coded to "ranlib";
instead use the resolved RANLIB that combine_libwebp_static_archives() already
determines. Modify the code that currently calls cmd::run("ranlib", ...) to pass
the resolved ranlib command (e.g., a variable named ranlib or ranlib_cmd
returned/available from combine_libwebp_static_archives() or the surrounding
scope) so cmd::run(&ranlib, ...) is used and retain the same args and
context/error handling.

In `@crates/core/build.rs`:
- Around line 91-100: The native branch can run when HOST != TARGET causing
native::ensure_native_artifacts (which writes wrapper artifacts under the host
directory) and emit_native_link_directives (which reads the target directory) to
disagree; add a guard after computing target that compares the build host and
target (e.g. env::var("HOST") vs env::var("TARGET")) and return an Err or bail
with a clear context if they differ before calling
native::ensure_native_artifacts or emit_native_link_directives; update the
branch around skip_thirdparty_deps()/native::ensure_native_artifacts and
emit_native_link_directives to perform this host==target check to fail fast.

---

Outside diff comments:
In @.github/workflows/cargo.yml:
- Around line 12-20: The pull_request.paths list omits submodule-backed inputs
so PRs that only change submodule refs, .gitmodules, or files inside submodule
trees can skip the workflow; update the pull_request.paths array to include
patterns that cover .gitmodules and any submodule directories and their files
(for example add "**/.gitmodules", "mupdf_wrapper/**", "third_party/**" or the
actual submodule directory globs and specific files like
"mupdf_wrapper/mupdf_wrapper.c") so changes to submodule refs or files will
trigger the cargo/clippy/test/build-kobo workflow; ensure the new patterns are
added alongside the existing entries under pull_request.paths.
🪄 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 YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bb42230-a54b-49ae-96a2-29879d0a9c59

📥 Commits

Reviewing files that changed from the base of the PR and between c41f0f0 and 56568ac.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (75)
  • .devin/wiki.json
  • .github/actions/build-kobo/action.yml
  • .github/actions/cache-thirdparty/action.yml
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/cadmus-docs.yml
  • .github/workflows/cargo.yml
  • .github/workflows/copilot-setup-steps.yml
  • .github/workflows/release.yml
  • .gitmodules
  • Cargo.toml
  • build-scripts/djvulibre/kobo.patch
  • build-scripts/harfbuzz/kobo-options.txt
  • build-scripts/harfbuzz/kobo.patch
  • build-scripts/mupdf/README.md
  • build-scripts/mupdf/kobo.patch
  • build-scripts/mupdf/webp-image-h-kobo.patch
  • build-scripts/mupdf/webp-load-webp-deviations-kobo.patch
  • build-scripts/mupdf/webp-upstream-697749-kobo.patch
  • crates/build-deps/Cargo.toml
  • crates/build-deps/src/build/kobo.rs
  • crates/build-deps/src/build/kobo/mupdf.rs
  • crates/build-deps/src/build/kobo/recipes.rs
  • crates/build-deps/src/build/kobo/source.rs
  • crates/build-deps/src/build/mod.rs
  • crates/build-deps/src/build/mupdf.rs
  • crates/build-deps/src/build/mupdf_wrapper.rs
  • crates/build-deps/src/build/native.rs
  • crates/build-deps/src/cmd.rs
  • crates/build-deps/src/lib.rs
  • crates/build-deps/src/markers.rs
  • crates/build-deps/src/versions.rs
  • crates/cadmus/Cargo.toml
  • crates/core/Cargo.toml
  • crates/core/build.rs
  • crates/emulator/Cargo.toml
  • crates/fetcher/Cargo.toml
  • crates/importer/Cargo.toml
  • renovate.json
  • thirdparty/bzip2
  • thirdparty/bzip2/Makefile-kobo
  • thirdparty/bzip2/build-kobo.sh
  • thirdparty/djvulibre
  • thirdparty/djvulibre/build-kobo.sh
  • thirdparty/freetype2
  • thirdparty/freetype2/build-kobo.sh
  • thirdparty/gumbo
  • thirdparty/gumbo/build-kobo.sh
  • thirdparty/harfbuzz
  • thirdparty/harfbuzz/build-kobo.sh
  • thirdparty/jbig2dec
  • thirdparty/jbig2dec/build-kobo.sh
  • thirdparty/libjpeg
  • thirdparty/libjpeg/build-kobo.sh
  • thirdparty/libpng
  • thirdparty/libpng/build-kobo.sh
  • thirdparty/libwebp
  • thirdparty/libwebp/build-kobo.sh
  • thirdparty/mupdf
  • thirdparty/mupdf/build-kobo.sh
  • thirdparty/openjpeg
  • thirdparty/openjpeg/build-kobo.sh
  • thirdparty/zlib
  • thirdparty/zlib/build-kobo.sh
  • xtask/Cargo.toml
  • xtask/src/lib.rs
  • xtask/src/tasks/build_kobo.rs
  • xtask/src/tasks/dist.rs
  • xtask/src/tasks/docs.rs
  • xtask/src/tasks/install_importer.rs
  • xtask/src/tasks/mod.rs
  • xtask/src/tasks/run_emulator.rs
  • xtask/src/tasks/setup_native.rs
  • xtask/src/tasks/util/mod.rs
  • xtask/src/tasks/util/mupdf_wrapper.rs
  • xtask/src/tasks/util/thirdparty.rs
💤 Files with no reviewable changes (19)
  • thirdparty/djvulibre/build-kobo.sh
  • thirdparty/gumbo/build-kobo.sh
  • thirdparty/libpng/build-kobo.sh
  • thirdparty/libwebp/build-kobo.sh
  • thirdparty/libjpeg/build-kobo.sh
  • thirdparty/mupdf/build-kobo.sh
  • thirdparty/bzip2/Makefile-kobo
  • thirdparty/jbig2dec/build-kobo.sh
  • thirdparty/zlib/build-kobo.sh
  • thirdparty/harfbuzz/build-kobo.sh
  • thirdparty/openjpeg/build-kobo.sh
  • xtask/src/tasks/util/mupdf_wrapper.rs
  • xtask/src/tasks/mod.rs
  • xtask/src/tasks/util/mod.rs
  • .github/actions/cache-thirdparty/action.yml
  • xtask/src/tasks/setup_native.rs
  • thirdparty/freetype2/build-kobo.sh
  • xtask/src/tasks/util/thirdparty.rs
  • thirdparty/bzip2/build-kobo.sh
✅ Files skipped from review due to trivial changes (8)
  • crates/cadmus/Cargo.toml
  • thirdparty/jbig2dec
  • Cargo.toml
  • crates/importer/Cargo.toml
  • thirdparty/mupdf
  • crates/emulator/Cargo.toml
  • thirdparty/djvulibre
  • .devin/wiki.json
🚧 Files skipped from review as they are similar to previous changes (36)
  • thirdparty/zlib
  • thirdparty/gumbo
  • thirdparty/libwebp
  • .gitmodules
  • thirdparty/bzip2
  • thirdparty/harfbuzz
  • thirdparty/openjpeg
  • crates/fetcher/Cargo.toml
  • xtask/src/tasks/docs.rs
  • thirdparty/libjpeg
  • thirdparty/libpng
  • crates/core/Cargo.toml
  • .github/workflows/cadmus-docs.yml
  • xtask/src/tasks/dist.rs
  • crates/build-deps/Cargo.toml
  • thirdparty/freetype2
  • xtask/Cargo.toml
  • xtask/src/tasks/install_importer.rs
  • .github/workflows/copilot-setup-steps.yml
  • crates/build-deps/src/lib.rs
  • .github/workflows/build-release-candidate.yml
  • .github/workflows/release.yml
  • crates/build-deps/src/build/mod.rs
  • crates/build-deps/src/cmd.rs
  • .github/actions/build-kobo/action.yml
  • crates/build-deps/src/versions.rs
  • crates/build-deps/src/build/kobo/source.rs
  • xtask/src/lib.rs
  • crates/build-deps/src/build/mupdf_wrapper.rs
  • xtask/src/tasks/run_emulator.rs
  • crates/build-deps/src/markers.rs
  • crates/build-deps/src/build/mupdf.rs
  • crates/build-deps/src/build/kobo/mupdf.rs
  • crates/build-deps/src/build/kobo.rs
  • xtask/src/tasks/build_kobo.rs
  • crates/build-deps/src/build/kobo/recipes.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cache-warmup
  • GitHub Check: build
🧰 Additional context used
📓 Path-based instructions (5)
.github/workflows/cargo.yml

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/cargo.yml: The clippy and test jobs in .github/workflows/cargo.yml use a matrix to check every feature flag individually and in combination
For workspace-wide feature flags in CI, use --workspace --all-targets --features <name> in .github/workflows/cargo.yml
For crate-specific feature flags in CI, use -p <crate> --all-targets --features <name> in .github/workflows/cargo.yml
All feature flag combinations should run on ubuntu-latest in .github/workflows/cargo.yml
Only default and test features should produce build artifacts in .github/workflows/cargo.yml

Files:

  • .github/workflows/cargo.yml
crates/core/**/*.rs

📄 CodeRabbit inference engine (crates/core/AGENTS.md)

crates/core/**/*.rs: Rustdoc examples should follow this preference order: fully compilable > no_run > ignore. Use no_run when the example compiles but cannot execute (file I/O, network, database). Use ignore only for private/pub(crate) items unreachable from the test harness with a comment explaining why. Use # to hide boilerplate setup lines. Verify with cargo test --doc.
Use typed SQL macros (sqlx::query!, sqlx::query_as!, sqlx::query_scalar!) in Rust code. Never use untyped sqlx::query() / sqlx::query_as() / sqlx::query_scalar(). Use .flatten() on query_scalar! results for nullable columns (Option<Option<T>>Option<T>).
Untyped SQL queries are allowed only for dynamic SQL (e.g. runtime ORDER BY column) if and only if the function has unit tests covering every dynamic path, with a comment explaining why the typed macro cannot be used.
All user-visible strings must use the fl! macro (use crate::fl;). Never hardcode string literals for labels, buttons, placeholders, or notifications. User-visible strings include: label() implementations on SettingKind traits, input field label strings in Event::OpenNamedInput, menu entry text (EntryKind::Command, EntryKind::RadioButton, etc.), and button labels, notification text.

Files:

  • crates/core/build.rs
crates/core/**/*.{sql,rs}

📄 CodeRabbit inference engine (crates/core/AGENTS.md)

All SQL queries must list explicit column names. Do not use SELECT *.

Files:

  • crates/core/build.rs
crates/core/**/*.{ftl,rs}

📄 CodeRabbit inference engine (crates/core/AGENTS.md)

Every user-visible string needs a Fluent message ID in crates/core/i18n/en-GB/cadmus_core.ftl. Use fl!("message-id") at the call site. For parameterised strings, use Fluent variables ({ $var }) in the .ftl file and pass values via fl!("id", var = value).

Files:

  • crates/core/build.rs
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Prefer ? operator over unwrap() / expect() in library and app code
Use thiserror for custom error types and anyhow for ad-hoc errors in Rust
Use iterators over index-based loops in Rust
Use &str over String in function parameters when ownership is not needed
Prefer borrowing over cloning in Rust
Inline expressions directly into struct fields — avoid intermediate bindings solely to pass them into a struct literal
Avoid unsafe unless required and documented in Rust
Avoid premature collect() — keep iterators lazy in Rust
Ensure Rust code compiles without warnings
Prefer newtype wrappers over raw primitives for domain concepts (e.g., Fingerprint(String) instead of bare String)
Wrap String, i64, and similar primitives when the value represents a specific domain concept (fingerprints, file kinds, identifiers, etc.)
Implement Display, FromStr, and other standard traits on newtype wrappers to keep them ergonomic
Match on enum variants instead of string comparisons — the compiler catches missing arms
Comment why, not what. Avoid inline comments — extract code into well-named, documented functions instead
Avoid dead-code comments (commented-out code) in Rust
Avoid changelog comments (Modified by X on date) in Rust
Avoid divider comments (//=====) in Rust
Annotations (TODO, FIXME, HACK, NOTE) are acceptable with context in Rust
Use structured fields with the tracing crate — never use string formatting for log data
Use only structured fields for logging — data goes in fields, not format strings
Do not use module prefixes in logs — instrumentation scope provides context
Do not mix structured fields with format arguments in logging
Use debug log level for development and troubleshooting detail
Use info log level for important runtime events
Use warn log level for recoverable issues (retries, fallbacks)
Use error log level for failures requiring attention
Return domain types directly from sqlx queries instead of parsin...

Files:

  • crates/core/build.rs
  • crates/build-deps/src/build/native.rs
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/{build-kobo.sh,*-kobo.patch} : Prefer using kobo.patch for working around upstream issues rather than modifying build-kobo.sh — patches make the delta explicit and reviewable
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: In CI, `cargo xtask download-assets` must run before `cargo xtask build-kobo` so the generated asset list stays accurate
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 571
File: .github/workflows/cargo.yml:162-166
Timestamp: 2026-06-06T19:59:31.071Z
Learning: In `.github/workflows/cargo.yml`, the `cargo xtask download-assets` step in `cache-warmup` is intentionally gated behind the same `if: steps.cache.outputs.cache-hit != 'true'` condition as the warmup build steps. On a warm cache hit, neither assets nor warmup builds run; the `build-kobo` jobs restore from a shared cache that already contains assets from a prior cold run. Running `download-assets` unconditionally in this job is not required.
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Respect the build order defined by LIBRARY_NAMES in xtask/src/tasks/util/thirdparty.rs — libraries later in the list may link against earlier ones, and new libraries must be inserted at the correct position
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Library versions must be defined as constants in xtask/src/tasks/util/thirdparty.rs — never hard-code URLs in build scripts
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 511
File: crates/core/build.rs:129-131
Timestamp: 2026-05-25T12:43:50.793Z
Learning: In `crates/core/build.rs`, the `generate_bundled_assets()` function intentionally skips missing asset directories (`if !dir.exists() { return; }`) to support emulator/non-Kobo builds where OTA is not used and asset directories may not be present. Any fail-fast guard for missing required directories (e.g., `bin/`, `resources/`, `hyphenation-patterns/`) should be gated on the Kobo target (`TARGET == "arm-unknown-linux-gnueabihf"`) to avoid breaking emulator builds.
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/renovate.json : Ensure Renovate regex managers in renovate.json cover new library version constants to enable automated update PRs

Applied to files:

  • renovate.json
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to **/Cargo.toml : Use caret requirements for most dependencies in Cargo.toml

Applied to files:

  • renovate.json
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Library versions must be defined as constants in xtask/src/tasks/util/thirdparty.rs — never hard-code URLs in build scripts

Applied to files:

  • renovate.json
  • crates/core/build.rs
  • crates/build-deps/src/build/native.rs
📚 Learning: 2026-06-06T19:59:31.071Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 571
File: .github/workflows/cargo.yml:162-166
Timestamp: 2026-06-06T19:59:31.071Z
Learning: In `.github/workflows/cargo.yml`, the `cargo xtask download-assets` step in `cache-warmup` is intentionally gated behind the same `if: steps.cache.outputs.cache-hit != 'true'` condition as the warmup build steps. On a warm cache hit, neither assets nor warmup builds run; the `build-kobo` jobs restore from a shared cache that already contains assets from a prior cold run. Running `download-assets` unconditionally in this job is not required.

Applied to files:

  • .github/workflows/cargo.yml
  • crates/core/build.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : The `clippy` and `test` jobs in `.github/workflows/cargo.yml` use a matrix to check every feature flag individually and in combination

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : For workspace-wide feature flags in CI, use `--workspace --all-targets --features <name>` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
  • crates/core/build.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : Only `default` and `test` features should produce build artifacts in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : For crate-specific feature flags in CI, use `-p <crate> --all-targets --features <name>` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : All feature flag combinations should run on `ubuntu-latest` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: When adding a new feature flag, add it to the relevant `Cargo.toml` and update `.github/workflows/cargo.yml` with matrix entries for both the feature alone and combined with every other feature

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: After modifying `Cargo.toml`, run `cargo xtask clippy` and `cargo xtask test --features default`

Applied to files:

  • .github/workflows/cargo.yml
  • crates/core/build.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: In CI, `cargo xtask download-assets` must run before `cargo xtask build-kobo` so the generated asset list stays accurate

Applied to files:

  • .github/workflows/cargo.yml
  • crates/core/build.rs
📚 Learning: 2026-05-25T12:43:50.793Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 511
File: crates/core/build.rs:129-131
Timestamp: 2026-05-25T12:43:50.793Z
Learning: In `crates/core/build.rs`, the `generate_bundled_assets()` function intentionally skips missing asset directories (`if !dir.exists() { return; }`) to support emulator/non-Kobo builds where OTA is not used and asset directories may not be present. Any fail-fast guard for missing required directories (e.g., `bin/`, `resources/`, `hyphenation-patterns/`) should be gated on the Kobo target (`TARGET == "arm-unknown-linux-gnueabihf"`) to avoid breaking emulator builds.

Applied to files:

  • .github/workflows/cargo.yml
  • crates/core/build.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: If code generates compile-time metadata from bundled asset directories, ensure `bin/`, `resources/`, and `hyphenation-patterns/` are present before the Kobo build starts

Applied to files:

  • .github/workflows/cargo.yml
  • crates/core/build.rs
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/+(build-kobo.sh|kobo.patch|*-kobo.patch|README-kobo.md|README-cadmus.md|Makefile-kobo) : Each library subdirectory may contain build-kobo.sh, kobo.patch, *-kobo.patch files, README-kobo.md, README-cadmus.md, and additional build system files

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/{build-kobo.sh,*-kobo.patch} : Prefer using kobo.patch for working around upstream issues rather than modifying build-kobo.sh — patches make the delta explicit and reviewable

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/** : Build scripts and patches for third-party libraries must be placed in the thirdparty directory, with no downloaded source trees committed — only build scripts and patches

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to **/*.rs : Ensure Rust code compiles without warnings

Applied to files:

  • .github/workflows/cargo.yml
  • crates/build-deps/src/build/native.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to Cargo.toml : Define dependency versions in root `Cargo.toml` under `[workspace.dependencies]`

Applied to files:

  • crates/core/build.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to **/*.rs : Prefer `?` operator over `unwrap()` / `expect()` in library and app code

Applied to files:

  • crates/build-deps/src/build/native.rs
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to **/*.rs : Avoid `unsafe` unless required and documented in Rust

Applied to files:

  • crates/build-deps/src/build/native.rs
📚 Learning: 2026-05-26T20:10:56.991Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 456
File: crates/core/src/document/mupdf_sys.rs:7-10
Timestamp: 2026-05-26T20:10:56.991Z
Learning: In `crates/core/src/document/mupdf_sys.rs` (OGKevin/cadmus), the project owner prefers safety/soundness documentation for unsafe code to be written as `///` Rust doc comments on the function (so they appear in generated rustdoc), rather than as inline `// SAFETY:` comments inside the unsafe block.

Applied to files:

  • crates/build-deps/src/build/native.rs
🪛 Betterleaks (1.3.1)
.github/workflows/cargo.yml

[high] 115-115: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 GitHub Actions: PR `#571` / 2_Analyze (rust).txt
crates/build-deps/src/build/native.rs

[warning] 73-577: CodeQL Rust autobuild indexing: macro expansion failed for one or more macros (e.g., 'bail', '$crate::format_args_nl', 'format', 'vec', 'cfg', 'assert_eq', 'assert'). Command: /opt/hostedtoolcache/CodeQL/2.25.6/x64/codeql/rust/tools/autobuild.sh (via codeql database trace-command --use-build-mode).

🪛 GitHub Actions: PR `#571` / Analyze (rust)
crates/build-deps/src/build/native.rs

[warning] 73-73: CodeQL rust autobuild warning: macro expansion failed for 'bail'


[warning] 141-141: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 154-154: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 189-189: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 219-219: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 233-233: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 236-236: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 239-239: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 250-250: CodeQL rust autobuild warning: macro expansion failed for 'bail'


[warning] 256-256: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 259-259: CodeQL rust autobuild warning: macro expansion failed for 'vec'


[warning] 270-270: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 276-276: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 284-284: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 342-342: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 351-351: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 365-365: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 373-373: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 392-392: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 393-393: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 412-412: CodeQL rust autobuild warning: macro expansion failed for 'cfg'


[warning] 444-444: CodeQL rust autobuild warning: macro expansion failed for 'cfg'


[warning] 450-450: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 458-458: CodeQL rust autobuild warning: macro expansion failed for 'bail'


[warning] 462-462: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 466-466: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 471-471: CodeQL rust autobuild warning: macro expansion failed for '$crate::format_args_nl'


[warning] 481-481: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 486-486: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 500-500: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 503-503: CodeQL rust autobuild warning: macro expansion failed for 'format'


[warning] 525-525: CodeQL rust autobuild warning: macro expansion failed for 'assert_eq'


[warning] 535-535: CodeQL rust autobuild warning: macro expansion failed for 'assert'


[warning] 569-569: CodeQL rust autobuild warning: macro expansion failed for 'assert'


[warning] 577-577: CodeQL rust autobuild warning: macro expansion failed for 'assert'

🪛 zizmor (1.25.2)
.github/workflows/cargo.yml

[error] 154-154: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 106-106: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): always restores from cache

(cache-poisoning)


[error] 112-112: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)


[error] 128-128: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)


[error] 142-142: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)


[error] 281-281: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): always restores from cache

(cache-poisoning)


[error] 287-287: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)

🔇 Additional comments (1)
renovate.json (1)

6-8: LGTM!

Also applies to: 35-37, 118-118, 146-146

Comment thread .github/workflows/cargo.yml Outdated
Comment thread crates/build-deps/src/build/native.rs
Comment thread crates/build-deps/src/build/native.rs
Comment thread crates/core/build.rs Outdated

@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

🤖 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 `@crates/build-deps/src/markers.rs`:
- Around line 39-41: The doc comment for the submodule_commit function contains
raw angle-bracketed tokens "<sha>" and "<path>" which rustdoc treats as HTML;
update the doc comment in markers.rs for pub fn submodule_commit(root: &Path,
submodule_path: &str) -> Option<String> to wrap those tokens in backticks (e.g.
`\<sha\>`/```<sha>``` style—use Markdown inline code) so they render as code
(e.g. `sha` and `path`) and no longer are parsed as HTML tags.
🪄 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 YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 931e674e-1639-43a7-9860-bc49685da282

📥 Commits

Reviewing files that changed from the base of the PR and between 56568ac and 1a2f418.

📒 Files selected for processing (6)
  • .github/actions/cargo-cache/action.yml
  • .github/workflows/cargo.yml
  • crates/build-deps/src/build/kobo.rs
  • crates/build-deps/src/build/native.rs
  • crates/build-deps/src/markers.rs
  • crates/core/build.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/core/build.rs
  • crates/build-deps/src/build/native.rs
  • crates/build-deps/src/build/kobo.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cache-warmup
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Prefer ? operator over unwrap() / expect() in library and app code
Use thiserror for custom error types and anyhow for ad-hoc errors in Rust
Use iterators over index-based loops in Rust
Use &str over String in function parameters when ownership is not needed
Prefer borrowing over cloning in Rust
Inline expressions directly into struct fields — avoid intermediate bindings solely to pass them into a struct literal
Avoid unsafe unless required and documented in Rust
Avoid premature collect() — keep iterators lazy in Rust
Ensure Rust code compiles without warnings
Prefer newtype wrappers over raw primitives for domain concepts (e.g., Fingerprint(String) instead of bare String)
Wrap String, i64, and similar primitives when the value represents a specific domain concept (fingerprints, file kinds, identifiers, etc.)
Implement Display, FromStr, and other standard traits on newtype wrappers to keep them ergonomic
Match on enum variants instead of string comparisons — the compiler catches missing arms
Comment why, not what. Avoid inline comments — extract code into well-named, documented functions instead
Avoid dead-code comments (commented-out code) in Rust
Avoid changelog comments (Modified by X on date) in Rust
Avoid divider comments (//=====) in Rust
Annotations (TODO, FIXME, HACK, NOTE) are acceptable with context in Rust
Use structured fields with the tracing crate — never use string formatting for log data
Use only structured fields for logging — data goes in fields, not format strings
Do not use module prefixes in logs — instrumentation scope provides context
Do not mix structured fields with format arguments in logging
Use debug log level for development and troubleshooting detail
Use info log level for important runtime events
Use warn log level for recoverable issues (retries, fallbacks)
Use error log level for failures requiring attention
Return domain types directly from sqlx queries instead of parsin...

Files:

  • crates/build-deps/src/markers.rs
.github/workflows/cargo.yml

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/cargo.yml: The clippy and test jobs in .github/workflows/cargo.yml use a matrix to check every feature flag individually and in combination
For workspace-wide feature flags in CI, use --workspace --all-targets --features <name> in .github/workflows/cargo.yml
For crate-specific feature flags in CI, use -p <crate> --all-targets --features <name> in .github/workflows/cargo.yml
All feature flag combinations should run on ubuntu-latest in .github/workflows/cargo.yml
Only default and test features should produce build artifacts in .github/workflows/cargo.yml

Files:

  • .github/workflows/cargo.yml
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/{build-kobo.sh,*-kobo.patch} : Prefer using kobo.patch for working around upstream issues rather than modifying build-kobo.sh — patches make the delta explicit and reviewable
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: In CI, `cargo xtask download-assets` must run before `cargo xtask build-kobo` so the generated asset list stays accurate
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 571
File: .github/workflows/cargo.yml:162-166
Timestamp: 2026-06-06T19:59:31.071Z
Learning: In `.github/workflows/cargo.yml`, the `cargo xtask download-assets` step in `cache-warmup` is intentionally gated behind the same `if: steps.cache.outputs.cache-hit != 'true'` condition as the warmup build steps. On a warm cache hit, neither assets nor warmup builds run; the `build-kobo` jobs restore from a shared cache that already contains assets from a prior cold run. Running `download-assets` unconditionally in this job is not required.
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Respect the build order defined by LIBRARY_NAMES in xtask/src/tasks/util/thirdparty.rs — libraries later in the list may link against earlier ones, and new libraries must be inserted at the correct position
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/xtask/src/tasks/util/thirdparty.rs : Library versions must be defined as constants in xtask/src/tasks/util/thirdparty.rs — never hard-code URLs in build scripts
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 511
File: crates/core/build.rs:129-131
Timestamp: 2026-05-25T12:43:50.793Z
Learning: In `crates/core/build.rs`, the `generate_bundled_assets()` function intentionally skips missing asset directories (`if !dir.exists() { return; }`) to support emulator/non-Kobo builds where OTA is not used and asset directories may not be present. Any fail-fast guard for missing required directories (e.g., `bin/`, `resources/`, `hyphenation-patterns/`) should be gated on the Kobo target (`TARGET == "arm-unknown-linux-gnueabihf"`) to avoid breaking emulator builds.
📚 Learning: 2026-06-06T19:59:31.071Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 571
File: .github/workflows/cargo.yml:162-166
Timestamp: 2026-06-06T19:59:31.071Z
Learning: In `.github/workflows/cargo.yml`, the `cargo xtask download-assets` step in `cache-warmup` is intentionally gated behind the same `if: steps.cache.outputs.cache-hit != 'true'` condition as the warmup build steps. On a warm cache hit, neither assets nor warmup builds run; the `build-kobo` jobs restore from a shared cache that already contains assets from a prior cold run. Running `download-assets` unconditionally in this job is not required.

Applied to files:

  • .github/actions/cargo-cache/action.yml
  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : The `clippy` and `test` jobs in `.github/workflows/cargo.yml` use a matrix to check every feature flag individually and in combination

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : Only `default` and `test` features should produce build artifacts in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : For workspace-wide feature flags in CI, use `--workspace --all-targets --features <name>` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : For crate-specific feature flags in CI, use `-p <crate> --all-targets --features <name>` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: Applies to .github/workflows/cargo.yml : All feature flag combinations should run on `ubuntu-latest` in `.github/workflows/cargo.yml`

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: When adding a new feature flag, add it to the relevant `Cargo.toml` and update `.github/workflows/cargo.yml` with matrix entries for both the feature alone and combined with every other feature

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: In CI, `cargo xtask download-assets` must run before `cargo xtask build-kobo` so the generated asset list stays accurate

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-25T12:43:50.793Z
Learnt from: OGKevin
Repo: OGKevin/cadmus PR: 511
File: crates/core/build.rs:129-131
Timestamp: 2026-05-25T12:43:50.793Z
Learning: In `crates/core/build.rs`, the `generate_bundled_assets()` function intentionally skips missing asset directories (`if !dir.exists() { return; }`) to support emulator/non-Kobo builds where OTA is not used and asset directories may not be present. Any fail-fast guard for missing required directories (e.g., `bin/`, `resources/`, `hyphenation-patterns/`) should be gated on the Kobo target (`TARGET == "arm-unknown-linux-gnueabihf"`) to avoid breaking emulator builds.

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-28T14:01:38.823Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-28T14:01:38.823Z
Learning: If code generates compile-time metadata from bundled asset directories, ensure `bin/`, `resources/`, and `hyphenation-patterns/` are present before the Kobo build starts

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/{build-kobo.sh,*-kobo.patch} : Prefer using kobo.patch for working around upstream issues rather than modifying build-kobo.sh — patches make the delta explicit and reviewable

Applied to files:

  • .github/workflows/cargo.yml
📚 Learning: 2026-05-27T15:13:37.212Z
Learnt from: CR
Repo: OGKevin/cadmus PR: 0
File: thirdparty/AGENTS.md:0-0
Timestamp: 2026-05-27T15:13:37.212Z
Learning: Applies to thirdparty/**/thirdparty/*/+(build-kobo.sh|kobo.patch|*-kobo.patch|README-kobo.md|README-cadmus.md|Makefile-kobo) : Each library subdirectory may contain build-kobo.sh, kobo.patch, *-kobo.patch files, README-kobo.md, README-cadmus.md, and additional build system files

Applied to files:

  • .github/workflows/cargo.yml
🪛 GitHub Actions: Cadmus Documentation / 3_build.txt
crates/build-deps/src/markers.rs

[error] 40-40: rustdoc failed: unclosed HTML tag sha. (error: unclosed HTML tag sha; implied by -D warnings in RUSTDOCFLAGS)


[error] 40-40: rustdoc failed: unclosed HTML tag path. (error: unclosed HTML tag path; implied by -D warnings in RUSTDOCFLAGS)

🪛 GitHub Actions: Cadmus Documentation / build
crates/build-deps/src/markers.rs

[error] 40-40: Rustdoc failed due to invalid HTML in doc comment: unclosed HTML tag sha. (rustdoc::invalid-html-tags implied by -D warnings)


[error] 40-40: Rustdoc failed due to invalid HTML in doc comment: unclosed HTML tag path. (rustdoc::invalid-html-tags implied by -D warnings)

🪛 GitHub Actions: PR `#571` / 0_Analyze (rust).txt
crates/build-deps/src/markers.rs

[warning] 90-90: CodeQL rust autobuild: macro expansion failed for 'format'


[warning] 93-93: CodeQL rust autobuild: macro expansion failed for 'format'


[warning] 110-110: CodeQL rust autobuild: macro expansion failed for 'format'


[warning] 119-119: CodeQL rust autobuild: macro expansion failed for 'env'


[warning] 125-125: CodeQL rust autobuild: macro expansion failed for 'assert'


[warning] 127-127: CodeQL rust autobuild: macro expansion failed for 'assert_eq'


[warning] 128-128: CodeQL rust autobuild: macro expansion failed for 'assert'

🪛 GitHub Actions: PR `#571` / Analyze (rust)
crates/build-deps/src/markers.rs

[warning] 90-128: CodeQL Rust autobuild reported "macro expansion failed" for macros including 'format', 'env', 'assert', and 'assert_eq'.

🔇 Additional comments (15)
crates/build-deps/src/markers.rs (4)

1-14: LGTM!


56-78: LGTM!


80-95: LGTM!


113-130: LGTM!

.github/actions/cargo-cache/action.yml (1)

1-66: LGTM!

The composite action properly addresses the submodule revision tracking concern from past reviews - using git ls-tree HEAD thirdparty/ to hash gitlink SHAs ensures the cache key changes when submodule pointers move. Actions are pinned to SHA, cache paths are appropriate, and the restore/save mode separation is clean.

.github/workflows/cargo.yml (10)

19-24: LGTM!


41-44: LGTM!


59-62: LGTM!


75-78: LGTM!


126-163: LGTM!


186-189: LGTM!


229-232: LGTM!


296-310: LGTM!


337-340: LGTM!


407-410: LGTM!

Comment thread crates/build-deps/src/markers.rs
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 1a2f418 to bd6957c Compare June 7, 2026 16:57
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 7, 2026 17:00 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from bd6957c to 48ed868 Compare June 7, 2026 17:01
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 7, 2026 17:04 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from 48ed868 to c976c0e Compare June 7, 2026 17:09
@OGKevin
OGKevin temporarily deployed to cloudflare-pages-preview June 7, 2026 17:12 — with GitHub Actions Inactive
@OGKevin
OGKevin force-pushed the ogkevin/push/ozwlrkrznxlp branch from c976c0e to 8053cce Compare June 7, 2026 17:27
Change-Id: bc5eecbd94d24946167efb1a7985f961
Change-Id-Short: onullnomqvmx
@OGKevin

OGKevin commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@OGKevin
OGKevin merged commit edb3154 into master Jun 7, 2026
89 checks passed
@OGKevin
OGKevin deleted the ogkevin/push/ozwlrkrznxlp branch June 7, 2026 18:34
@OGKevin OGKevin linked an issue Jun 8, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Breaking Change DevEx Refactor Release/0.11.0 size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor build-kobo.sh and setup-native to build.rs

1 participant