Skip to content

Never pick a plain-HTTP server address the app can't use (#95) - #104

Merged
GLinnik21 merged 18 commits into
mainfrom
fix/probe-plaintext-winner
Sep 16, 2026
Merged

GLinnik21 merged 18 commits into
mainfrom
fix/probe-plaintext-winner

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Fixes #95. Likely also the cause of #90. Refs Sentry PLX-NATIVE-J (sign-in fails at discovery).

Root cause

Discovery probes every address plex.tv lists for a server, over HTTPS plus a synthesized plain-HTTP copy of each. When every HTTPS path fails (router blocking plex.direct DNS, dead Docker bridge addresses), only the plain-HTTP copy answers. The race accepted it as the winner, which:

  • stopped the relay from being tried, and
  • registered and saved an address that release builds refuse to send Plex credentials over (security: refused plaintext PMS credentials; HTTPS required).

Every request then failed. Profile switch and the endpoint refresh re-ran the same race and picked the same address, forever ("Can't reach your Plex server").

Fix

  • One rule: CredentialPolicy (plex/origin.rs) decides whether an origin may carry a credential. Candidate synthesis, the race, activation, the request guard and media URLs all use it. The old duplicate rule (activation_allowed*) is deleted.
  • Race: a verified plain-HTTP answer the build can't use never becomes first/best and doesn't suppress the relay. It yields Reach::InsecureOnly. Precedence: At > InsecureOnly > Refused > No.
  • Pinning: the discovery probe for a LAN plex.direct name dials the address plex.tv advertised (ResolvePin), so it works behind DNS-rebind protection and the LAN wins over HTTPS. TLS still verifies the name.
  • InsecureOnly reaches the user: sign-in, rediscovery and profile-switch copy; "Not secure" in Sources and the library menu. Endpoint and roster refresh publish their probe results instead of dropping them when nothing reached.
  • Stored sessions that already hold a plain-HTTP origin repair through the existing endpoint/roster refresh. Fixed a bug found on the way: an endpoint repair didn't update the active profile's cached record.
  • Telemetry: server-less PostHog events omit server_connection/ip_version instead of sending unknown. The registry records tier + IP version atomically, derived from the stored address. Playback reports snapshot the connection at request time.
  • cargo test --lib --no-default-features compiles again.

Tests

  • Watched red first (661a8ada): the Full-screen "Can't reach your Plex server" after profile switch on webOS 10.3.1 (k8lpn2, v0.6.6) #95 topology (14 dead gateways, LAN whose HTTPS name won't resolve, custom domain answering 400 over HTTP, working relay).
  • Then pinned-LAN-wins, dev-policy counterpart, precedence, a TLS-only activation invariant, InsecureOnly consumers, stored-session repair, and connection facts.
  • make check: both cargo test passes and lint are green. Its final ci/check-deps.sh step fails on main already (syntax error from f7a2f29), unrelated.

Still to do before merge

  • Cleanup: collapse leftover register_*_with_connection twins and a dead event_for_server.
  • Docs audit and doc fixes.
  • Final independent review.
  • Owner approval of new copy and the PRIVACY.md table text.
  • Release-build check on a LAN with plex.direct blocked.

Follow-ups (not here): probe failure classes and a per-discovery summary; a one-off "Report problem" button at pre-consent failure screens (depends on the v0.7 forward-port); store-build loopback tests in plex::/route:: need an HTTPS test server.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SrKSG2UzMzwPKaZmxkbjcV

GLinnik21 and others added 11 commits September 16, 2026 17:13
…ported reached

probe_server_racing treats a candidate as `result.first` the moment ANY direct
answer verifies (settle_probe_message), regardless of whether
activation_allowed would let this build put a credential on it — so relay's
`race_batch` is skipped (`if batch.first.is_none() && !relay.is_empty()`)
whenever a plaintext LAN twin answers first, even though a store build can
never register that origin. The function's tail then returns
`Reach::At(best.candidate, best.origin)` unconditionally, with no
activation_allowed check on `best` either, so a plaintext-only winner is
reported reached and persisted (`SourceRef::origin_url`) although every
subsequent library request against it fails.

Three new host tests reproduce the reporter's topology (14 dead Docker bridge
gateways, a real LAN connection whose plaintext twin answers but whose HTTPS
candidate cannot resolve, a remote custom HTTPS connection whose twin answers
400, and a relay that verifies): the direct race returns the plaintext
origin instead of dialling and returning the relay; resolve_roster_using
records a plaintext origin_url; and with no relay to fall back to, a
plaintext-only answer is still reported Resolved::Reached. All three fail on
main. No fix included.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ials

Add plex::origin::CredentialPolicy { HttpsOnly, AllowPlaintext } with
build() as the ONLY cfg!(feature = "devtriggers") for this rule, and
may_carry_credential(origin). Migrate http::credential_transport_allowed_by_policy
and curlio's media_url_allowed_by_policy test seam from a bare bool to the
enum, with their tests updated to match.

auth::activation_allowed_by_policy keeps its bool signature for now (it is
deleted in the next step of this change) but is rewired internally onto
CredentialPolicy so there is exactly one cfg! left for the whole rule.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
plex::probe::plan/candidates now take a CredentialPolicy explicitly, and
Candidate grows credential_eligible + ProbePlan grows policy — computed
once at synthesis rather than re-derived by every consumer. The plaintext
twin is still generated; it just now says whether this build could ever
put a token on it.

auth::resolve_roster_using (pure) takes the policy as a parameter; its two
live edges (resolve_roster_live_while, probe_profile_resource_live) call
CredentialPolicy::build(). Every other call site — the app/session_*_tests
fixtures, plex/transcoder.rs, and every probe::plan/candidates/Candidate{}
literal in auth.rs's own tests — is updated to pass a policy explicitly,
per the plan's rule that tests never re-derive the build's own policy.

The 3 issue_95 regression tests remain red, as expected at this point in
the change — they are fixed by the race-semantics step that follows.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The probe race used to record result.first the moment ANY candidate
verified, gated only activation on CredentialPolicy — so on a LAN whose
plex.direct name a rebind-protecting router blocks, the plaintext twin
answering before relay could run left probe_server_racing returning
Reach::At for an origin no store build could ever put a token on, and the
relay that actually verifies never got dialled.

Candidate::credential_eligible (from the previous step) now gates entry
into result.first/result.best directly, in settle_probe_message: an
ineligible-but-verified answer is kept as result.insecure (best-scored,
never activated) instead, which is what lets probe_server_racing's
"relay runs when nothing eligible has verified" keep working. The legacy
probe_server test seam applies the same rule.

New Reach::InsecureOnly(Candidate) carries that outcome with precedence
At > InsecureOnly > Refused > No. Resolved::None grows an insecure flag
so resolve_roster_using can report it. auth::activation_allowed and
activation_allowed_by_policy are deleted — eligibility is decided once,
at synthesis, not re-asked at activation.

Outcome::InsecureOnly, Discovery::InsecureOnly, the softer rebind-hint
copy, and the R2 NoReachable-carries-settled-probes plumbing are left for
the next step (marked `// step 5:` at each minimal compiling mapping);
this step only fixes the race's own semantics and what a store build can
ever record or activate.

The 3 issue_95 regression tests (red since the tests-only commit that
opened this branch) now pass, along with new coverage: a dev-build
(AllowPlaintext) counterpart where the LAN twin legitimately wins and
relay is never dialled, InsecureOnly-outranks-Refused and
late-eligible-after-early-plaintext precedence cases, an invariant that
every activated/Reach::At origin is TLS under HttpsOnly across this
file's racing fixtures, and probe.rs coverage that CredentialPolicy only
ever changes eligibility, never which candidates rules 1/2 keep.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…tep 4)

race_batch now builds a ResolvePin for every https://…plex.direct candidate
from the same Candidate::address it already carries (ResolvePin::for_origin)
and hands it through get_identity to http::request_probe's TLS arm — the
identical mechanism register_origin/install already use to re-dial a
persisted origin, run one step earlier, at the dial that decides a winner
rather than only after one is already decided.

This is what turns a router's DNS-rebind protection (every *.plex.direct
name answers NXDOMAIN) from a permanent relay detour into an ordinary
pinned LAN HTTPS winner: the TLS candidate itself can now verify even
though no resolver ever reaches its name. The plaintext arm is untouched —
a pin belongs to a TLS name, never a literal — and a candidate whose
dashed label does not encode its own address simply gets no pin and
resolves through DNS exactly as before.

ProbeDial gains an Option<&ResolvePin> parameter; every fixture and the
existing issue_95_* tests are updated mechanically and keep exercising the
unpinned path. New tests cover: a pinned LAN candidate winning outright
with the relay never dialled; the same winner persisting as the
plex.direct name (not the dialled address) through resolve_roster_using;
a mismatched/undecodable label getting no pin; and request_probe handing
the pin to the TLS path only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…istry (#95 step 5)

Migrates probe::Outcome::InsecureOnly and the browse-layer SourceState::InsecureOnly
through every consumer the plan named: serde/Canon encoding, plex::servers's probe
code table, browse's reachable()/set_reachable(), the source list's "Not secure"
label, and the library menu's state ordering.

Discovery::InsecureOnly now folds out of Resolved::None{insecure:true} with the
stated precedence (At > InsecureOnly > Refused > No), reported through one shared
DISCOVERY_INSECURE_ONLY_MESSAGE const at both the sign-in and rediscovery call
sites (placeholder copy, pending the owner's approval of the exact wording). The
profile-switch worker (S7) reports the same message instead of "has no access to
this server" when a grant's only settled probe is InsecureOnly.

R2/A5: a worker outcome with nothing to REGISTER still PUBLISHES what it proved.
ServerRosterOutcome::NoReachable and EndpointProgress now carry their SettledProbes
through to the owner, which commits them as registry-only RegistryPlan::Probe
entries (no credentials, no lifecycle write) instead of retiring silently.

A3: publish_settled_probe derives its IpVersion from the verified candidate's own
address via SettledProbe's new address field, through the already-existing
Client::set_connection — never from origin.host(), which is a plex.direct name.

Verified compiling under default features, --no-default-features, and
--features hostsim; cargo test --lib passes 3366/3406 respectively (hostsim adds
the sf_feed-only cases). make lint is clean. make check fails only at the
pre-existing ci/check-deps.sh syntax error from an earlier merge, unrelated to
this change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A session saved before pinning existed carries an http:// primary and
source forever unless something rewrites it. It already can: the same
apply_refreshed_endpoint / refreshed_sources / reconcile_primary path
that follows a moved LAN address follows a scheme upgrade too, with no
separate rule needed. Tests pin that at the unit level (auth.rs) and
end to end through the real owner/worker pipeline
(session_plaintext_repair_tests.rs).

That end-to-end test caught a real bug, watched red first: the Endpoint
commit in auth/owner.rs never called next.refresh_profile_record(), so
a repaired origin reached Session::server and Session::sources but not
the active profile's cached ProfileCreds record — the ProfileRoster
commit a few lines above it does call it, this one didn't. An offline
reseat of that profile would have kept dialling the stale plaintext
origin forever. Fixed by adding the same call before the commit's
credential patch is built.

Also test the owner-dedup half of the "at most one RequestEndpoint per
backoff step" bound (S6): request_endpoint refuses a re-fire for a sid
already pending. No single seam drives pms.rs's backoff ladder and the
owner's admission gate together, so this tests the dedup half directly
and points at the ladder's own existing test in pms.rs, per plan.

S8: renamed SourceRef::usable to SourceRef::dialable (and every call
site) to stop it reading as a credential-eligibility verdict, which is
decided only by CredentialPolicy at probe/request time. Documented that
split on the method itself and on Session::server_dialable, which is
unrenamed and already named correctly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
cargo test --no-default-features never compiled: dev.rs's
a_directory_is_not_an_armed_trigger calls is_armed_trigger, which is
#[cfg(feature = "devtriggers")]-only. The function is compiled out
entirely in that build, not merely dead behind the runtime ENABLED
check the test already had, so no runtime guard could save it. Gated
the test itself the same way.

That was the only compile error in either --no-default-features
target (cargo check --lib and cargo test --lib --no-run both already
came back clean beyond it). auth:: http:: plex:: curlio:: run 3371 +
40 = confirmed below.

Running the tests surfaced a separate, pre-existing gap this step does
not fix: several test fixtures across plex::client, plex::transcoder,
route::decision and app::bridge build a Client against a plaintext
Origin::http(...) carrying a real per-request token and then drive a
real loopback listener. Under HttpsOnly those requests are correctly
refused before ever dialing (that refusal is the entire point of
#95), so the fixture's spawned accept()/join() blocks forever instead
of ever seeing the connection. Confirmed instances:
  plex::client::tests::malformed_2xx_remains_a_response_after_its_deadline_passes  (hangs)
  plex::transcoder::tests::transcode_ping_distinguishes_present_absent_and_unknown_cleanup_state  (fails fast)
  plex::transcoder::tests::transcode_stop_closes_its_exact_streaming_resource  (fails fast)
  plex::transcoder::tests::resource_close_is_posted_and_accepts_only_terminated_or_absent  (fails fast)
  app::bridge::tests::production_bridges_do_not_share_browse_state_or_landings  (hangs)
  route::decision::tests::* — at least 8 more observed FAILED/hung the same way
Fixing these needs a real (or believable) TLS test harness for the
loopback fixture, which is not test-only and not in scope here; not
attempted. auth:: has no such fixtures at all (zero TcpListener
tests), and http::/curlio:: pass clean — hence the auth:: http::
curlio:: filter below stays green while a bare `--lib` run does not.

CARGO_INCREMENTAL=0 cargo +nightly test --manifest-path rust-modules/Cargo.toml \
  --lib --no-default-features -- auth:: http:: curlio::
  -> 145 passed; 0 failed (101 auth::, 44 http::/curlio::)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…nown (#95 step 8)

Server-less usage events (app.launch, route.entered, signin.*) now omit
server_connection/ip_version entirely instead of sending a hardcoded
"unknown" (UsageContext::for_server(None), posthog.rs serialization,
consent preview text, PRIVACY.md, CONTEXT_SPECS domain text). The wire
schema stays tolerant of a spooled envelope written before either field
could be omitted.

Introduce plex::servers::ConnectionFacts{tier, ip} as the one registry
shape: register_origin/register_captured_origin/install and their test
seams apply it to the published Client INSIDE the same write that
creates or re-points a slot, never as a separate post-hoc set_link/
set_connection call a caller could forget or a re-point could race.
None in either field means leave unchanged, never "set unknown" (A1) --
a same-origin retoken that knows nothing new about the connection must
not blank a tier/IP a previous activation already proved. Every
production call site now derives the IP family from the candidate's
own advertised address rather than Origin::host() (R3(a) -- a
plex.direct origin's host is a certificate name IpVersion::of_host
cannot parse), including the boot primary/RegistryPlan::Primary path
(A2: ReadyCreds/SessionFx::Ready now carry the stored address) which
previously set no connection facts at all. Removed the remaining bare
set_link calls from production paths.

player::report snapshots (link, ip) once in requested() and replays
that frozen pair for every event on the attempt (diag::event_for_
connection / UsageContext::for_snapshot), instead of re-reading the
live client at emit time -- a mid-attempt re-point can no longer
relabel events already in flight for that attempt.

Tests: server-less event omits both keys on the wire; a spooled
envelope missing them still decodes; same-origin retoken with
ConnectionFacts::default() preserves the prior tier/ip; a re-point
with Some sets both; a boot primary install of a plex.direct origin
derives ip v4 from the stored address; an attempt's connection
snapshot survives a mid-attempt re-point.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Commit dc6f39f landed ConnectionFacts by keeping every old registration
signature and adding a *_with_connection twin beside it, instead of
threading the parameter through. Collapse to one function each:

- plex::servers::register_origin and register_pinned_with_client_id now
  take `connection: ConnectionFacts` directly; register_origin_with_connection
  and register_pinned_with_client_id_and_connection are deleted, and every
  caller (auth.rs, app/adapters/session.rs, player/report.rs,
  app/session_protocol_tests.rs, servers.rs's own tests) passes
  ConnectionFacts::default() explicitly where it genuinely knows nothing.
- register_origin_with_client_id now forwards into register_pinned_with_client_id
  with pin: None instead of repeating the register_lazy call — the two were
  behaviourally identical wrappers.
- register_captured_origin_with_connection had no old-signature twin to begin
  with (dc6f39f renamed it outright), so it is left as is.

diag::event_for_server was a second, live-reading producer kept only so a
dispatch-coverage test had a server-addressed door to call, marked
#[allow(dead_code)] outside tests. Removed; the test now goes through
event_for_connection (the one production path, used by player::report)
with ServerId::UNSET and no snapshot, so there is one way to attach server
context to an event. UsageEnvelope::capture_for_server, which existed only
to back event_for_server, is removed with it.

Scanned the rest of the #95 branch diff (git diff 661a8ad) for other
kept-old-signature shims or a second place deciding plaintext eligibility
besides CredentialPolicy: found none. auth::activation_allowed, the
candidate the task description named as a duplicate-decision risk, was
already deleted earlier in the branch; eligibility is decided once, at
probe::candidates synthesis, from CredentialPolicy.

Gates: cargo test --lib (3417 passed under --features hostsim, 3377
default) and make check both green apart from the pre-existing
ci/check-deps.sh syntax error from merge f7a2f29 (not touched here);
CARGO_INCREMENTAL=0 cargo +nightly check --no-default-features clean;
make (ARM cross-build) links pkg/plxnative.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
plex/CLAUDE.md and docs/shared-servers.md still described the deleted
auth::activation_allowed and said the first verified answer "still counts
as reached" — the exact bug issue #95 fixed. probe::candidates now stamps
Candidate::credential_eligible from CredentialPolicy at synthesis, and
only an eligible answer can become first/best/activated; a verified
plaintext-only answer in a store build ends as Reach::InsecureOnly /
Outcome::InsecureOnly / SourceState::InsecureOnly ("Not secure"), which
outranks a 401 rather than counting as reached.

Also updated plex/CLAUDE.md's mention of register_origin_with_connection/
register_pinned_with_client_id_and_connection to the collapsed
register_origin/register_pinned_with_client_id signatures from the
preceding commit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review September 16, 2026 18:24
Copilot AI lite review requested due to automatic review settings September 16, 2026 18:24
GLinnik21 and others added 4 commits September 16, 2026 21:26
…file record

probe_endpoint_work's early exits (plex.tv unreachable, no matching
resource, cancelled) fabricated a SettledProbe{Outcome::Unreachable}
even though nothing was ever dialled. That fabricated verdict then
overwrote a real, more specific probe result (InsecureOnly/
Unauthorized) once the owner committed it as a RegistryPlan::Probe,
bypassing the "preserve the more specific verdict" rule
commit_reachability_if_current already enforces for generic request
failures. EndpointProgress.probe/EndpointFact.probe are now
Option<SettledProbe>; every early exit returns None, and the owner's
Observation::Endpoint handling only plans a RegistryPlan::Probe when
there is a real probe to report, retiring the request otherwise.

The endpoint commit's Some(fresh) arm also discarded
refresh_profile_record's own return, gating plan.credentials on
`changed` alone — unlike the ServerRoster Reconcile arm a few lines
above, which already includes `repaired`. An endpoint reply whose
route facts exactly match what's stored but whose active profile's
cached record was stale never got repaired on disk. Now gated on
`changed || repaired`, matching the Reconcile arm.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ster publish

Five independent minor fixes from PR #104 review:

- observation.rs's write_probe now encodes SettledProbe::address in
  the recorder/replay Canon; it affects application state
  (publish_settled_probe derives the client's IP generation from it)
  and was silently omitted, so a replay could diverge on exactly the
  field that decides what gets published.

- servers.rs's register_origin_with_client_id was a pure one-line
  forwarder to register_pinned_with_client_id with a single test
  caller; deleted, and both call sites (register_with_client_id and
  the https-repoint test) now call register_pinned_with_client_id
  directly.

- diag/schema.rs's UsageContext::for_server(Option<ServerId>) had no
  caller that ever passed Some(_); collapsed into the no-server form
  current(), and the stale rustdoc link to the deleted
  UsageEnvelope::capture_for_server retargeted to capture_for_snapshot.

- player/report.rs packed ATTEMPT_SERVER/ATTEMPT_LINK/ATTEMPT_IP
  (three separate atomics) into one documented AtomicU64... (AtomicU32)
  ATTEMPT_CONNECTION, so requested()/emit() publish/observe the
  attempt's server slot and connection facts with a single store/load
  instead of risking a torn read across three.

- auth.rs's server_roster_worker_with_output published every settled
  probe twice: once live via RegistryProgress::Settled as the race
  ran, and again in the terminal ServerRosterOutcome's settled list.
  The live per-server publish is dropped for this worker only; it is
  a background refresh with no race screen watching it, unlike
  discover_and_store's sign-in flow, which keeps publishing both
  because it really does drive a live Sources/QR screen off
  RegistryProgress::Activate.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…allowlist

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot stopped reviewing on behalf of GLinnik21 due to an error September 16, 2026 18:44

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.

Note

Copilot was unable to run its full agentic suite in this review.

Pull request overview

This PR extends the Plex discovery/registration pipeline to distinguish “verified but credential-ineligible” servers (plaintext-only under store policy) as a first-class InsecureOnly state, while also making telemetry connection metadata more accurate and race-free.

Changes:

  • Add CredentialPolicy and stamp per-candidate credential_eligible, producing a new aggregate verdict Outcome/SourceState::InsecureOnly (“Not secure”) and preserving it across generic failures.
  • Apply connection facts atomically at registration time via ConnectionFacts, and snapshot attempt connection metadata to avoid torn telemetry.
  • Omit server_connection / ip_version fields entirely for server-less telemetry events; extend tests and docs accordingly.

Reviewed changes

Copilot reviewed 35 out of 36 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rust-modules/src/ui/source_list.rs Adds UI wording + dimming behavior for InsecureOnly.
rust-modules/src/telemetry/posthog.rs Omits optional connection props when absent; adds decoding/encoding tests.
rust-modules/src/screens/library/menu.rs Adds InsecureOnly to UI state stamping.
rust-modules/src/plex/transcoder.rs Updates probe candidate API call signature in tests.
rust-modules/src/plex/session.rs Renames usable → dialable and clarifies semantics in docs/tests.
rust-modules/src/plex/servers.rs Adds ConnectionFacts, plumbs into registration/commit logic, adds InsecureOnly probe code.
rust-modules/src/plex/probe.rs Introduces CredentialPolicy parameterization, credential_eligible, and plan-carried policy.
rust-modules/src/plex/origin.rs Adds centralized CredentialPolicy and may_carry_credential rule.
rust-modules/src/plex/mod.rs Re-exports new policy/facts types and adjusts registry surface exports.
rust-modules/src/plex/client.rs Adds apply_connection with “leave unchanged” semantics for atomically-applied facts.
rust-modules/src/plex/CLAUDE.md Updates module-level guidance for pinning + eligibility/activation semantics.
rust-modules/src/player/report.rs Packs attempt server/link/ip snapshot into one atomic word + adds focused tests.
rust-modules/src/http.rs Pins discovery probes via ResolvePin; moves credential gate to CredentialPolicy.
rust-modules/src/diag/test_events.rs Updates test event plumbing to new connection-aware API.
rust-modules/src/diag/schema.rs Makes connection fields optional/omittable; adds snapshot-based context capture.
rust-modules/src/diag/mod.rs Replaces server-only event API with snapshot-based event_for_connection.
rust-modules/src/dev.rs Guards a devtriggers-only test behind the feature flag.
rust-modules/src/curlio.rs Updates test helper to take CredentialPolicy instead of a bool.
rust-modules/src/browse/mod.rs Adds SourceState::InsecureOnly and reachability preservation logic + tests.
rust-modules/src/auth/owner.rs Ensures probe-only outcomes are still published; repairs profile record commit path.
rust-modules/src/auth/observation.rs Extends observation encoding with InsecureOnly tag + includes candidate address in canon.
rust-modules/src/auth.rs Implements InsecureOnly discovery semantics, pinned probes, atomic connection application, and new copy.
rust-modules/src/app/session_stored_home_tests.rs Updates fixtures for policy-aware probe plans and probe address.
rust-modules/src/app/session_resource_tests.rs Updates fixtures to include probe address + snapshot semantics.
rust-modules/src/app/session_protocol_tests.rs Updates registry seam calls for new ConnectionFacts parameter.
rust-modules/src/app/session_profile_regression_tests.rs Updates probes for policy-aware plans and dialable semantics.
rust-modules/src/app/session_plaintext_repair_tests.rs Adds end-to-end test for repairing stored plaintext primary → pinned HTTPS.
rust-modules/src/app/session_endpoint_policy_tests.rs Updates probe fixtures to include policy + address.
rust-modules/src/app/run.rs Threads ready server address into boot install path.
rust-modules/src/app/bridge.rs Extends ReadyCreds handoff to include server address; wires new plaintext repair tests.
rust-modules/src/app/boot.rs Threads address through install_pms_owned into captured registry install.
rust-modules/src/app/adapters/session.rs Applies ConnectionFacts atomically during replay registration; derives IP from stored address.
docs/shared-servers.md Documents updated activation eligibility semantics and InsecureOnly outcome.
ci/check-deps.sh Fixes function closing brace in dependency checker script.
ci/allow/sibling-migration.txt Resolves leftover conflict markers; updates migration allowlist count.
PRIVACY.md Documents omission semantics for server-less events’ connection fields.
Suppressed comments (1)

rust-modules/src/plex/servers.rs:1

  • This changes register_origin from a public entry point to pub(crate), which is an externally visible API break if crate::plex is consumed as a library. If this restricts more than intended, consider keeping a pub fn register_origin(...) wrapper that forwards to an internal implementation (or keeping it pub and documenting the new ConnectionFacts parameter), so downstream callers aren’t forced to depend on internal seams.

💡 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/auth.rs Resolved
Comment thread rust-modules/src/player/report.rs Resolved
Comment thread rust-modules/src/diag/schema.rs Resolved
GLinnik21 and others added 3 commits September 16, 2026 22:10
…x preview wording

- auth.rs: DISCOVERY_INSECURE_ONLY_MESSAGE is owner-approved; drop the
  "placeholder, pending approval" doc note (string stays byte-identical).
- plex/client.rs: centralize the Location/IpVersion <-> u8 encode/decode pair
  as pub(crate) encode_link/decode_link/encode_ip/decode_ip, used by both
  Client's own atomics (set_link/set_connection/apply_connection/link/
  ip_version) and player/report.rs's packed ATTEMPT_CONNECTION snapshot,
  which used to keep a second private copy of both tables. Added a
  round-trip test over every Location/IpVersion value (plus None/unknown
  and an out-of-range code).
- diag/schema.rs: UsageContext::preview()'s server_connection/ip_version
  strings listed "omitted" alongside real wire values, implying it was one;
  drop it from the enumerated domain (omission is explained by
  CONTEXT_SPECS/PRIVACY.md, and the generated-table test that pins those
  still passes).

Gates: make check (full host suite + ci/check-deps.sh etc., exit 0);
CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml
--lib --no-default-features (clean).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
All existing coverage of the plaintext-twin-wins race (issue #95) drove
probe::candidates() through a fake ProbeDial closure, so nothing ever
exercised the real curl/TLS stack the bug actually lives in. This adds a
loopback test harness and three end-to-end tests that dial through the
project's real dial path (net::request_result -> http::request_probe ->
libcurl).

Harness (net.rs, test-only, dev-dependencies rcgen 0.14.10 + rustls 0.23.45
in [dev-dependencies] only — never compiled into a build/check/staticlib
target, only into `cargo test`/`bench`/`example`):
  - mint_cert(names) mints a self-signed loopback certificate via rcgen.
  - spawn_dual_protocol(cert, body) demuxes TLS vs. plaintext on one
    loopback port by peeking the first byte, so the HTTPS and plaintext
    twins can share one address the way discovery's synthesized pair does.
  - spawn_plain_only(body) / dead_port() round out the fixture shapes.
  - Curl trusts the test CA through the project's REAL trust path: the
    existing net::test_ca_bundle mechanism (a PEM bundle path set for the
    test process) is pointed at the minted CA, so CURLOPT_CAINFO is the
    real verification path a device build would use — no new trust
    mechanism was added.
  - The `loopback_pms` module stays a private `mod` (not `pub(crate) mod`)
    with a `#[cfg(test)] pub(crate) use` re-export of its items right
    after its closing brace, because ci/check-deps.sh's `threads` gate
    only recognises a bare `#[cfg(test)]` + `mod` pair when deciding a
    block's std::thread::spawn calls are test-only; a `pub`/`pub(crate)`
    qualifier on the `mod` line defeated that and flagged the harness's
    loopback listener threads as production code.
  - net::available() is now pub(crate) so auth.rs's E2E tests can guard on
    curl actually being usable on the host before dialing.

E2E tests (auth.rs, auth::tests):
  - e2e_real_curl_race_reaches_the_pinned_https_lan_candidate_over_a_real_tls_handshake
  - e2e_real_curl_resolve_roster_only_ever_records_the_pinned_https_origin
  - e2e_real_curl_tls_failure_with_a_verified_plaintext_answer_yields_insecure_only_not_reach_at
  Each races a pinned HTTPS LAN candidate against a synthesized plaintext
  twin (and, for the third, a dead HTTPS candidate) under
  CredentialPolicy::HttpsOnly, and asserts the pinned HTTPS origin wins /
  is the only one ever registered, and that a plaintext-only verified
  answer becomes Reach::InsecureOnly rather than Reach::At.

Reproduce-before-fix (not committed as a change): candidates() in
probe.rs was temporarily edited to force `credential_eligible: true`
unconditionally, simulating issue #95's original bug. Two of the three
E2E tests went RED with exactly the regression's shape ("a plaintext
origin must never be activated under HttpsOnly: http://127.0.0.1:PORT"
and "a plaintext-only verified answer must never become Reach::At").
The edit was reverted byte-for-byte (`git diff` on probe.rs is empty).
This red run is SIMULATED, not historical — the fix already existed on
this branch before this harness did, so it is a weaker claim than a red
run against the original unfixed commit and is reported as such.

Verification: `make check` passes except for one pre-existing, unrelated
failure — tests/test_harness.py's
test_tmppath_gate_catches_a_path_built_on_one_line_and_opened_on_the-next,
a self-test of ci/check-deps.sh's `tmppath` gate that already regressed
on this branch before this change (ci/check-deps.sh, tests/test_harness.py
untouched here); `check-deps: all gates green` otherwise, including
`threads`. `CARGO_INCREMENTAL=0 cargo +nightly check --no-default-features`
is clean. The three E2E tests pass under default features, `--features
hostsim`, and `--no-default-features` alike — rcgen/rustls never reach
any of those configurations since they are dev-dependencies.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SrKSG2UzMzwPKaZmxkbjcV
Store builds (--no-default-features) enforce CredentialPolicy::HttpsOnly
and refuse to send PMS credentials over plaintext (plex/origin.rs,
guarded in http.rs). Several host unit tests exercise that plaintext
loopback path directly with TcpListener servers and hang or fail under
--no-default-features. They remain valid coverage for dev builds, and
the store-config case is now covered by the HTTPS E2E tests added to
auth.rs in 66b76c6, so gate exactly the affected tests (plus the
helper functions/consts that become dead code under store config as a
result) behind #[cfg(feature = "devtriggers")].

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SrKSG2UzMzwPKaZmxkbjcV
@GLinnik21
GLinnik21 merged commit 910b947 into main Sep 16, 2026
6 of 7 checks passed
@GLinnik21
GLinnik21 deleted the fix/probe-plaintext-winner branch September 16, 2026 23:05
GLinnik21 added a commit that referenced this pull request Sep 17, 2026
Brings in main's test-module splits, #95/#104 plain-HTTP address selection, the CLAUDE.md
import change and the landing page.

Resolutions:
- app/adapters/session.rs: took #95's ConnectionFacts registration (set_connection folded into
  the register call) and kept the branch's typed CommitAdmission::RegistryOnly reply.
- auth.rs, browse/mod.rs, plex/session.rs, screens/consent.rs, screens/profiles.rs: took main's
  split test-file layout; kept every branch production change. The branch's test edits were
  carried into the concern files: consent persistence assertions (auth_session_worker_tests),
  extensions fields (auth_test_support, browse_home_and_tabs_tests, session_test_support,
  session_profile_cache_tests), the online-switch extensions test (auth_profile_seat_tests),
  storage_extension_regressions (new auth_storage_extension_tests.rs), trailer_autoplay
  canonical tests (session_compat_tests), canonical clear/Cleared tests
  (session_persistence_tests), PIN verifier regressions (session_profile_cache_tests), consent
  alert title + scope fixture (consent_delete_alert_tests, consent_scope_tests),
  persistence_warning (profiles_test_support).
- plex/session.rs: restored the branch's non-test tail (SaveAuthority, persistence,
  async_persistence, migration_tests) that sat inside the conflict hunk.
- Semantic fixes from #95: probe::plan/settled_probe new arguments in the online-switch test;
  ProfileCreds.extensions in #95's new session_plaintext_repair_tests and auth/owner.rs test.
- ci/check-deps.sh: wholly_test_files now recognises `#[cfg(test)] #[path = "..."] mod x;`, and
  the threads and libm gates skip wholly-test files as they skip inline test modules — main's
  split otherwise fails both gates (main's own CI is red on it). Dropped a duplicated
  unreachable final echo.

Test census: every #[test] name count equals base + branch delta + main delta (0 mismatches;
3695 test fns in the merged tree).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3rkPgGB7xpjGgcPbfakaF
GLinnik21 added a commit that referenced this pull request Sep 19, 2026
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]>
GLinnik21 added a commit that referenced this pull request Sep 19, 2026
…ilds (#138)

* ci: one ARM build pipeline shared by release and canary

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]>

* ci: build-package requires the Sentry token; source-asset is the fail-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]>

* fix: keep the replay bootstrap's trigger vocabulary out of release builds

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]>

* fix(source): fetch every locked crate before vendoring offline

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]>

* fix(source): take the NDK location from the workflow, not a hard-coded 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]>

* fix(source): scan the real tree before the ARM build, and rename a token-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]>

* fix(source): name the source bundle after the version the package reports

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]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 19, 2026
* ci: one ARM build pipeline shared by release and canary

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]>

* ci: build-package requires the Sentry token; source-asset is the fail-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]>

* fix: keep the replay bootstrap's trigger vocabulary out of release builds

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]>

* feat: a nightly flavour with a dated pre-release version

Adds FLAVOR=nightly beside stable and debug: always RELEASE=1, own app
id/port/runtime dir, package version is the next minor (or next patch
on a maintenance line) via a new shared ci/version_rule.py, and the
reported version is that triplet suffixed -nightly-YYYYMMDD from
PLX_NIGHTLY_DATE. PLX_CHANNEL/PLX_NIGHTLY_DATE plumb through
build.rs; with PLX_CHANNEL unset, behavior is byte-identical to today.
nightly.yml itself is left for a later lane.

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

* ci: publish a nightly prerelease every day main moves

Adds ci/nightly.py (plan/notes/latest-json/prune, stdlib only, --selftest wired
into `make check`) and .github/workflows/nightly.yml, a scheduled workflow that
cuts one dated nightly build (X.Y.Z-nightly-YYYYMMDD) from main through the
shared build-package.yml pipeline, publishes it as an immutable prerelease
beside stable, refreshes the site's latest.json via a new workflow_call trigger
on pages.yml, and prunes releases past 30 days while always keeping the newest.

README and the cut-release skill note the new install path and its retention
policy; canary.yml is marked superseded but left in place.

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

* ci: nightly runs as a dry run on the pull requests that change it

Adds a pull_request trigger (paths: nightly.yml, build-package.yml, ci/nightly.py,
ci/flavor.py, ci/version_rule.py, ci/check-package.py, Makefile, rust-modules/build.rs)
that builds the PR's own head sha through plan+build only, gated by one `dry` output
computed once in `plan` (true for pull_request or dry_run) rather than scattered event
checks; fork PRs are skipped entirely since the Sentry secret is unavailable there.
`ci/nightly.py plan --dry` never skips on "nothing changed" and never refuses an
existing same-day tag, since a dry run never publishes.

Also: renders "## Changes" instead of a dangling "## Changes since" when there is no
previous nightly, with a selftest case; and drops pages.yml's now-stale legacy-Pages-
source paragraph (gh api confirms build_type is already "workflow").

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

* fix(check-package): grade the nightly version without a word boundary

Rust string literals in .rodata are packed back to back with no NUL
separator, so a nightly binary's [email protected] can be
followed immediately by the next literal with no boundary at all. The
gate's trailing \b assumed one always exists and failed a real nightly
build (PR #140, run 35412511191) whose next literal started with a digit.
(?![0-9]) asserts the true thing instead: the date is exactly 8 digits,
so anything but a 9th digit ends it.

Also: factor the pattern into nightly_stamp_pattern() with selftest
coverage of the adjacent-literal, 7-digit and 9-digit cases, and make a
failure list the plxnative@ strings actually found in the blob so the
next regression is self-explaining.

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

* fix(check-package): grade the nightly date by value from the build stamp

Two prior fixes tried to find where the 8-digit nightly date ends inside
the packaged binary's own bytes, first with a trailing \b, then with
(?![0-9]) in its place. Both failed against real nightly builds: Rust's
concat!() output in .rodata is packed back to back with no separator, so
when the next packed string literal happens to start with more digits
(as proven twice, most recently [email protected]...),
no shape-based boundary assumption can tell where the date stops.

Stop guessing the date from the blob. The Makefile now records the exact
PLX_NIGHTLY_DATE it built with as a +nightly:<YYYYMMDD> token in
pkg/.build-config's RUST_CFG stamp, guarded by FLAVOR=nightly the same
way +symbols and +tel: are already guarded, so the stamp (and therefore
the forced relink) changes whenever the date changes.

ci/check-package.py reads that token via nightly_stamp_date() and grades
the binary the same way stable's exact version is graded: a precise
substring match, no boundary assumed on either side, because the
substring itself is now exact. Missing or malformed stamp fields fail
the gate; on a substring miss the check still lists the plxnative@...
strings actually present in the blob. Selftest cases cover the token
parse (present/absent/short/long) and the substring grading (matching
date passes, one day off fails). The shape-only helper is removed.

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

* fix(source): fetch every locked crate before vendoring offline

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]>

* fix(source): take the NDK location from the workflow, not a hard-coded 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]>

* fix(source): scan the real tree before the ARM build, and rename a token-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]>

* fix(source): name the source bundle after the version the package reports

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]>

* docs: name the nightly install where the skills still said two

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

---------

Co-authored-by: Claude Opus 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.

Full-screen "Can't reach your Plex server" after profile switch on webOS 10.3.1 (k8lpn2, v0.6.6)

2 participants