Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9ac4a58
refactor(ffi): centralize the C-ABI constants and callback types in s…
umbrella22 Oct 8, 2026
8c53630
docs(ffi): fold the C header's API documentation into the Rust doc co…
umbrella22 Oct 8, 2026
aaeb9e9
feat(ffi): generate include/uda.h with cbindgen
umbrella22 Oct 8, 2026
6d36c8f
fix(ffi): cross-review fixes for the generated header
umbrella22 Oct 8, 2026
9e45070
docs(ffi): note the const cast for freeing the last-error message
umbrella22 Oct 8, 2026
e31a1ef
fix(ffi): simplifier + review round: script hardening and media contract
umbrella22 Oct 8, 2026
3e1ad47
docs(ffi): cross-review round 3 - consistency fixes in header and specs
umbrella22 Oct 8, 2026
8b4d53c
docs: two residual consistency nits from review round 3
umbrella22 Oct 8, 2026
0d273aa
fix(ffi): keep published-empty metadata fields distinguishable from u…
umbrella22 Oct 8, 2026
b11534e
Merge remote-tracking branch 'upstream/develop' into feat/cbindgen-ge…
umbrella22 Oct 8, 2026
d6240c1
fix(ffi): regenerate the header for the published-empty metadata docs
umbrella22 Oct 8, 2026
c0a0f7d
docs: align media specs and binding notes with the NULL/empty contract
umbrella22 Oct 8, 2026
82256e9
fix(ffi): round-4 review - honest changelog, ABI parity test, script …
umbrella22 Oct 10, 2026
4162d7f
fix(ffi): cross-validation round - honest Windows qualifier, loud gates
umbrella22 Oct 13, 2026
f00aa8e
fix(ffi): keep the generated header's C semantics - unsigned caps, Ud…
umbrella22 Oct 13, 2026
d22e565
fix: clarify media command outcomes in generated ABI contract
umbrella22 Oct 13, 2026
e0e95dc
fix: final cross-review round - ABI docs, media taxonomy, header gates
umbrella22 Oct 30, 2026
891a7da
Merge upstream/develop into feat/cbindgen-generated-header
umbrella22 Nov 1, 2026
01f4cb5
fix(ffi): drop a redundant rustdoc link target after the merge
umbrella22 Nov 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ jobs:
- name: Type-check whole workspace for x86_64-pc-windows-gnu
run: cargo check --workspace --all-targets --target x86_64-pc-windows-gnu

- name: Install cbindgen (pinned, generates the C header)
run: cargo install cbindgen --locked --version 0.29.4

# include/uda.h is generated from crates/uda-ffi by cbindgen; the Rust
# sources are the single source of truth. Regenerating here and diffing
# catches a Rust change whose header update was forgotten: this step
# fails until scripts/gen-header.sh has been run and its output
# committed. The version must stay in sync with scripts/gen-header.sh.
- name: Check the generated C header is up to date
run: ./scripts/gen-header.sh --check

# ==========================================================================
# 3. Linux: unit tests, D-Bus mock fixtures, FFI build and Python example.
# ==========================================================================
Expand Down Expand Up @@ -112,6 +123,14 @@ jobs:
- name: Test uda-ffi (C-ABI)
run: cargo test --locked -p uda-ffi

# The generated header's numeric/typing contract (unsigned capability
# bits, no `UdaStatus` leaking into C) and the gen-header version gate,
# as C static asserts plus a stubbed-cbindgen run. Local regression
# script kept in CI so the guarantees never depend on someone running
# it by hand.
- name: Check the header's C-level contract
run: python3 -B scripts/test-header.py

- name: Build FFI shared library
run: cargo build --locked -p uda-ffi

Expand Down Expand Up @@ -180,10 +199,11 @@ jobs:
# guard; these variables force UTF-8 for any child process too.
PYTHONIOENCODING: utf-8
PYTHONUTF8: "1"
# `include/uda.h` is the single source of truth for the exported surface:
# every function it declares must be present in the DLL, so a missing
# `#[no_mangle]` fails the build. Hard-coding a symbol count here instead
# broke every release once Phase 2 added exports past the stale number.
# The generated `include/uda.h` is the reference for the exported
# surface: every function it declares must be present in the DLL, so a
# missing `#[no_mangle]` fails the build. Hard-coding a symbol count
# here instead broke every release once Phase 2 added exports past the
# stale number.
run: python scripts/pe_exports.py target/debug/uda_ffi.dll --expect include/uda.h

- name: Run Python example against the freshly built DLL
Expand Down Expand Up @@ -259,12 +279,13 @@ jobs:
sudo apt-get update
sudo apt-get install -y zip

# `include/uda.h` is the source of truth for the exported surface. Both
# platforms are checked against it, so the expected symbol set can never
# drift from what the crate actually declares: a new `#[no_mangle]`
# export is picked up automatically, and a *missing* one fails the build.
# Hard-coding a symbol count here instead is what broke the release check
# once Phase 2 pushed the export list past the stale number.
# The generated `include/uda.h` is the reference for the exported
# surface. Both platforms are checked against it, so the expected symbol
# set can never drift from what the crate actually declares: a new
# `#[no_mangle]` export is picked up automatically, and a *missing* one
# fails the build. Hard-coding a symbol count here instead is what broke
# the release check once Phase 2 pushed the export list past the stale
# number.
- name: Verify exported ABI symbols (Linux)
run: |
set -euo pipefail
Expand Down
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ Every code change must pass:
1. `cargo check --workspace --all-targets`
2. `./scripts/test-linux-mock.sh`
3. `cargo test -p uda-ffi`
4. `./scripts/gen-header.sh --check` (auto-installs the pinned cbindgen; the CI "Cross-Compile Hygiene" job runs the same gate)

### Verification Criteria
1. **Compilation Check:** `cargo check --workspace` must pass with zero warnings/errors.
2. **D-Bus Mock Tests:** Unit tests in `uda-platform-linux` must run inside `dbus-run-session` using `python3-dbusmock` fixtures.
3. **Cross-Compilation Hygiene:** The Linux agent must not break Windows compilation. Ensure all Windows code is gated behind `#[cfg(windows)]`.
4. **Header Sync:** If any C-ABI surface changed (exported function, signature, doc comment, constant), `include/uda.h` must be regenerated before committing.

---

Expand All @@ -163,3 +165,4 @@ Every code change must pass:
```
2. **Asynchronous Runtime:** When async is required (e.g., listening to D-Bus signals or registry events), use `tokio`. Provide synchronous wrapper methods where practical.
3. **Logging:** Use the `log` crate (`log::debug!`, `log::warn!`). Never use raw `println!` in library crates.
4. **Generated C Header:** `include/uda.h` is a build artifact generated by cbindgen (`crates/uda-ffi/cbindgen.toml`). The Rust sources are the single source of truth: exported function signatures **and their doc comments** live on the `#[no_mangle]` functions in `crates/uda-ffi/src/lib.rs`; every `UDA_*` constant and callback type lives in `crates/uda-ffi/src/abi.rs`. **NEVER edit `include/uda.h` by hand** - change the Rust side, run `./scripts/gen-header.sh`, and commit the regenerated header together with the Rust change. The cbindgen version is pinned in `scripts/gen-header.sh` and `.github/workflows/ci.yml`; bump it in both places in a dedicated, reviewed commit.
Loading
Loading