Phase 8: stopped realms keep the progression their core last reported; smoke tool project command

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-10-07 11:25:55 +05:00
1 parent 9009550510
commit c36aaeca74
3 files changed
+40 -2

No files matched your search

@@ -96,6 +96,21 @@ pub fn probe_capabilities(db: &Db, data_dir: Option<&Path>, ra: Option<&mut Ra>,
assemble(db, &schema, data_dir, report.as_ref(), registry)
}
/// A profile assembled without the realm's core (a stopped realm) knows nothing of its progression. The progression the realm's core last
/// reported live (remembered in the store) is the best there is: the profile gets it, and the core still refuses a character prepared for
/// another progression at login, so a realm whose rules changed since is caught, not trusted.
pub fn with_remembered_progression(offline: RealmCapabilities, remembered: Option<&RealmCapabilities>) -> Result<RealmCapabilities> {
let Some(progression) = remembered.and_then(|r| r.progression.clone()) else { return Ok(offline) };
if offline.progression.is_some() {
return Ok(offline);
}
let mut content = offline.content.clone();
if remembered.is_some_and(|r| r.content.supports(Feature::LevelProjection)) {
content.features.insert(Feature::LevelProjection);
}
RealmCapabilities::build(offline.core.clone(), content, Some(progression))
}
/// The table-level view an adapter needs to say whether its module is present, before any character is involved.
struct NoRealm<'a> {
probe: &'a SchemaProbe,
@@ -234,6 +234,22 @@ mod tests {
assert!(matches!(plan_with(&c, 3, Some(&unknown), None), Err(PortableError::ProgressionChanged(_))));
}
#[test]
fn a_stopped_realm_keeps_the_progression_its_core_last_reported() {
use super::super::profile::with_remembered_progression;
let live = caps(60, SIG);
let mut offline = live.clone();
offline.progression = None;
offline.content.features.remove(&Feature::LevelProjection);
let offline = RealmCapabilities::build(None, offline.content, None).unwrap();
assert!(offline.needs_reprobe());
let merged = with_remembered_progression(offline.clone(), Some(&live)).unwrap();
assert_eq!(merged.progression, live.progression);
assert!(merged.content.supports(Feature::LevelProjection));
assert!(with_remembered_progression(offline.clone(), None).unwrap().needs_reprobe(), "nothing remembered, nothing invented");
assert_eq!(with_remembered_progression(live.clone(), Some(&caps(70, &"ab".repeat(32)))).unwrap(), live, "a live profile keeps its own");
}
#[test]
fn a_query_job_names_its_character_and_its_hash() {
let c = geared_level_eighty();