feat(p17b): ONE commission, SEVERAL bases -- reachable from the command line

``run_mandate_across_bundles`` has existed since session 58, reachable from FIVE
test files and from NO command line (measured: ``grep -n across-bundle run.py``
= 0 hits). ``--across-bundle <dir>``, repeated once per base, is that door.

The engine takes a CALLBACK rather than an outbox directory. Its own docstring
has always said N runs need N ``run_id``s and that minting them there would
default a key this repo requires a caller to supply -- so ``outbox_for`` is that
contract KEPT, not relaxed, and the operator-chosen ``<run-id>-<bundle_id>``
rule lives in ``main()`` where the decision was made. The order's alternative (a
caller running ``run_project`` itself over ``route_by_bundle``'s sub-mandates)
would be a second copy of the loop's id reconciliation, shared store, per-base
project resolution, collision accounting and both budget teeth.

``resolve_bundle_routing`` is ONE resolution shared by the engine and the
dry-run arm: a free trip answering with a different project id, or tolerating a
duplicate id the paid dispatch refuses, would rehearse a different run.

``{run-id}-multibase.json`` is written from a ``finally`` and every row is built
from the resolution plus disk, so the pass a cap cut short still leaves the
record. ``completed`` is a required field for ``ExplorationTrace.completed``'s
reason. ``stop_reason`` is read BACK from each base's own coverage artefact.

Load-bearing MEASURED (17 arms), four mutations all red against the WHOLE suite,
green control 1761/5 (from 1744/5, superset, 0 removed), golden byte-unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-15 04:24:48 +02:00
commit 5e4c497a84
5 changed files with 994 additions and 37 deletions

View file

@ -230,6 +230,55 @@ def write_debate_tools(
return path
def write_multibase(
outbox_dir: str,
run_id: str,
*,
runs: Sequence[Mapping[str, Any]],
completed: bool,
unreached: Sequence[Mapping[str, Any]],
collisions: Sequence[Mapping[str, Any]],
stopped_early: bool,
budget_stop: Mapping[str, Any] | None,
) -> Path:
"""Write ``{run_id}-multibase.json`` — what ONE commission did across SEVERAL bases (P17b).
The question no per-base artefact can answer. Each base writes its own full set under its own
minted ``run_id``, but nothing in that set says in which ORDER the bases were spent, which id
each one was given, which approaches were never reached, or which candidates two bases both
described and a reader who has to reconstruct the ``<run-id>-<bundle_id>`` convention to
pair the files back to the pass has been handed a naming rule instead of a record.
Written IFF the pass was given an outbox, exactly like its neighbours, and the per-base
``stop_reason`` rows are READ BACK from each base's own ``{run_id}-coverage.json`` by the
caller rather than recomputed here: P19 D2 put that fact in that file, and a second derivation
of it would be free to disagree with the one the judge reads.
Plain data only, so the RAW output layer stays MAF-free (``write_debate_tools``' own rule)."""
directory = Path(outbox_dir)
directory.mkdir(parents=True, exist_ok=True)
path = directory / f"{run_id}-multibase.json"
path.write_text(
_dump(
{
"run_id": run_id,
# REQUIRED, never inferred from an empty ``unreached``: a pass a cap or a provider
# cut short never got to say what it did not reach, and "nothing was left
# unreached" must not be the value that means "we never found out"
# (``ExplorationTrace.completed``'s own reason).
"completed": completed,
"runs": [dict(row) for row in runs],
"unreached": [dict(row) for row in unreached],
"collisions": [dict(row) for row in collisions],
"stopped_early": stopped_early,
"budget_stop": dict(budget_stop) if budget_stop is not None else None,
}
),
encoding="utf-8",
)
return path
def write_prepass(
outbox_dir: str,
run_id: str,