feat(cli): verb_sugar translator — argv to generated campaign documents (#210 T3)

The pure half of the sweep re-cut: translate_sweep maps a real-data
blueprint-sweep invocation (axes, name, symbol, window, canonical
blueprint bytes) to a selection-free single-stage process document plus
a campaign document carrying exactly the invocation's intent (seed 0 —
no stage consumes it — so identical invocations dedupe onto identical
content ids); register_generated puts both into the content-addressed
stores. Unit tests pin determinism, name flow, mixed-kind-axis refusal,
and that generated documents pass intrinsic validation + preflight.

Dead-code-allowed until the dispatch rewire wires the module (next
task removes the bridge attribute). Plan bytes reconciled with three
necessary deviations the spec gate surfaced: derive(Debug) for
unwrap_err, ScalarKind lives in aura_core, and 'gen' is reserved in
edition 2024.

refs #210
This commit is contained in:
2026-07-04 18:01:51 +02:00
parent c37abb2a27
commit fd0b21d070
3 changed files with 181 additions and 5 deletions
+12 -5
View File
@@ -529,14 +529,15 @@ Create `crates/aura-cli/src/verb_sugar.rs`:
use std::collections::BTreeMap;
use aura_core::Scalar;
use aura_core::{Scalar, ScalarKind};
use aura_research::{
campaign_to_json, content_id_of, process_to_json, Axis, CampaignDoc, DataSection, DocKind,
DocRef, Presentation, ProcessDoc, ProcessRef, ScalarKind, StageBlock, StrategyEntry, Window,
DocRef, Presentation, ProcessDoc, ProcessRef, StageBlock, StrategyEntry, Window,
FORMAT_VERSION,
};
/// The two generated documents of one dissolved-verb invocation.
#[derive(Debug)] // unwrap_err() in the unit tests needs T: Debug
pub(crate) struct GeneratedSweep {
pub process: ProcessDoc,
pub campaign: CampaignDoc,
@@ -622,10 +623,12 @@ pub(crate) fn translate_sweep(
/// Returns `(process_id, campaign_id)`.
pub(crate) fn register_generated(
reg: &aura_registry::Registry,
gen: &GeneratedSweep,
generated: &GeneratedSweep, // `gen` is a reserved keyword in edition 2024
) -> Result<(String, String), String> {
let process_id = reg.put_process(&process_to_json(&gen.process)).map_err(|e| e.to_string())?;
let campaign_id = reg.put_campaign(&campaign_to_json(&gen.campaign)).map_err(|e| e.to_string())?;
let process_id =
reg.put_process(&process_to_json(&generated.process)).map_err(|e| e.to_string())?;
let campaign_id =
reg.put_campaign(&campaign_to_json(&generated.campaign)).map_err(|e| e.to_string())?;
Ok((process_id, campaign_id))
}
```
@@ -804,6 +807,10 @@ pub(crate) fn run_sweep_sugar(
- [ ] **Step 3: Dispatch rewire — the real arm routes through sugar**
First, remove the temporary `#![allow(dead_code)]` inner attribute (and its
two comment lines) near the top of `crates/aura-cli/src/verb_sugar.rs` — the
module gains its caller in this step, so the bridge attribute must go.
In `crates/aura-cli/src/main.rs` `dispatch_sweep`, replace the tail of the
blueprint branch (:4471-4475):