Skip to content

Commit acb403d

Browse files
committed
feat(odoo): style_recipe — D-Atom interpretation step (typed SoA → cognitive fingerprint)
The Odoo-static interpretation layer that reads typed `OdooEntity` / `OdooMethod` / `OdooField` SoA into per-method `StyleRecipe` records: sparse weighted vectors over 12 D-Atom basis vectors + regulatory anchors + dispatch hints. This is the bridge between the PR #426 typed extraction and the upcoming askama bucket-dispatch codegen. ## Where this fits ``` Odoo source │ (Stage 1, PR #426 — odoo-blueprint-extractor) ▼ Typed Rust SoA ← extracted/{account,sale,…}.rs (OdooEntity[ ]) │ (THIS COMMIT — interpretation, no triplets stored) ▼ StyleRecipe[ ] ← cognitive fingerprint per method │ (atom weights + regulatory anchors + dispatch hints) ▼ Askama bucket templates (next commit) → Rust Ops + const recipes │ ▼ PaletteCompose SpMV at runtime (cognitive-shader-driver path) ``` ## The user-anchored rule > "Business logic stays in the triplets, but you have to interpret it. > The interpretation of Odoo lies in Odoo-static [code] that needs to > be ported." The triplets (`lance_graph::graph::spo::odoo_ontology` + typed SoA) stay lossless — we do NOT emit a `has_recipe` triple. The recipe is re-derived deterministically every codegen run. That's the "interpretation" half of the rule. Belongs in `lance-graph-ontology`'s `odoo_blueprint` because that's where Odoo-static interpretation lives; a Rails frontend writes its own `style_recipe.rs` targeting the same downstream SoC compiler. ## What lands - **`DAtom` (12 variants)** — closed basis-vector catalogue: Entity, Law, FiscalCtx, EmitAmount, ApplyRate, Quantity, Money, Event, Action, Compute, Validate, Onchange. The architecture diagram excerpt showed 9; extended by 3 for Odoo-specific dispatch (Onchange cascade, Compute-vs-Validate split, Helper utility). - **`StyleRecipe`** — `{ method_id, atoms: Vec<(DAtom, u8)>, regulation_iris, return_kind, recipe_id: u32 }`. `recipe_id` is a content-addressed FNV-1a 32-bit digest over the sorted atom-weight tuples — equivalent methods collapse to one recipe (the dispatcher exploits this). - **`derive_style_recipe(&OdooEntity, &OdooMethod) -> StyleRecipe`** — 7-rule deterministic cascade (kind → return_kind → triggers → field cross-ref → regulation_iri → state_machine participation). Atom weights are `max`-merged; zero-weight atoms drop out. - **`derive_corpus_recipes(&[&OdooEntity]) -> Vec<StyleRecipe>`** — walks an entity corpus, sorted by `method_id` ascending, byte- deterministic across runs. ## Tests (12 today) Synthetic fixtures: every D-Atom anchor case + recipe_id determinism + atom collapse + corpus sort. Shipped-corpus test (`shipped_corpus_resolves_kind_driven_atoms_today`) pins both halves of the Stage-1 reality: - **must fire today**: Entity, Compute, Validate, Onchange, Action (kind-driven; resolvable from current extractor output). - **must NOT fire today**: Money, Quantity, ApplyRate, EmitAmount, Event, FiscalCtx (need Stage-2 extractor enrichment — `OdooMethod::return_kind` is mostly Unit, `triggers` empty, `state_machine` None, `OdooField::computed` cross-refs sparse). When Stage-2 lands the second list shrinks; the test asks reviewers to flip atoms from `stage2` to `must` as enrichment lands. ## Architecture invariants - `lance-graph-ontology` stays light (no new external deps; serde-only not needed because StyleRecipe doesn't serialise — it's the in-process codegen IR). - `lance-graph` itself untouched (Odoo-specific interpretation belongs in `lance-graph-ontology` per the layering split). ## Review pattern Built with `/// work` markers → opus-4.8 reviewer (code-only, no cargo) → orchestrator-run cargo verify.
1 parent 0e5ab98 commit acb403d

3 files changed

Lines changed: 768 additions & 0 deletions

File tree

.claude/board/AGENT_LOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [SavantPattern / Opus 4.8] style_recipe — D-Atom interpretation step
2+
3+
**Branch:** claude/activate-lance-graph-att-k2pHI | **Files:**
4+
- `crates/lance-graph-ontology/src/odoo_blueprint/style_recipe.rs` (+~600 LOC, post-review)
5+
- `crates/lance-graph-ontology/src/odoo_blueprint/mod.rs` (+1 line, `pub mod style_recipe`)
6+
7+
**Tests:** `cargo test -p lance-graph-ontology --lib odoo_blueprint::style_recipe` → 12/12 passed (d_atom_ids_unique_and_stable, every_recipe_carries_entity_anchor, compute_method_gets_compute_atom, constrain_method_gets_validate_atom, money_return_emits_both_money_and_emit_amount, action_return_boosts_action_atom, field_cross_reference_lifts_field_kind_atoms, regulation_iri_lifts_law_atom_and_anchors, recipe_id_is_deterministic_and_collapses_identical_shapes, recipe_id_differs_when_atoms_differ, corpus_derivation_is_sorted_and_deterministic, shipped_corpus_resolves_kind_driven_atoms_today).
8+
9+
**Outcome:** DONE. The Odoo-static interpretation layer is in place. 12-variant `DAtom` catalogue + `StyleRecipe { method_id, atoms, regulation_iris, return_kind, recipe_id }` + 7-rule deterministic cascade + content-addressed FNV-1a `recipe_id` for dispatcher collapse. Shipped-corpus test honest-flags the Stage-2 gap: 5 atoms fire today (Entity/Compute/Validate/Onchange/Action), 6 are gated on Stage-2 extractor enrichment (Money/Quantity/ApplyRate/EmitAmount/Event/FiscalCtx).
10+
11+
**Review pattern:** built with `/// work` markers → opus-4.8 reviewer (code-only, no cargo per disk-pressure constraint) → orchestrator-run cargo verify.
12+
13+
---
14+
115
## [Sonnet agent + main-thread fixup] PR #431 review wave — 9/11 review findings applied
216

317
Addressed Codex P1 + P2 and 6 CodeRabbit findings on the

crates/lance-graph-ontology/src/odoo_blueprint/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ pub mod l15;
7676
// D-ODOO-EXT-5's `extracted::pairing`.
7777
pub mod extracted;
7878

79+
// ─── Cognitive-fingerprint derivation (Odoo-static interpretation) ─────────
80+
//
81+
// Reads typed OdooEntity / OdooMethod / OdooField SoA into per-method
82+
// StyleRecipes (sparse D-Atom weight vectors + regulatory anchors) for
83+
// downstream SoC synergy compilation. See style_recipe::derive_style_recipe
84+
// for the cascade rules.
85+
pub mod style_recipe;
86+
7987
// ─── Top-level entity ─────────────────────────────────────────────────────
8088

8189
/// Which ORM base class the entity inherits from.

0 commit comments

Comments
 (0)