feat(s42): byte-deterministic write_run_config outbox writer
This commit is contained in:
parent
f3b21db105
commit
ebae4639dd
2 changed files with 75 additions and 2 deletions
|
|
@ -1,4 +1,9 @@
|
|||
"""RAW output layer (Fase 2a, S2.1 · målbilde §3, R2): byte-deterministic outbox writer.
|
||||
"""RAW output layer (Fase 2a, S2.1 · målbilde §3, R2): byte-deterministic outbox writers.
|
||||
|
||||
Two writers live here. ``write_run_config`` (S4.2, comparison protocol §4 pkt 3) persists the
|
||||
run-config artefact ``{run_id}-runconfig.json`` — the resolved model-id per built role, profile,
|
||||
params and token cap — describing a run WITHOUT a model call (the S4.2 dry-run drill + the M2 live
|
||||
run). ``write_outbox`` persists the post-run proposal/outcome artefacts.
|
||||
|
||||
After a run, ``write_outbox`` persists two JSON artefacts — ``{run_id}-proposal.json`` (the candidate
|
||||
IR + its provenance stamp) and ``{run_id}-outcome.json`` (the validated Monte-Carlo percentiles OR
|
||||
|
|
@ -91,3 +96,38 @@ def write_outbox(
|
|||
outcome_path.write_text(_dump(outcome_payload), encoding="utf-8")
|
||||
|
||||
return proposal_path, outcome_path
|
||||
|
||||
|
||||
def write_run_config(
|
||||
config_dir: str,
|
||||
run_id: str,
|
||||
*,
|
||||
profile: str,
|
||||
resolved_models: dict[str, str],
|
||||
max_rounds: int,
|
||||
max_tokens: int,
|
||||
top_k: int,
|
||||
) -> Path:
|
||||
"""Write the byte-deterministic run-config artefact ``{run_id}-runconfig.json`` (S4.2, comparison
|
||||
protocol §4 pkt 3): the resolved model-id per *built* role, the profile, the round/token
|
||||
parameters and the token cap — everything that describes a run WITHOUT a model call. Takes plain
|
||||
data only (the caller resolves the models via ``resolve_model``), so this module stays MAF-free.
|
||||
NO wall-clock / date (that lives in the S11 report envelope, not the deterministic artefact), so
|
||||
two runs with identical config produce byte-identical files (mirrors ``write_outbox``)."""
|
||||
directory = Path(config_dir)
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
path = directory / f"{run_id}-runconfig.json"
|
||||
path.write_text(
|
||||
_dump(
|
||||
{
|
||||
"run_id": run_id,
|
||||
"profile": profile,
|
||||
"resolved_models": resolved_models,
|
||||
"max_rounds": max_rounds,
|
||||
"max_tokens": max_tokens,
|
||||
"top_k": top_k,
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
return path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue