Address CodeRabbit follow-up on Developer Build scheduling and install checks

- A catalog request the ArtCraft throttle holds charges no app its turn and keeps
  activation revalidation pending; automatic sweeps wait for the hold, cached
  listings still display, and apps it says nothing about keep their result.
- A signed offer or omission that expired after its last check is revalidated
  before the cadence, once, in Native and in the UI's request gate.
- Live and replayed omissions share the no-build record's exclusive two-hour window.
- An install's descriptor failure publishes the build status and wait without a
  catalog-check failure event.
- The descriptor wait is a time hold applied by the UI clock and Native
  admission, not package ineligibility, so Install returns at the deadline.
- NightlyStatus carries the signed reconciliation as a lower eligibility bound.
- A job compares its exact build/package selection again after its download
  turn, before any package request.
This commit is contained in:
skylartaylor committed 2026-11-29 04:00:53 +01:00
1 parent 4097dbf8f9
commit ff250ccbd8
6 files changed
+222 -67

No files matched your search

+10 -2
View File
@@ -171,6 +171,9 @@ pub struct NightlyStatus {
pub retry_at: Option<i64>,
/// This build’s verification wait, never a gate on catalog refresh or other apps.
pub verification_retry_at: Option<i64>,
/// Inclusive lower eligibility bound from the signed catalog's reconciliation, independent of
/// lookup time: a clock before it (after rollback) is not current.
pub valid_from: Option<i64>,
/// Inclusive eligibility bound from the record and signed catalog, independent of lookup time.
pub valid_until: Option<i64>,
pub stale: bool,
@@ -182,8 +185,13 @@ impl NightlyStatus {
pub const FRESH_FOR: i64 = 6 * 60 * 60;
pub fn current_verified_at(&self, now: i64) -> Option<i64> {
self.verified_at
.filter(|&at| !self.stale && now >= at && now.saturating_sub(at) < Self::FRESH_FOR && self.valid_until.is_none_or(|until| now <= until))
self.verified_at.filter(|&at| {
!self.stale
&& now >= at
&& now.saturating_sub(at) < Self::FRESH_FOR
&& self.valid_from.is_none_or(|from| now >= from)
&& self.valid_until.is_none_or(|until| now <= until)
})
}
}
+122 -48
View File
@@ -931,7 +931,15 @@ impl NativeBackend {
return;
}
}
let chosen = state.begin(&keys, &installed, now, manual, true);
// A signed offer or omission that expired since its last check is revalidated before its cadence.
let expiries: std::collections::BTreeMap<String, i64> = apps
.iter()
.filter_map(|app| {
let until = nightly_status_with_state(app, &self.shared, platform, &state, true, now).valid_until?;
Some((crate::nightly_lookup::key(app, platform), until))
})
.collect();
let chosen = state.begin_at(&keys, &installed, &expiries, now, manual, true);
if chosen.is_empty() {
drop(state);
drop(options);
@@ -976,11 +984,22 @@ impl NativeBackend {
&& shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner).generation == generation
};
// One signed catalog fetch (document + detached signature) for the entire roster.
let catalog = enabled().then(|| http.as_ref().and_then(|http| nightly_catalog(http, &paths, &shared, &enabled))).flatten();
if catalog.is_some() {
shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner).catalog_started();
let (catalog, held) = match http.as_ref() {
Some(http) if enabled() => nightly_catalog(http, &paths, &shared, &enabled),
_ => (None, None),
};
{
let mut state = shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner);
// A request the ArtCraft throttle held was never sent: its cached answer is shown,
// but it is not this process's catalog revalidation.
match held {
Some(until) => state.hold_catalog(until),
None if catalog.is_some() => state.catalog_started(),
None => {}
}
}
let mut used_catalog = false;
let mut deferred = false;
if http.is_none() && enabled() {
shared.emit(Event::Notice { app: sweep_app.into(), result: Err("Secure Nightly connections are unavailable.".into()) });
}
@@ -1010,17 +1029,13 @@ impl NativeBackend {
retry_at: None,
})
};
{
let options = shared.options.lock().unwrap_or_else(PoisonError::into_inner);
let mut state = shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner);
if !options.nightly_enabled || state.generation != generation {
break;
}
state.attempt(&key, now);
match start_nightly_lookup(&shared, &key, generation, now, held.is_some(), &outcome) {
None => break,
Some(false) => deferred = true,
Some(true) => finish_nightly_result(app, platform, generation, outcome, Origin::ArtCraftApi, &shared, &paths),
}
finish_nightly_result(app, platform, generation, outcome, Origin::ArtCraftApi, &shared, &paths);
}
if http.is_none() && enabled() {
if (http.is_none() || deferred) && enabled() {
let _reporting = shared.reporting.lock().unwrap_or_else(PoisonError::into_inner);
let options = shared.options.lock().unwrap_or_else(PoisonError::into_inner);
let mut state = shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner);
@@ -1651,6 +1666,24 @@ struct InstallPlan {
kind: PackageKind,
}
/// Charges `key` this sweep's turn as its lookup starts; `None` stops a sweep whose consent changed.
/// A held catalog request was never sent, so it charges nothing, and an app its cached signed
/// catalog says nothing about keeps its previous result (`Some(false)`: nothing to publish).
fn start_nightly_lookup(shared: &Shared, key: &str, generation: u64, now: i64, held: bool, outcome: &crate::nightly_lookup::Outcome) -> Option<bool> {
let options = shared.options.lock().unwrap_or_else(PoisonError::into_inner);
let mut state = shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner);
if !options.nightly_enabled || state.generation != generation {
return None;
}
if !held {
state.attempt(key, now);
} else if matches!(outcome, crate::nightly_lookup::Outcome::Indeterminate(_)) {
state.defer(key);
return Some(false);
}
Some(true)
}
/// Publish under the same consent lock Configure uses, so OFF (including OFF then ON)
/// invalidates old generations before any promotion. Indeterminate keeps the old selection
/// visibly stale, but cannot refresh its successful timestamp or install capability.
@@ -1733,7 +1766,7 @@ fn publish_nightly_result(
shared.nightly_listings.lock().unwrap_or_else(PoisonError::into_inner).insert(app.id.into(), *listing);
shared.nightly_verified.lock().unwrap_or_else(PoisonError::into_inner).remove(app.id);
shared.store_latest(app.id, &release);
LatestRelease::Found(release)
Some(LatestRelease::Found(release))
}
#[cfg(test)]
Outcome::Verified(verified) => {
@@ -1745,7 +1778,7 @@ fn publish_nightly_result(
.insert(app.id.into(), crate::nightly_lookup::Listing { release: release.clone(), reconciled_at: now });
shared.nightly_verified.lock().unwrap_or_else(PoisonError::into_inner).insert(app.id.into(), *verified);
shared.store_latest(app.id, &release);
LatestRelease::Found(release)
Some(LatestRelease::Found(release))
}
Outcome::NotListed { .. } => {
shared.nightly_listings.lock().unwrap_or_else(PoisonError::into_inner).remove(app.id);
@@ -1753,19 +1786,21 @@ fn publish_nightly_result(
if shared.latest.lock().unwrap_or_else(PoisonError::into_inner).remove(app.id).is_some() {
shared.invalidate_download_size(app.id);
}
LatestRelease::None
Some(LatestRelease::None)
}
#[cfg(test)]
Outcome::NoCompatibleBuild => {
shared.nightly_listings.lock().unwrap_or_else(PoisonError::into_inner).remove(app.id);
shared.nightly_verified.lock().unwrap_or_else(PoisonError::into_inner).remove(app.id);
shared.latest.lock().unwrap_or_else(PoisonError::into_inner).remove(app.id);
LatestRelease::None
Some(LatestRelease::None)
}
Outcome::Indeterminate(error) | Outcome::VerificationFailed { error, .. } => {
record.complete = false;
record.message = Some(error.why.clone());
LatestRelease::Failed(error.why)
// An install's descriptor verification is not catalog discovery: the build's status
// and wait are published below, and the job reports its own error.
verification.is_none().then_some(LatestRelease::Failed(error.why))
}
};
let installable = nightly_installable(
@@ -1779,11 +1814,15 @@ fn publish_nightly_result(
let mut status = nightly_status_with_state(app, shared, platform, &state, options.nightly_enabled, now);
status.stale |= !record.complete;
status.message = record.message;
shared.emit_all([
Event::Installable { app: app.id.into(), installable },
Event::Latest { app: app.id.into(), latest, from: origin },
Event::NightlyStatus { app: app.id.into(), status },
]);
shared.emit_all(
[
Some(Event::Installable { app: app.id.into(), installable }),
latest.map(|latest| Event::Latest { app: app.id.into(), latest, from: origin }),
Some(Event::NightlyStatus { app: app.id.into(), status }),
]
.into_iter()
.flatten(),
);
true
}
@@ -1936,7 +1975,23 @@ fn run_nightly_install(
store_nightly_manifest(shared, updated);
Ok(())
};
let result = install::install_nightly_at(&verified, &artifact, existing.as_ref(), previous.as_ref(), job, Some(&mut commit_record), &lease);
// Waiting for a download turn can outlast the selection verified above: the exact catalog
// build, package and Settings format are compared again before any package request.
let still_selected = || {
if selected_nightly(app, shared, platform).is_ok_and(|current| current == candidate) {
Ok(())
} else {
Err("The selected Developer Build changed or is no longer current. Refresh before installing.".to_owned())
}
};
let result = install::install_nightly_at(
(&verified, &artifact),
(existing.as_ref(), previous.as_ref()),
job,
Some(&mut commit_record),
&lease,
&still_selected,
);
// Even an error can follow a real atomic manifest replacement. Never report the old
// in-memory record as authoritative after the transaction has classified that boundary.
store_nightly_manifest(shared, lease.manifest()?);
@@ -2531,16 +2586,16 @@ fn nightly_status_with_state(
) -> artcraft_launcher_core::protocol::NightlyStatus {
let key = crate::nightly_lookup::key(app, platform);
let record = state.record(&key);
let listing = shared
.nightly_listings
.lock()
.unwrap_or_else(PoisonError::into_inner)
.get(app.id)
.map(|listing| (record.tag.as_deref() == Some(listing.release.tag.as_str()) && listing.fresh(now), listing.valid_until()));
let listing = shared.nightly_listings.lock().unwrap_or_else(PoisonError::into_inner).get(app.id).map(|listing| {
(record.tag.as_deref() == Some(listing.release.tag.as_str()) && listing.fresh(now), listing.reconciled_at, listing.valid_until())
});
// A recovered listing contradicts an older absence until its persisted result is reconciled.
let source_fresh = listing.map_or(record.no_compatible_build(), |(fresh, _)| fresh);
let source_fresh = listing.map_or(record.no_compatible_build(), |(fresh, ..)| fresh);
let mut status = record.status(enabled && state.fresh(&key, now) && source_fresh);
if let Some((_, until)) = listing {
if let Some((_, from, until)) = listing {
// Both signed bounds, apart from the check time: a clock before the reconciliation is
// not current either, as Native admission agrees.
status.valid_from = Some(from);
status.valid_until = Some(status.valid_until.map_or(until, |record_until| record_until.min(until)));
}
status
@@ -2549,12 +2604,16 @@ fn nightly_status_with_state(
fn nightly_offer_ready(app: &CraftApp, shared: &Shared, platform: Platform, state: &crate::nightly_lookup::State, now: i64) -> bool {
let key = crate::nightly_lookup::key(app, platform);
let record = state.record(&key);
// A descriptor wait is a time hold, not ineligibility: it is published as the status's
// `verification_retry_at`, which the UI applies by its own clock, and admission still refuses
// it. Folding it in here would leave Install hidden after the wait with no event to restore it.
state.fresh_build(&key, now)
&& shared.nightly_listings.lock().unwrap_or_else(PoisonError::into_inner).get(app.id).is_some_and(|listing| {
listing.fresh(now)
&& record.tag.as_deref() == Some(listing.release.tag.as_str())
&& record.verification_retry(&listing.release.tag, now).is_none()
})
&& shared
.nightly_listings
.lock()
.unwrap_or_else(PoisonError::into_inner)
.get(app.id)
.is_some_and(|listing| listing.fresh(now) && record.tag.as_deref() == Some(listing.release.tag.as_str()))
}
fn nightly_installable(
@@ -3154,22 +3213,24 @@ fn fetch_feed_with_catalog(
}
/// Nightly uses the pinned signed endpoint only. A failed/bad/stale catalog never proves absence.
/// Cached bytes are reverified; legacy JSON is not a Nightly source.
fn nightly_catalog(http: &Http, paths: &Paths, shared: &Shared, enabled: &impl Fn() -> bool) -> Option<Feed> {
/// Cached bytes are reverified; legacy JSON is not a Nightly source. The second value is set when
/// the ArtCraft throttle held the request: nothing was asked, until then.
fn nightly_catalog(http: &Http, paths: &Paths, shared: &Shared, enabled: &impl Fn() -> bool) -> (Option<Feed>, Option<i64>) {
// Existing backend fixtures and the opt-in local mirror must stay deterministic.
if !enabled() || local_mirror().is_some() {
return None;
return (None, None);
}
#[cfg(test)]
if !http.has_test_transport() {
return shared.nightly_catalog_fixture.lock().unwrap_or_else(PoisonError::into_inner).clone();
return (shared.nightly_catalog_fixture.lock().unwrap_or_else(PoisonError::into_inner).clone(), None);
}
nightly_catalog_with_fetch(http, paths, &shared.feed_throttle, enabled, |url, max| {
nightly_catalog_fetch(http, paths, &shared.feed_throttle, enabled, |url, max| {
shared.nightly_state.lock().unwrap_or_else(PoisonError::into_inner).catalog_started();
http.get_catalog_feed_bytes(url, max)
})
}
#[cfg(test)]
fn nightly_catalog_with_fetch(
http: &Http,
paths: &Paths,
@@ -3177,19 +3238,32 @@ fn nightly_catalog_with_fetch(
enabled: &impl Fn() -> bool,
get: impl Fn(&str, usize) -> Result<Option<Vec<u8>>, FeedError>,
) -> Option<Feed> {
if !enabled() {
return None;
nightly_catalog_fetch(http, paths, throttle, enabled, get).0
}
fn nightly_catalog_fetch(
http: &Http,
paths: &Paths,
throttle: &Mutex<FeedThrottle>,
enabled: &impl Fn() -> bool,
get: impl Fn(&str, usize) -> Result<Option<Vec<u8>>, FeedError>,
) -> (Option<Feed>, Option<i64>) {
if !enabled() || crate::nightly_profile::validate_paths(paths).is_err() || crate::nightly_profile::validate_file(&paths.feed_cache()).is_err() {
return (None, None);
}
crate::nightly_profile::validate_paths(paths).ok()?;
crate::nightly_profile::validate_file(&paths.feed_cache()).ok()?;
match fetch_feed_with_catalog(http, paths, artcraft_launcher_core::feed::FEED_URL, throttle, 1, |url, max| {
if !enabled() {
return Err(FeedError::failed("Developer build discovery was turned off."));
}
get(url, max)
}) {
FeedFetch::Answered(feed) => Some(feed),
FeedFetch::Held | FeedFetch::Failed => load_signed_nightly_feed(paths),
FeedFetch::Answered(feed) => (Some(feed), None),
FeedFetch::Failed => (load_signed_nightly_feed(paths), None),
FeedFetch::Held => {
let now = crate::now();
let until = now.saturating_add(throttle.lock().unwrap_or_else(PoisonError::into_inner).wait(now));
(load_signed_nightly_feed(paths), Some(until))
}
}
}
+19 -6
View File
@@ -168,17 +168,24 @@ pub fn install_at(
job: &mut Job<'_>,
commit: RecordCommit<'_>,
) -> Result<Option<Record>, String> {
install_at_with_profile(InstallRequest { app, release, asset, kind, existing, previous, signature: None }, job, commit, None, None)
install_at_with_profile(
InstallRequest { app, release, asset, kind, existing, previous, signature: None, still_selected: None },
job,
commit,
None,
None,
)
}
/// `still_selected` is asked once the job has its download turn, before any package request: a
/// selection that changed while the job waited in line is refused, never downloaded.
pub(crate) fn install_nightly_at(
verified: &crate::nightly::VerifiedRelease,
artifact: &crate::nightly::VerifiedArtifact,
existing: Option<&Installed>,
previous: Option<&Record>,
(verified, artifact): (&crate::nightly::VerifiedRelease, &crate::nightly::VerifiedArtifact),
(existing, previous): (Option<&Installed>, Option<&Record>),
job: &mut Job<'_>,
commit: RecordCommit<'_>,
lease: &crate::nightly_transaction::Lease,
still_selected: &dyn Fn() -> Result<(), String>,
) -> Result<Option<Record>, String> {
let profile = verified.adapter();
let app = CraftApp::by_id(profile.app()).ok_or("The nightly profile has no known app.")?;
@@ -190,6 +197,7 @@ pub(crate) fn install_nightly_at(
existing,
previous,
signature: artifact.signature.as_ref(),
still_selected: Some(still_selected),
};
install_at_with_profile(request, job, commit, Some(profile), Some(lease))
}
@@ -202,6 +210,8 @@ struct InstallRequest<'a> {
existing: Option<&'a Installed>,
previous: Option<&'a Record>,
signature: Option<&'a artcraft_launcher_core::nightly::Download>,
/// Asked after the download turn, before any package request (Nightly only).
still_selected: Option<&'a dyn Fn() -> Result<(), String>>,
}
fn install_at_with_profile(
@@ -211,7 +221,7 @@ fn install_at_with_profile(
profile: Option<crate::nightly_profile::Adapter>,
#[allow(unused_variables)] lease: Option<&crate::nightly_transaction::Lease>,
) -> Result<Option<Record>, String> {
let InstallRequest { app, release, asset, kind, existing, previous, signature } = request;
let InstallRequest { app, release, asset, kind, existing, previous, signature, still_selected } = request;
if let Some(profile) = profile {
// A typed caller cannot accidentally inherit stable destinations, package batches or
// unrecorded-file replacement permission. Refuse before download or filesystem writes.
@@ -291,6 +301,9 @@ fn install_at_with_profile(
let _turn = download_turn(app, asset, job)?;
#[cfg(test)]
review_after_download_turn();
if let Some(still_selected) = still_selected {
still_selected()?;
}
// The package to put back comes first: without it, nothing is removed.
let rollback = match job.downgrade {
Some(Downgrade::Reinstall { previous, asset }) => {
+36 -4
View File
@@ -201,11 +201,13 @@ pub(crate) fn catalog_not_listed(feed: &artcraft_launcher_core::feed::Feed, app:
catalog_omission_time(feed, app, now).is_some()
}
/// The omission's window is the no-build record's: the sweep, cache replay, the recorded result
/// and its status all stop accepting it at the same second.
pub(crate) fn catalog_omission_time(feed: &artcraft_launcher_core::feed::Feed, app: &CraftApp, now: i64) -> Option<i64> {
let published_at = feed.last_fetched?;
(feed.channel_aware
&& feed.nightly_absences.get(app.id).is_some_and(|repo| repo.eq_ignore_ascii_case(app.repo))
&& (0..=2 * 60 * 60).contains(&now.saturating_sub(published_at)))
&& (0..2 * 60 * 60).contains(&now.saturating_sub(published_at)))
.then_some(published_at)
}
@@ -338,16 +340,23 @@ impl Record {
verified_at: self.verified_at,
retry_at: self.retry_at,
verification_retry_at: self.verification.as_ref().filter(|retry| self.tag.as_ref() == Some(&retry.tag)).map(|retry| retry.until),
valid_from: None,
valid_until: self.verified_at.map(|at| at.saturating_add(lifetime - 1)),
stale: !fresh,
message: self.message.clone(),
}
}
fn due(&self, now: i64, manual: bool, installed: bool) -> bool {
/// `expires` is the last second the signed source behind this record is current (its
/// status's `valid_until`). An offer or omission that expired after the last attempt is
/// revalidated at once rather than after the cadence; one attempt after expiry ends that.
fn due(&self, now: i64, manual: bool, installed: bool, expires: Option<i64>) -> bool {
if self.retry_at.is_some_and(|at| now < at) {
return false;
}
if expires.is_some_and(|until| now > until && self.attempted_at.is_none_or(|at| at <= until)) {
return true;
}
let wait = if manual {
MANUAL_COALESCE
} else if installed {
@@ -375,6 +384,9 @@ pub(crate) struct State {
startup: bool,
load_error: Option<String>,
pending_save: bool,
/// Until when the ArtCraft throttle holds catalog requests, as the last held sweep saw it.
/// Automatic sweeps wait for it instead of re-queueing apps that cannot be asked yet.
held_until: Option<i64>,
/// For each key this sweep chose, its `(attempted_at, complete)` before `begin` stamped it. A
/// key the GitHub budget refused goes back to those values, so it keeps its place in the queue
/// instead of waiting out a full cadence for a request that was never made.
@@ -505,13 +517,27 @@ impl State {
record
}
#[cfg(test)]
pub(crate) fn begin(&mut self, keys: &[String], installed: &BTreeSet<String>, now: i64, manual: bool, enabled: bool) -> Vec<String> {
self.begin_at(keys, installed, &BTreeMap::new(), now, manual, enabled)
}
/// `expiries` maps a key to the last second its signed source is current ([`Record::due`]).
pub(crate) fn begin_at(
&mut self,
keys: &[String],
installed: &BTreeSet<String>,
expiries: &BTreeMap<String, i64>,
now: i64,
manual: bool,
enabled: bool,
) -> Vec<String> {
if !enabled || self.in_flight || self.load_error.is_some() || self.pending_save {
return Vec::new();
}
// Retain only current source-owned row identities, not an unbounded history.
self.records.retain(|key, _| keys.contains(key));
if self.backoff(now).is_some() {
if self.backoff(now).is_some() || (!manual && self.held_until.is_some_and(|until| now < until)) {
return Vec::new();
}
// Installed copies first (their user is running the Nightly and expects it hourly), then apps
@@ -520,7 +546,7 @@ impl State {
.iter()
.filter(|key| {
let record = self.record(key);
(self.startup && record.retry_at.is_none()) || record.due(now, manual, installed.contains(*key))
(self.startup && record.retry_at.is_none()) || record.due(now, manual, installed.contains(*key), expiries.get(*key).copied())
})
.collect();
due.sort_by_key(|key| {
@@ -544,6 +570,12 @@ impl State {
chosen
}
/// The ArtCraft throttle held this sweep's catalog request until `until`. Nothing was asked,
/// so no app is charged a turn and activation revalidation stays pending.
pub(crate) fn hold_catalog(&mut self, until: i64) {
self.held_until = Some(until);
}
pub(crate) fn catalog_started(&mut self) {
if self.in_flight {
self.startup = false;
+29 -5
View File
@@ -101,7 +101,11 @@ fn retry_line(retry_at: Option<i64>, now: i64) -> Option<String> {
}
fn check_problem(entry: &AppEntry, status: &NightlyStatus, now: i64, tokens: &Tokens) -> Option<(&'static str, egui::Color32)> {
if status.message.is_some() || matches!(entry.latest, Some(LatestRelease::Failed(_))) {
// A build's descriptor wait is why its Install is held; Check details shows until when.
if status.message.is_some()
|| matches!(entry.latest, Some(LatestRelease::Failed(_)))
|| status.verification_retry_at.is_some_and(|until| now < until)
{
return Some((tl!("Couldn’t verify the latest build."), tokens.bad));
}
if status.current_verified_at(now).is_none() {
@@ -235,6 +239,9 @@ pub(crate) struct NightlyState {
attempted_at: Option<i64>,
// Request throttling is not evidence that Native actually attempted a lookup.
requested_at: Option<i64>,
/// The latest signed-source expiry already answered with a revalidation request, so one that
/// Native could not act on is not asked about again before the hourly gate.
revalidated_for: Option<i64>,
statuses: BTreeMap<String, NightlyStatus>,
checking: bool,
// Only live check failures, never replayed statuses, should raise a toast.
@@ -268,6 +275,7 @@ impl NightlyState {
held_back_until: None,
attempted_at: None,
requested_at: None,
revalidated_for: None,
statuses: BTreeMap::new(),
checking: false,
check_failure: None,
@@ -446,9 +454,17 @@ impl NightlyState {
// nothing is asked even if the hourly gate would say yes; once it passes, ask at once rather
// than wait out the hour of a sweep that never ran. Consent, coalescing and server backoff
// still guard the request. A sweep that completed without a hold keeps the hourly gate.
// A signed offer or omission that expired after its last check is revalidated at once, as
// Native schedules it, rather than waiting out the hour; each expiry is asked about once.
let expired = self
.statuses
.values()
.filter_map(|status| status.valid_until.filter(|&until| now > until && status.attempted_at.is_none_or(|at| at <= until)))
.max();
let expiry_due = expired.is_some_and(|until| self.revalidated_for.is_none_or(|asked| asked < until));
let due = match self.held_back_until {
Some(until) => now >= until,
None => hourly_due,
None => hourly_due || expiry_due,
};
// Unacknowledged requests are coalesced briefly, not treated as actual attempts.
// A future request permits one replacement, which resets this baseline to now.
@@ -457,6 +473,7 @@ impl NightlyState {
if self.available && settings.nightly_enabled && !self.checking && due && request_allowed && retry_allowed {
// A request is not a successful verification, including when Native coalesces it.
self.requested_at = Some(now);
self.revalidated_for = self.revalidated_for.max(expired);
// The hold has been answered: a fresh hold, if any, arrives with the next CheckFinished.
self.held_back_until = None;
backend.send(Command::CheckForUpdates { force: false });
@@ -846,11 +863,15 @@ impl LauncherUi {
// A date, cached result or retained copy is not an installation capability.
// The existing UI offer gate is unchanged and Native still revalidates.
let needs_verification = status.and_then(|status| status.current_verified_at(now)).is_none();
// A descriptor wait holds Install by this clock until it ends; Native's eligibility stays the
// package answer, so Install returns at the deadline without another event.
let verification_held = status.and_then(|status| status.verification_retry_at).is_some_and(|until| now < until);
let can_install = enabled
&& !nightly_install_is_redundant(entry)
&& matches!(entry.latest, Some(LatestRelease::Found(_)))
&& entry.installable == Some(true)
&& !needs_verification;
&& !needs_verification
&& !verification_held;
let installed = entry.installed.is_some();
let installed_version = entry.installed.as_ref().and_then(|copy| copy.version.as_ref()).map(ToString::to_string);
let candidate = (enabled && (!installed || can_install)).then(|| nightly_release_version(entry)).flatten();
@@ -874,7 +895,7 @@ impl LauncherUi {
build_identity(ui, Some(candidate), tl!("Last seen · {date}"), tl!("Last seen"), tokens);
}
}
if !installed && !can_install && !needs_verification && candidate.is_some() {
if !installed && !can_install && !needs_verification && !verification_held && candidate.is_some() {
ui.add(egui::Label::new(tl!("This build can’t be installed.")).wrap());
}
let stable_installed = self.is_installed(entry.app.id);
@@ -1559,7 +1580,7 @@ mod status_tests {
#[test]
fn review_followup_build_wait_restores_install_at_its_deadline_without_another_event() {
use egui_kittest::Harness;
use egui_kittest::kittest::{NodeT, Queryable};
use egui_kittest::kittest::Queryable;
struct Host;
impl crate::Host for Host {}
for listing_expires_first in [false, true] {
@@ -1710,6 +1731,7 @@ mod status_tests {
stale,
retry_at,
verification_retry_at: None,
valid_from: None,
valid_until: None,
message: stale.then(|| "offline".into()),
},
@@ -1873,6 +1895,7 @@ mod status_tests {
verified_at: None,
retry_at: None,
verification_retry_at: None,
valid_from: None,
valid_until: None,
stale: false,
message: None,
@@ -2262,6 +2285,7 @@ mod status_tests {
verified_at: Some(100),
retry_at: Some(800),
verification_retry_at: None,
valid_from: None,
valid_until: None,
stale: true,
message: Some("x".repeat(2000)),
+6 -2
View File
@@ -84,13 +84,17 @@ Announcements and alerts use the same key and checks from their own signed file:
Developer Builds list the signed ArtCraft catalog, including a reverified disk snapshot before
network refresh. Opening the page, scheduled checks and Refresh never ask GitHub for releases,
release pages or isolation descriptors. Missing, stale, invalid or offline catalog answers do not
fall back to GitHub. Stale cached listings remain visible but cannot start an install.
fall back to GitHub. Stale cached listings remain visible but cannot start an install. When a
listing's signed freshness ends, the next scheduled check revalidates it rather than waiting for
the app's usual cadence; a catalog request the ArtCraft throttle holds back costs no app its turn.
A listing is not an installation token. Install and Update capture the selected exact catalog
release and consent generation before reserving their job. Only that release's `NIGHTLY.json`
is fetched on demand and verified against the signed catalog hash, the descriptor's exact
release identity and the source-owned platform/profile/package row. No other apps or releases
are enumerated. Missing or changed evidence fails without requesting a payload. The existing
are enumerated. Missing or changed evidence fails without requesting a payload, and a job that
waited for its download turn compares the selected build and package again first. A server wait on
the descriptor holds only that build's Install, by its deadline. The existing
payload checksum, platform signature, private destination and transaction checks still run before
installation; opting out continues to leave owned copies and their data available.