Skip to content

Commit 6434a60

Browse files
fix(provider): read an xlings 1.10 payload_status as it meant it
A build whose vendored xlings cannot be updated (no newer source beside the mcpp binary; the hermetic container lane) talks to xlings 2026.10.16.2, whose payload_status reports no usable/current. Read as absent, every payload was unusable and a fresh install reported success and then 'payload is not complete'. 1.10's complete already required the recipe's revision, so it is both usable and current; the 1.10 behaviour is kept. A payload of another revision is announced as an update, not as incomplete. Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent 4859c7e commit 6434a60

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎src/pm/package_fetcher.cppm‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ Fetcher::resolve_xpkg_path(std::string_view target,
11471147
// currency; this function only maps them through the caller's intent.
11481148
struct Here {
11491149
std::filesystem::path dir; // empty: nothing there
1150-
bool usable = false, current = false;
1150+
bool complete = false, usable = false, current = false;
11511151
int installed = -1, revision = 0, floor = 0;
11521152
};
11531153
const auto here = [&]() -> Here {
@@ -1157,7 +1157,7 @@ Fetcher::resolve_xpkg_path(std::string_view target,
11571157
// Present: a complete one (usable / current as the provider says),
11581158
// or an interrupted install, or a success that installed nothing
11591159
// (#533) -- the provider's verdicts say which.
1160-
return {st[0].dir, st[0].usable, st[0].current,
1160+
return {st[0].dir, st[0].complete, st[0].usable, st[0].current,
11611161
st[0].installedRevision, st[0].revision, st[0].floor};
11621162
}
11631163
// The provider could not say, or has nothing where the index's store
@@ -1168,7 +1168,7 @@ Fetcher::resolve_xpkg_path(std::string_view target,
11681168
auto dir = provider->payload(ref);
11691169
std::error_code ec;
11701170
if (!dir.empty() && std::filesystem::is_directory(dir, ec) && !std::filesystem::is_empty(dir, ec))
1171-
return {dir, true, true};
1171+
return {dir, true, true, true};
11721172
return {};
11731173
};
11741174

@@ -1209,10 +1209,14 @@ Fetcher::resolve_xpkg_path(std::string_view target,
12091209
if (now.usable)
12101210
mcpp::ui::status("Updating", std::format("{} packaging revision {} → {}",
12111211
label, now.installed, now.revision));
1212-
else if (now.installed >= 0 && now.installed < now.floor)
1212+
else if (now.complete && now.installed >= 0 && now.installed < now.floor)
12131213
mcpp::ui::status("Updating", std::format(
12141214
"{} packaging revision {} → {} (revision {} is below the index's floor {})",
12151215
label, now.installed, now.revision, now.installed, now.floor));
1216+
else if (now.installed >= 0 && now.installed != now.revision)
1217+
// A provider before 1.11 calls an older packaging incomplete.
1218+
mcpp::ui::status("Updating", std::format("{} packaging revision {} → {}",
1219+
label, now.installed, now.revision));
12161220
else
12171221
mcpp::ui::status("Reinstalling", std::format("{} (the installed payload is incomplete)", label));
12181222
}

‎src/provider/xlings/provider.cppm‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,14 @@ public:
247247
ps.installedRevision = t["installed_revision"].get<int>();
248248
ps.complete = t.value("complete", false);
249249
if (t.contains("floor") && t["floor"].is_number_integer()) ps.floor = t["floor"].get<int>();
250-
ps.usable = t.value("usable", false);
251-
ps.current = t.value("current", false);
250+
// COMPAT(internal:provider-protocol-1.10): an xlings before
251+
// 2026.10.17.1 reports no `usable` / `current`, and its
252+
// `complete` already required the recipe's revision -- so it
253+
// is both, read as 1.10 meant it. A vendored xlings that cannot
254+
// be updated (no newer source beside this mcpp) keeps the
255+
// behaviour it had.
256+
ps.usable = t.contains("usable") ? t.value("usable", false) : ps.complete;
257+
ps.current = t.contains("current") ? t.value("current", false) : ps.complete;
252258
ps.error = str(t, "error");
253259
out.push_back(std::move(ps));
254260
}

0 commit comments

Comments
 (0)