Build: Records, Vignettes, the File Contract
Maps to: Task 3. Kind: Build.
Objective
Create vignette.rs and record.rs in panoptes-core. Define Vignette, the deterministic vignette_id function, Usage, and ResponseRecord — the struct that becomes one line in responses.jsonl, the dataset of record. These types are the file contract: the interface every later stage and the Python analysis tail depend on.
Scaffold
Create: crates/panoptes-core/src/vignette.rs and crates/panoptes-core/src/record.rs. Modify: crates/panoptes-core/src/lib.rs (re-export both).
Dependencies: no manifest changes — chrono (with its serde feature, for DateTime<Utc>) is already declared.
Expected result: cargo test -p panoptes-core → 7 tests pass across the crate (2 params + 3 codes + 1 vignette + 1 record). The shared data model is complete.
The spec (givens)
Vignettefields:id: String,family: String,params: Params,prompt: String,prompt_sha256: String.vignette_id(family: &str, p: &Params) -> Stringproducesfamily-<conf:03>-<H|D>-<REV|IRREV>-<INFO|NOINFO>— e.g.ca_geo-030-H-REV-INFO(confidence zero-padded to 3 digits).Usagefields:input_tokens: u32,output_tokens: u32.ResponseRecordfields, in order:response_id: String,vignette_id: String,model: String,epoch: u32,params: Params,prompt: String,response: String,usage: Usage,run_at: chrono::DateTime<Utc>.
Full code: Answer Key, Task 3.
Concepts exercised
chrono::DateTime<Utc>with serde support for timestamps.- Deterministic ID construction from typed fields (no stringly-typed field access).
- Why the JSONL schema is the contract that makes the underlying tool fungible.
The build loop (you drive)
- Write failing tests:
vignette_idproduces the exact formatted string (ca_geo-030-H-REV-INFO);ResponseRecordround-trips through a JSON line. - Predict what
vignette_idreturns for a givenParams, character by character, before running. - Run, check.
- Implement.
- Run green, commit.
Done when
All of cargo test -p panoptes-core passes (params + codes + vignette + record). You now have the complete shared data model — every type the other three crates will import.