Repository navigation
ci: catch every dev-trigger name in a release binary, not just one witness - #154
Merged
Merged
Conversation
…tness PR #138 gated dev::CONTROLLED's trigger vocabulary behind devtriggers/test, but ci/check-package.py only ever grepped a packaged binary for a single DEV_WITNESS ("plxnative-noidle"). Any other plxnative-* name that leaked into a --no-default-features release build compile-time-unrelated to that witness would go undetected. It happened: ui/anim.rs's log() sink, dev/scenarios.rs's arm_profile_hwcnt(), person.rs's seed_dev_credits() log line, and five shader files' GLSL comments (embedded verbatim via include_str!) all shipped dev-trigger names into release bytes. Inventory (release lib, arm-unknown-linux-gnueabi, --no-default-features): (a) leaked dev-trigger names, now gated behind #[cfg(feature = "devtriggers")]: - ui/anim.rs: log() helper (plxnative-anim.log path) - dev/scenarios.rs: arm_profile_hwcnt() (plxnative-profile/-hwcnt) - person.rs: seed_dev_credits()'s log line (plxnative-personcredits) - shaders/{dither.glsl,fs_ambient.frag,fs_hero.frag,fs_src.frag, vs_ambient.vert}: doc comments naming plxnative-hwcnt/-overdraw/ -anim/-heroground/-drawmask, reworded to drop the literal names (b) legitimate release bytes, allowlisted in check-package.py rather than changed: the four unconditional log sinks, plxnative-remote, ui/rec.rs's and app/input.rs's erasure lists (deleting a stale devtriggers install's leftovers from the shared /tmp is correct in every build), and plxnative-anim.log (input.rs deletes this one too) Mechanism: ci/check-package.py now derives its catalog from dev.rs's own CONTROLLED and DIAG arrays via parse_dev_trigger_catalog() (regex over the source text) rather than hand-copying a list that would rot the way DEV_WITNESS itself did. dev_trigger_catalog() is the parsed set minus RELEASE_LEGITIMATE_TRIGGER_NAMES, each entry commented with why. Matching a catalog name against the binary can't be a plain substring test: Rust &str constants aren't NUL-terminated, so unrelated literals pack back-to-back with no separator, and a legitimate longer name (e.g. "plxnative-hwcnt.jsonl") can contain a real catalog name (bare "plxnative-hwcnt") as its own byte-prefix. _catalog_name_in_binary() walks every occurrence and only counts one that isn't explained by an allowlisted name sitting at that exact position, so it can't misgrade a legitimate log filename as a compiled-in trigger forever. Verified by building --lib --release --target arm-unknown-linux-gnueabi --no-default-features and scanning the resulting archive with the actual check-package.py functions, RED then GREEN: RED (pre-fix source): dev-trigger hits: ['plxnative-hwcnt', 'plxnative-overdraw', 'plxnative-personcredits', 'plxnative-profile'] check result: FAIL GREEN (post-fix source, same catalog and matcher): dev-trigger hits: [] check result: PASS make check and `cargo +nightly check --lib --no-default-features` both pass; ci/check-package.py --selftest covers the new parser, the live catalog, and the boundary-matching regression case directly. Co-Authored-By: Claude Sonnet 5 <[email protected]>
GLinnik21
force-pushed
the
fix/release-trigger-names
branch
from
September 19, 2026 11:18
063259a to
0db656c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
A RELEASE build (--no-default-features, no devtriggers/devtools) must not carry dev-trigger names. #138 added dev.rs's CONTROLLED array (gated #[cfg(any(feature = "devtriggers", test))]) plus controlled_trigger()/listed() accessors, and ci/check-package.py grades a packaged binary against a single witness: DEV_WITNESS = b"plxnative-noidle". Any other plxnative-* name could leak into release unseen, and several did.
Inventory
Built the release lib (cargo +nightly build --lib --release --target arm-unknown-linux-gnueabi --no-default-features) and scanned the resulting archive for every dev.rs CONTROLLED/DIAG name.
Leaked dev-trigger names, now gated behind #[cfg(feature = "devtriggers")]:
Legitimate release bytes, allowlisted in check-package.py rather than changed:
Deliberately out of scope: the ~80 bare names read via dev::flag/dev::read outside CONTROLLED/DIAG (e.g. plxnative-play, plxnative-login, plxnative-url). Some are parsed by tests/run.py as a harness contract; others live inside dev::scenarios functions too deeply coupled to core App state to gate without a much larger refactor. CONTROLLED ∪ DIAG is dev.rs's own explicit, already-gated "trigger identity" vocabulary — its own doc comment says this is exactly what ci/check-package.py grades as "dev triggers compiled in" — so that is the catalog this check now audits.
Mechanism
ci/check-package.py now derives its catalog from dev.rs's own CONTROLLED and DIAG arrays via parse_dev_trigger_catalog() (regex over the source text), instead of a hand-copied list that would rot the way DEV_WITNESS itself did. dev_trigger_catalog() is the parsed set minus RELEASE_LEGITIMATE_TRIGGER_NAMES, each entry commented with why it's allowed.
Matching a catalog name against the binary can't be a plain substring test: Rust &str constants aren't NUL-terminated, so unrelated string literals pack back-to-back in .rodata with no separator at all — a real ARM release build was observed to contain one contiguous byte run where an allowlisted longer log filename was immediately followed by an unrelated word, no gap anywhere. That means a legitimate, allowlisted longer name can contain a real catalog name as its own byte-prefix — a naive "name in blob" check would misgrade that catalog name as "found" forever, with no source change able to turn it green. _catalog_name_in_binary() walks every occurrence of a name and only counts one that is not explained by an allowlisted longer name sitting at that exact byte position.
Red to green
Built --lib --release --target arm-unknown-linux-gnueabi --no-default-features and scanned the resulting archive with the actual check-package.py functions, before and after the source fixes above:
RED (pre-fix source, new catalog-based check):
GREEN (post-fix source, same catalog and matcher):
Test plan
🤖 Generated with Claude Code