Skip to content

fix: keep the replay bootstrap's trigger vocabulary out of release builds - #138

Merged
GLinnik21 merged 8 commits into
mainfrom
fix/release-dev-witness
Sep 19, 2026
Merged

GLinnik21 merged 8 commits into
mainfrom
fix/release-dev-witness

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Release builds (--no-default-features) have been unpackageable since 235e519: app/bootstrap.rs and app/boot.rs named dev triggers (plxnative-noidle, …) as literals in ungated code, so ci/check-package.py correctly refused the binary ("the packaged binary is a RELEASE build (no dev triggers compiled in)"). PR CI never saw it — its cross-build is the dev configuration. Any release, canary or nightly cut from main would have failed there.
  • One gated table, dev::CONTROLLED, plus two accessors (controlled_trigger, listed) that answer false in a release build, where no trigger is ever armed. bootstrap.rs, boot.rs and dev/scenarios.rs use them instead of literals.

Evidence

Not in scope

Other plxnative-* names still in the release binary don't trip the gate (its witness is noidle only): the recording-erasure list in ui/rec.rs (kept on purpose, it only deletes) and a few log strings. Worth a follow-up.

Source-asset step (found by the nightly dry runs)

The LGPL source step had not run against main since v0.6 was cut. The nightly dry runs found three regressions in it, all fixed here:

  • Vendoring: the rcgen dev-dependency brought crates the ARM build never downloads. The step now runs cargo fetch --locked before cargo vendor --offline. The public sample keys in pem / rcgen are exempted, each pinned by path, pattern and sha256.
  • NDK path: prepare-source-release.py and verify-source-rebuild.py looked for the NDK at a hard-coded ~/webos-ndk. They now take WEBOS_SDK from the workflow and fail if it is missing.
  • Credential scan: a test fixture token looked real enough to fail the bundle scan. It is renamed, and ci/test_source_bundle.py now scans every tracked file the bundle would archive, through the same tracked_sources() selection, so this fails in make check instead of after the ARM build.

The source bundle is now named after the version the package reports, not the tracked pkg/appinfo.json template.

Verified: nightly dry run 35415575814 on #140 is green end to end (pattern_scan: PASS, archive_validation: PASS, isolated rebuild_status: PASS).

Stacked on #137; retarget to main after it merges.

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits September 19, 2026 01:44
Extract the ARM build+verify job release.yml and canary.yml each hand-kept
a copy of into a new reusable workflow, .github/workflows/build-package.yml,
parameterized by flavor, telemetry pair, and which optional steps (Homebrew
manifest, LGPL source asset, caches, firmware-database gate) apply.

The release path runs the exact same commands as before (90/90, verified by
a command-coverage script against origin/main): the only two changes are the
wrong-flavour guard and the source-asset step's ipk lookup, both now derived
from `make -s print-appid` instead of a hard-coded stable id, so a future
non-stable caller is checked correctly too.

canary.yml gains a `dry_run` dispatch input that skips `publish` so the
shared pipeline can be proven on a branch without publishing anything.

This also prepares the coming nightly caller, which needs no new copy of
the job — just another set of inputs.

Co-Authored-By: Claude Opus 5 <[email protected]>
…-closed default

Make the workflow_call contract match reality (every caller's upload step
hard-fails without SENTRY_AUTH_TOKEN), and document why source-asset
defaults true: any publisher of the package owes LGPL source, not just release.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ilds

The canary dry run (CI run 35404204884, FLAVOR=debug RELEASE=1) failed
ci/check-package.py's "the packaged binary is a RELEASE build (no dev
triggers compiled in)": the --no-default-features ARM binary carried the
dev witness `plxnative-noidle`.

Root cause: 235e519 ("refactor: establish owned UI and controlled
bootstrap") added app::bootstrap, whose Initial::validate() checked the
recorded trigger list against a `matches!` over full `plxnative-*`
literals, and boot.rs's replay path looked up `plxnative-noidle` the same
way. Neither was cfg-gated, so the recorder's whole trigger vocabulary
compiled into release. The rec/recplay/app-init readers were guarded
only at runtime (`dev::ENABLED`), which still leaves the names in the
bytes.

Fix: the vocabulary is one table in dev.rs (`CONTROLLED`), gated like
DIAG on `any(devtriggers, test)`, behind two accessors:
`dev::controlled_trigger` and `dev::listed`. Their release versions
answer false without naming a trigger, which is truthful because a
release build never arms one (`armed_triggers` is empty there).
bootstrap.rs and boot.rs are migrated to them. The rec, recplay and
app-init readers in dev::scenarios are now cfg-gated items that go
through dev's own path door. The release versions return None.

Verified: `make FLAVOR=debug RELEASE=1 ipk` FAILed that check before
the change and passes it after; `make check` green.

Co-Authored-By: Claude Opus 5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The hostsim synthetic-initial path must be updated to support the new trigger vocabulary.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR removes development-trigger vocabulary from release builds while preserving replay and bootstrap behavior in development builds.

Changes:

  • Adds gated controlled-trigger vocabulary and accessors.
  • Gates recorder, replay, and initial-value trigger readers.
  • Updates bootstrap and idle handling to use shared helpers.
File Summary
rust-modules/​src/​dev/​scenarios.rs Gates controlled-trigger readers.
rust-modules/​src/​dev.rs Adds centralized trigger vocabulary and accessors; hostsim synthetic initial generation requires adjustment.
rust-modules/​src/​app/​bootstrap.rs Uses gated trigger validation and initial loading.
rust-modules/​src/​app/​boot.rs Uses centralized trigger lookup for idle handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust-modules/src/dev.rs
Comment on lines +138 to +140
#[cfg(not(any(feature = "devtriggers", test)))]
pub(crate) fn controlled_trigger(_trigger: &str) -> bool {
false
GLinnik21 and others added 4 commits September 19, 2026 04:57
The nightly dry run (CI 35413694942) died in "Versioned source asset and
isolated reconstruction" with only a CalledProcessError: collect-source-
inputs.py swallowed cargo's stderr. Reproduced from an empty CARGO_HOME
populated with only the release ARM graph:

    error: failed to sync
    Caused by:
      failed to download packages for .../rust-modules
    Caused by:
      failed to download `asn1-rs v0.7.2`
    Caused by:
      attempting to make an HTTP request, but --offline was specified

Root cause: #104 (910b947) added the `rcgen` dev-dependency. `cargo
vendor` takes every package in Cargo.lock (all targets, dev-deps too); the
release ARM build downloads only its own graph, so the offline vendor hit
crates nobody had fetched. release/v0.6 had no such gap.

- build-package.yml: `cargo fetch --locked` (no --target) before the
  collection, pinned by Cargo.lock checksums; the collection script stays
  download-free as its contract says.
- With vendoring fixed, the next gate refused the tree: the credential scan
  matched doc/test sample keys in pem 4.0.0 (README.md, src/lib.rs) and
  rcgen 0.14.10 (src/certificate.rs). The digest-pinned DSN exemption is
  generalised to PUBLIC_SAMPLE_FILES: one pattern, one file, one digest;
  a new test proves the exemption does not cover a different pattern.
- collect-source-inputs.py run() now prints the tool's stdout/stderr (home
  shortened to ~); verify-source-rebuild.py prints the failing command and
  the last 200 lines of build.log instead of exiting silently.
- The GPL scan also covers the development telemetry pair
  (PLX_SENTRY_DSN_DEV / PLX_POSTHOG_KEY_DEV), which a telemetry:
  development build compiles in.

Evidence: empty CARGO_HOME + ARM-only fetch -> collect exit 1 with the
error above; + `cargo fetch --locked` -> collect exit 0, every archive
pattern_scan PASS. test_source_bundle.py 32/32, actionlint clean.

Co-Authored-By: Claude Opus 5 <[email protected]>
…d path

CI run 35414278456 got past vendoring and died in prepare-source-release.py:
FileNotFoundError on ~/webos-ndk/.../arm-webos-linux-gnueabi-gcc.br_real.
The NDK action now installs into $GITHUB_WORKSPACE/.webos-ndk and exposes
it as steps.ndk.outputs.sdk-dir; the source step never received it, and
both source scripts fell back to a guessed ~/webos-ndk.

- The source step passes WEBOS_SDK from steps.ndk.outputs.sdk-dir.
- prepare-source-release.py and verify-source-rebuild.py no longer guess:
  they exit with a clear FAIL when WEBOS_SDK is unset or holds no NDK
  compiler. The prepare check runs before the (slow) collection. The
  rebuild's `make` inherits the same WEBOS_SDK.
- .webos-ndk/ is gitignored. It could not reach the bundle (only tracked,
  allowlisted paths are archived, and all 26k NDK names pass safe_name),
  but it is a toolchain, never source.

Other ~/webos-ndk fallbacks (arm-cc.py, stage-link-evidence.py,
build-*.sh, check-elf.sh) mirror the Makefile's local default and every
CI call of them already passes WEBOS_SDK; left as they are.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ken-shaped fixture

Nightly dry run 5 (CI 35414736592) failed the source step's credential scan
on first-party code: a synthetic test token in
rust-modules/src/app/session_resource_tests.rs:709, long enough (20+
chars) to match the X-Plex-Token pattern. Nothing before the ARM build ever ran scan() over the
tree, so it only surfaced after a five-minute cross-build.

- The selection the bundle archives (tracked files that pass allowed(),
  release records redacted) is now ONE function, source_bundle.
  tracked_sources(); make-source-bundle.py builds from it.
- test_source_bundle.py scans every file tracked_sources() yields, with no
  private values, so `make check` sees what the release step will.
  Watched red on exactly that file, green after the rename.
- The fixture token is now "synthetic-new-tok" (under the pattern's 20
  chars). No exemption: PUBLIC_SAMPLE_FILES is only for checksum-pinned
  upstream sources.

Co-Authored-By: Claude Opus 5 <[email protected]>
…orts

The bundle name was read from the tracked pkg/appinfo.json template, so a
nightly produced plxnative-source-0.6.0.tar.gz next to a 0.7.0 nightly
package.

It is now taken from what the build produced: the package version from the
ipk's own filename (the Makefile's IPK_VERSION), plus `-nightly-<date>`
when pkg/.build-config carries the `+nightly:<date>` field, the same stamp
check-package grades the binary's reported version against. Stable has no
such field and keeps plxnative-source-X.Y.Z. release.yml and nightly.yml
both collect `plxnative-source-*.tar.gz*` by glob; no release-audit code
names the file. A label that is not X.Y.Z[-nightly-YYYYMMDD] fails the
step instead of naming a bundle wrongly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Base automatically changed from ci/reusable-build to main September 19, 2026 07:25
# Conflicts:
#	.github/workflows/build-package.yml
@GLinnik21
GLinnik21 merged commit 1e61191 into main Sep 19, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the fix/release-dev-witness branch September 19, 2026 07:40
GLinnik21 added a commit that referenced this pull request Sep 19, 2026
…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 added a commit that referenced this pull request Sep 19, 2026
…tness (#154)

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants