amos 913d3c367f Add the usable task catalog and admit batch 6 tasks
All 161 task packages, including the 21 batch 6 C++17 tasks that passed
gates 1/2, are now in Git. rollout.catalog builds docs/task-catalog.{json,md}
from the task packages, a fresh trace5 calibration (128/128 PASS), every
verified controller receipt on the current task digest, documented holds
and digest-bound difficulty reviews. 123 tasks are usable (6 HARD),
5 are on hold and 33 still need a subprocess-only grader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:43:15 +08:00

30 lines
1.3 KiB
C++

#include "alternative_registry.h"
#include <algorithm>
namespace alternatives {
Projection project(const World &world) {
Projection output;
for (const Group &group : world.groups) {
const Candidate *chosen = nullptr;
for (const Candidate &candidate : group.candidates) {
if (!candidate.enabled) continue;
if (group.mode == Mode::manual) {
if (candidate.path == group.pin) chosen = &candidate;
} else if (!chosen || candidate.priority > chosen->priority ||
(candidate.priority == chosen->priority && candidate.path < chosen->path)) chosen = &candidate;
}
const std::string current = chosen ? chosen->path : "";
output.selections.push_back(Selection{group.name, group.mode, group.pin, current});
output.bindings.push_back(Binding{group.master_link, current});
for (const Slot &slot : group.slots) {
std::string target;
if (chosen) for (const Attachment &attachment : chosen->attachments)
if (attachment.slot == slot.name) target = attachment.target;
output.bindings.push_back(Binding{slot.link, target});
}
}
std::sort(output.bindings.begin(), output.bindings.end(), [](const Binding &a, const Binding &b) { return a.link < b.link; });
return output;
}
}