xg_xs: gate the console-oracle test modules behind an off-by-default feature #310
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!310
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/310/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Bexx1107 on GitHub · 2026-11-23 17:33 UTC · original
Bexx1107:xg-xs-gate-console-oracle→main· +17 −12 · 3 files · 1 commits · closed without mergingLibrary / area:
xg_xs— test target only (crates/compat/xg_xs/Cargo.toml,src/lib.rs,src/dcc.rs)Exports changed (exports.txt rows): none. The cdylib's 23
XG*exports are byte-identical before and after (nm -g --defined-onlydiff on both builds). No shipped code path changes.Fixes #303.
The problem
crates/compat/xg_xs/src/lib.rsdeclaresbut
crates/compat/xg_xs/src/oracle.rsis not in the repository, is not in.gitignore, andgit log -Sfinds no commit that ever contained it. On a clean checkout:It is not one missing file.
oracleis the module that definesObj,field,first_diff,vt,Create,Oracle,SERIALandoracle(), so the seven modules that importcrate::oracle::{…}cannot typecheck either. All 19 unit tests in the crate are unrunnable, and none of them needs console data:layout::tests::*,layout3d::tests::*,computer::tests::copy_roundtrip,computer3d::tests::copy_roundtrip_3d,tests::library_init_cycle,tests::d3d12_desc_conversion,tests::optimal_swizzle_rules,tests::validate_depth_modes,tests::buffer_layout_rules,exports_table::export_table_matches_source. Verified with--liston the built binary: 19 tests, zero of them matchingoracle.Why CI does not catch it
.github/workflows/rust.yml:135runscargo check --locked --workspace— lib/bins only, no--all-targetsfor the compat crates..github/workflows/rust.yml:45passes--all-targets, but names five crates andxg_xsis not one of them.Both jobs are green on the broken tree. Confirmed:
cargo check -p xg_xs→Finished;cargo check -p xg_xs --all-targets→ 15 errors.This is also why PR #292 has to carry the line "the crate's test target still needs the local
oracle.rsfixture, same as before this change" — its own new tests forXGSuggestSwizzleModecannot be executed by anyone reviewing it.The change
Take the second option offered in #303: gate the modules behind a
cfgthat is off by default.lib.rs:oracle,oracle_3d,oracle_xs,oracle_msaa,dcc_oracle.dcc.rs:oracle_px,oracle_dec,oracle_enc,verify_enc,oracle_cases,oracle_seq, andwatch(used only byoracle_seq; grep found no other caller).exports_tablestays on plain#[cfg(test)]— it needs no console data and is the check most worth keeping green.dcc'sencode/decode/relayout/convert/safe_format/PTRS/r16/args_ok/last_undefined/seg_info/valid_meta/tolerantare reached only from those gated tests, so with the feature off they became unreachable and produced 14 newdead_codewarnings. One line at the top ofdcc.rshandles it:I would rather this were narrower, but the alternative was exporting internals from a cdylib to satisfy a lint, which is worse. It is scoped to one module and it switches itself back off when the feature is on, so a contributor editing the oracle path still gets full dead-code warnings on the code they are working on. This is the one real cost of the patch: a genuinely dead function added to
dccin future would not be flagged in a default build. Flagging it here so it is a deliberate trade rather than a surprise.Nothing is deleted. The fixture is still expected at
crates/compat/xg_xs/src/oracle.rs; it is simply no longer required for the default build. Anyone who has it keeps exactly today's behaviour:Verification
Run on a clean clone of
f89e4106(currentmain), not an incremental tree. Both the Windows targets, sincex86_64-pc-windows-gnuis the one used for the bring-up in #293.xg_xstest-build warnings went 17 → 3, and all three trace to unpatchedmain(unused import: E_NOTIMPLandunused macro definition: unimplemented_exportin the baseline lib build;variable does not need to be mutableatdcc/enc.rs:1416in the baseline test build).What this does not do
src/oracle.rs. That file is console-derived (oracle()loads a real consolexg_xs.dll) and CONTRIBUTING.md forbids committing console files. Gating is the honest option without it, and #303 offered exactly this shape.--all-targetsbreakage on the mingw workspace target (d3d12_xscustom build command,xbtplink failure). Out of scope, still there, unchanged by this patch.This is scoped to avoid the open PRs that touch this crate or its tests.
#292addsXGSuggestSwizzleModetolib.rsin hunks at@@ -216,6and@@ -643,4(its tests); this patch only toucheslib.rslines 14–26, so the two do not overlap and should merge either order.#123,#296and#308do not touchxg_xsat all.cargo check -p xg_xs --all-targetspasses onx86_64-pc-windows-msvcandx86_64-pc-windows-gnucargo test -p xg_xsbuilds and runs: 19 passed, 0 failedoracle.rsis still absent and the feature still fails loudly when requested.rsfiles (repo rule)Cargo.lockunchanged; no new dependencies@BuHHuTlyx on GitHub · 2026-11-23 21:21 UTC · original
Independently verified
c17005a375882b9a6c55e4bb549f40e991314d8bon native Windows 11 24H2 withrustc 1.100.0(x86_64-pc-windows-msvc).cargo test -p xg_xsran all 19 tests successfully.cargo test -p xg_xs --features console-oracle --no-runon the same clean checkout produced the expectedE0583atmod oracle;.For a CI follow-up, I added
-p xg_xsto the existingcargo test --locked -p tombox-pe -p tombox-archive -p tombox-rpf -p tombox-disasm --no-fail-fastcommand locally. With this PR applied, the resulting five-crate command passed 62 tests and the workflow passedactionlint.@omonkeyz on GitHub · 2026-11-25 13:49 UTC · original
Applied on main in
2813b2a(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed