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

38 lines
1.6 KiB
C++

#include "module_plan.h"
#include <utility>
namespace bootplan {
BatchResult plan(const std::vector<Directory> &directories,
const std::vector<std::string> &available,
const std::vector<Request> &requests) {
BatchResult result;
if (requests.size() > 256) { result.error = Error::invalid; return result; }
Configuration configuration;
result.error = compile_configuration(directories, available, configuration);
if (result.error != Error::none) return result;
// Validate all top-level inputs before visiting the first graph edge.
for (const Request &request : requests) {
std::string module;
if (!canonical_module(request.module, module)) { result.error = Error::invalid; return result; }
bool found = false;
for (const std::string &present : configuration.available) if (present == module) found = true;
if (!found) { result.error = Error::invalid; return result; }
}
Planner planner(configuration);
for (const Request &request : requests) {
result.error = planner.begin(request);
if (result.error != Error::none) return result;
while (planner.snapshot().busy) {
Event event = planner.tick();
if (event.error != Error::none) { result.error = event.error; return result; }
}
}
Snapshot final = planner.snapshot();
result.load = std::move(final.committed);
result.skipped = std::move(final.skipped);
result.missing = std::move(final.missing);
result.selected_files = std::move(configuration.selected_files);
return result;
}
}