[pr-fix] darner: an empty DARNER_SHADER_ONLY no longer hides every container #410

Manually merged
TrustNo1 merged 1 commit from qnjk/Darner:shader-info-empty-filter into main 2026-12-05 04:50:35 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: darner shader-info parsed its filter as

    let only: Option<Vec<String>> = std::env::var("DARNER_SHADER_ONLY")
        .ok()
        .map(|v| v.split(',').map(|h| h.trim().to_ascii_lowercase()).filter(|h| !h.is_empty()).collect());
    

    (apps/darner/src/shader.rs). A variable that is present but empty gives Ok("") and so Some(vec![]), whose any is false for every container: the scan skipped every container before Container::parse and reported containers found 0 (in 0 files) plus the "shaders may sit in compressed or encrypted archives" hint, for a folder full of shaders. An empty value really does reach the process this way — a launcher that passes a variable through with nothing set (Command::env(k, ""), .NET ProcessStartInfo, Node env) puts a NAME= entry in the environment block; PowerShell deletes the variable instead, which is why the difference was easy to miss.

  • This change extracts the parse into only_hashes, which returns None when the value names no hash after splitting and trimming, and None and Some(list) keep behaving exactly as before otherwise. It is the rule the tree already follows elsewhere: darner-core's env_path filters empty values (config.rs:100, pinned by empty_env_values_are_ignored), and DARNER_TRANSLATE_ONLY is applied only when non-empty (translate.rs:661).

How it was tested

  • Tested revision: d9928a1 (one commit on f3840d7).
  • Commands and results:
    • cargo test --locked -p darner — 149 passed, 0 failed, 1 ignored (the crate has no lib target; the bin's tests are the 149).
    • New test shader::tests::an_empty_only_list_names_no_hashes: None, Some("") and Some(" , ") all yield None (no filter), and Some(" ABC, def ") still yields Some(["abc", "def"]) — trimming, case folding and comma splitting are unchanged.
    • Fail-before, with only the old parse put back and the test kept:
      shader::tests::an_empty_only_list_names_no_hashes ... FAILED
        assertion `left == right` failed
          left: Some([])
         right: None
      
    • End-to-end with an environment entry that is genuinely empty (ProcessStartInfo.EnvironmentVariables['DARNER_SHADER_ONLY'] = ''): on main a folder holding one synthetic 32-byte DXBC container reports containers found 0 (in 0 files) and the "none found" hint; with this change it reports containers found 1 (in 1 files). With DARNER_SHADER_ONLY=" 252D095627775C35 ," the matching container is still selected and a non-matching hash still reports 0.
    • cargo clippy --locked -p darner --all-targets -- -D warnings passes.
  • Changes a default: no. Unset and a real list behave exactly as before; only a present-but-empty value changes, and it now means "no filter" as it does in the rest of the tree.
  • A/B result, for a change of a default (on for everyone) or a speed claim: not applicable — no default changes and no speed claim. The end-to-end runs above are the before/after on the same folder and container.
  • Gates run on that revision:
    • Gate 1, cargo clippy --workspace --all-targets --locked -- -D warnings: passes.
    • Gate 2, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.
    • Gate 3, cargo test --workspace --locked: not green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request: darner-gpu stands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependent flakes of #150; darner-shader fails emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes. darner's own suite is green.
  • Gameplay, when relevant: not applicable — this is the offline shader-info scan, not the runtime.
  • Shader wave sizes tested, when relevant: not applicable — no lowering change; the test containers are synthetic.
  • Hardware dependence: none.
  • Coverage gaps: only shader-info's filter was checked end to end; DARNER_SHADER_SAVE and --disasm were not re-run, and the end-to-end container is synthetic, not from the title.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
    • Not applicable: the change is in the offline shader-info scan. The evidence is the unit test plus the same-folder before/after run above.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md. (cargo xtask policy: 555 files ok.)
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found. No open pull request changes apps/darner/src/shader.rs (checked against the file list of all 161 open pull requests), and no open or closed issue mentions DARNER_SHADER_ONLY or shader-info.
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: `darner shader-info` parsed its filter as ```rust let only: Option<Vec<String>> = std::env::var("DARNER_SHADER_ONLY") .ok() .map(|v| v.split(',').map(|h| h.trim().to_ascii_lowercase()).filter(|h| !h.is_empty()).collect()); ``` (`apps/darner/src/shader.rs`). A variable that is **present but empty** gives `Ok("")` and so `Some(vec![])`, whose `any` is false for every container: the scan skipped every container before `Container::parse` and reported `containers found 0 (in 0 files)` plus the "shaders may sit in compressed or encrypted archives" hint, for a folder full of shaders. An empty value really does reach the process this way — a launcher that passes a variable through with nothing set (`Command::env(k, "")`, .NET `ProcessStartInfo`, Node `env`) puts a `NAME=` entry in the environment block; PowerShell deletes the variable instead, which is why the difference was easy to miss. - This change extracts the parse into `only_hashes`, which returns `None` when the value names no hash after splitting and trimming, and `None` and `Some(list)` keep behaving exactly as before otherwise. It is the rule the tree already follows elsewhere: `darner-core`'s `env_path` filters empty values (`config.rs:100`, pinned by `empty_env_values_are_ignored`), and `DARNER_TRANSLATE_ONLY` is applied only when non-empty (`translate.rs:661`). ## How it was tested - Tested revision: `d9928a1` (one commit on `f3840d7`). - Commands and results: - `cargo test --locked -p darner` — 149 passed, 0 failed, 1 ignored (the crate has no lib target; the bin's tests are the 149). - New test `shader::tests::an_empty_only_list_names_no_hashes`: `None`, `Some("")` and `Some(" , ")` all yield `None` (no filter), and `Some(" ABC, def ")` still yields `Some(["abc", "def"])` — trimming, case folding and comma splitting are unchanged. - Fail-before, with only the old parse put back and the test kept: ``` shader::tests::an_empty_only_list_names_no_hashes ... FAILED assertion `left == right` failed left: Some([]) right: None ``` - End-to-end with an environment entry that is genuinely empty (`ProcessStartInfo.EnvironmentVariables['DARNER_SHADER_ONLY'] = ''`): on `main` a folder holding one synthetic 32-byte DXBC container reports `containers found 0 (in 0 files)` and the "none found" hint; with this change it reports `containers found 1 (in 1 files)`. With `DARNER_SHADER_ONLY=" 252D095627775C35 ,"` the matching container is still selected and a non-matching hash still reports 0. - `cargo clippy --locked -p darner --all-targets -- -D warnings` passes. - Changes a default: no. Unset and a real list behave exactly as before; only a present-but-empty value changes, and it now means "no filter" as it does in the rest of the tree. - A/B result, for a change of a default (on for everyone) or a speed claim: not applicable — no default changes and no speed claim. The end-to-end runs above are the before/after on the same folder and container. - Gates run on that revision: - Gate 1, `cargo clippy --workspace --all-targets --locked -- -D warnings`: passes. - Gate 2, `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passes. - Gate 3, `cargo test --workspace --locked`: **not green on this machine, and not because of this change.** Three pre-existing failures, each covered by an open pull request: `darner-gpu` stands still in parallel on the test deadlock #224 describes, and serially finishes 1772 passed and 1 failed (`pipeline::make::tests::a_capped_draw_waits_once_then_drops`, which passes on its own) beside the order-dependent flakes of #150; `darner-shader` fails `emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders`, whose fixture #227 fixes. `darner`'s own suite is green. - Gameplay, when relevant: not applicable — this is the offline `shader-info` scan, not the runtime. - Shader wave sizes tested, when relevant: not applicable — no lowering change; the test containers are synthetic. - Hardware dependence: none. - Coverage gaps: only `shader-info`'s filter was checked end to end; `DARNER_SHADER_SAVE` and `--disasm` were not re-run, and the end-to-end container is synthetic, not from the title. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - Not applicable: the change is in the offline `shader-info` scan. The evidence is the unit test plus the same-folder before/after run above. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. (`cargo xtask policy`: 555 files ok.) - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found. No open pull request changes `apps/darner/src/shader.rs` (checked against the file list of all 161 open pull requests), and no open or closed issue mentions `DARNER_SHADER_ONLY` or `shader-info`. - Replaces or overlaps: none found
The switch was parsed into an `Option<Vec<String>>` whose `Some` survived an
empty value, so `DARNER_SHADER_ONLY=` (or " " or ",") matched no container at
all: the scan skipped every container before `Container::parse` and the run
printed "containers found 0" with the "shaders may sit in compressed or
encrypted archives" hint — a false negative for a directory full of shaders.
An empty environment value means unset here as it does for the paths in
darner-core's config (`config.rs:100`, `empty_env_values_are_ignored`) and for
`DARNER_TRANSLATE_ONLY`, which only applies a non-empty list (translate.rs:661).
Parse the value in `only_hashes`, which returns `None` when the variable names
no hash, and pin it with a unit test: unset, "", " , " all now scan every
container, while a real hash still selects.
TrustNo1 manually merged commit bf6b02826c into main 2026-12-05 04:50:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!410
No description provided.