Skip to content

Commit 8b5da0e

Browse files
authored
Merge pull request #426 from AdaWorldAPI/claude/activate-lance-graph-att-k2pHI
feat(odoo_blueprint): Stage 1 TIER-1 source extraction (D-ODOO-EXT-1..6)
2 parents a21d577 + 25e8d2b commit 8b5da0e

72 files changed

Lines changed: 115717 additions & 3 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/board/AGENT_LOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,73 @@
3131
**Files touched:** `crates/cognitive-shader-driver/src/driver.rs` (+42 lines)
3232
**cargo check:** `Finished dev` — 0 errors; pre-existing warnings only (causal-edge/p64-bridge/ontology deprecations — none in cognitive-shader-driver). Note: `--features hpc-extras` absent from this crate; check ran with default features.
3333
**Outcome:** SUCCESS — added `HashMap<MailboxId, MailboxSoA<1024>>` field on `ShaderDriver`, `with_mailbox` builder setter on `CognitiveShaderBuilder`, `mailbox()` read accessor. Singleton `Arc<BindSpace>` untouched. All new items marked `/// work`.
34+
## [Sonnet agent] PR #426 CodeRabbit fixes — 16/17 applied (1 skipped with rationale)
35+
36+
Applied all 16 addressable CodeRabbit findings across Groups A (board/plan governance), B (Rust source), C (Python tooling), and D (nitpicks). Group B included regenerating all 12 TIER-1 addon `.rs` files + l10n_de chart/kennzahlen after stripping `/home/user/` prefix from emitted paths. `cargo test -p lance-graph-ontology --lib` remained green at 203 tests; Python smoke test PASS. Item 13 (l1.rs unit tests for ENTITIES contents) explicitly skipped — static const data tests add no invariant coverage that the existing `extracted::coverage::tests` aggregate gate doesn't already provide.
37+
38+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `e581035`. `cargo test -p lance-graph-ontology --lib` green (203 tests). Python smoke test PASS.
39+
40+
---
41+
## [Sonnet agent] D-ODOO-EXT-6 — Stage 1 coverage report + gate test (closes EXT-1..6)
42+
43+
Per-lane eligible coverage analysis confirmed 100% on all 15 lanes after subtracting 5 TIER-2 exemptions (4 `hr.*` entities in L14, 1 `stock.valuation.layer` in L13): L1-L13 and L15 all at 100% eligible backing; L14 wholly-exempt (skip). `extracted/COVERAGE.md` emitted with per-lane table, TIER-2 deferral catalogue, TIER-1 surplus inventory (181 entities across 12 addons), and Stage 2 recommendation (`hr` + `stock_account` first). `extracted/coverage.rs` provides `COVERAGE_EXEMPTIONS` + `COVERAGE_FLOOR = 0.80` + 2 gate tests. Plan and INTEGRATION_PLANS `**Status:**` lines updated to SHIPPED.
44+
45+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `2937c04`. `cargo test -p lance-graph-ontology --lib` green (203 tests, +2 new: `every_lane_meets_coverage_floor`, `aggregate_coverage_reports_correctly`). **Stage 1 of `odoo-source-extraction-v1` SHIPPED.**
46+
47+
---
48+
49+
## [Sonnet agent] D-ODOO-EXT-5 — curated-vs-extracted pairing table
50+
51+
Scanner (stdlib `re`) walked all 15 curated lane modules + 12 extracted TIER-1 addon modules, finding 53 unique curated model_names and 229 extracted, yielding 48 overlap pairings. Top deltas: `account.move` (24f/27m curated → 142f/352m extracted, Δ+118f/+325m), `account.move.line` (+67f/+132m), `sale.order` (+43f/+128m) — confirming curated is a precise savant-relevant subset. 17 private (`const`) lane consts promoted to `pub const` in l3/l5/l7/l13.rs to enable absolute crate-path references. Selection rule: pick curated entry with most inline-counted fields+methods (handles l3.rs indirect-ref pattern); extracted entry with most fields+methods.
52+
53+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `bf42ad2`. `cargo test -p lance-graph-ontology --lib` green (201 tests, +2 new: `pairing_table_is_well_formed`, `pairing_table_has_expected_size`).
54+
55+
---
56+
57+
## [Sonnet agent] D-ODOO-EXT-4 — l10n_de SKR03/04 chart + UStVA Kennzahlen + GoBD wiring
58+
59+
Emitted three new typed surfaces unreachable by the Python ast extractor: SKR03_CHART (1 274 accounts) + SKR04_CHART (1 192 accounts) from CSV via `OdooAccountTemplate`/`OdooSkrChart`; USTVA_KENNZAHLEN (37 Kennzahlen — full UStVA return, not just the canonic Kz.81..95 subset) from XML via `OdooUstvaKennzahl`/`OdooKennzahlKind`; GOBD_WIRING from `res_company.py` via `OdooGobdWiring`. All carry regulation_iri anchors (UStG §1a/4/13/13b/15/18, HGB §238/266, GoBD, AO §146a). Extractor extended with `data_extractors/{csv_chart,xml_kennzahl,gobd_company}.py` + `data` CLI subcommand (stdlib-only).
60+
61+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `dd40713`. `cargo test -p lance-graph-ontology --lib` green (199 tests, +7 new sanity tests: skr03/04_chart_has_expected_size, skr03/04_chart_entries_have_codes, ustva_kennzahlen_cover_canonical_boxes, ustva_kennzahlen_non_empty, gobd_wiring_has_correct_trigger).
62+
63+
---
64+
65+
## [Sonnet agent] D-ODOO-EXT-2 Wave C — l10n_de/account_peppol/account_edi_ubl_cii extraction (closes EXT-2)
66+
67+
Extracted 3 DE-specific + EU e-invoice TIER-1 addons: l10n_de 8 models (335 LOC, 0% field-fallback — ORM models only; SKR03/04 chart, tax tables, and UStVA Kennzahlen are intentionally absent, scope of D-ODOO-EXT-4), account_peppol 10 models (1 446 LOC, 2.4% field-fallback, 1 Other field), account_edi_ubl_cii 16 models (3 703 LOC, 0% field-fallback). Helper method rates are high (57–94%) as expected for XML-rendering wrappers and partner-extension models — documented in commit body per plan guidance. No extractor fixes required for Wave C; German docstrings were not present in emitted Rust output and caused no UTF-8 issues.
68+
69+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `901c58c`. `cargo test -p lance-graph-ontology --lib` green (192 tests). EXT-2 COMPLETE (12 TIER-1 addons extracted, ~73 534 total extracted/ LOC across all waves).
70+
71+
---
72+
73+
## [Sonnet agent] D-ODOO-EXT-2 Wave B — account/account_payment/purchase/sale/stock extraction
74+
75+
Extracted 5 value-flow-chain TIER-1 addons into `odoo_blueprint::extracted::{account,account_payment,purchase,sale,stock}` (41 701 insertions, 5 new Rust modules). Model counts: account 66 models (21 340 LOC, 0.8% field-fallback), account_payment 7 models (663 LOC, 0%), purchase 15 models (3 080 LOC, 0%), sale 20 models (4 588 LOC, 1.1%), stock 33 models (12 020 LOC, 1.2%). All five pass the <5% `OdooFieldKind::Other` gate (16 Other hits total: exotic `fields.Json`/`fields.Properties` variants). No extractor fixes required for Wave B — the Wave A `_dedup_by_model_name` + `OdooFieldKind::Other` variant absorbed all edge cases cleanly. `extracted/mod.rs` updated with Wave A/B comment-grouped alphabetical module declarations.
76+
77+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `a214f53`. `cargo test -p lance-graph-ontology --lib` green (192 tests). Wave B aggregate field-fallback: ~0.9% weighted by field count (1860 total fields, 16 Other).
78+
79+
---
80+
81+
## [Sonnet agent] D-ODOO-EXT-2 Wave A — base/uom/product/analytic extraction
82+
83+
Extracted 4 foundation TIER-1 addons into `odoo_blueprint::extracted::{base,uom,product,analytic}` (26 395 insertions, 4 new Rust modules + `extracted/mod.rs`). Model counts: base 114 models (19 563 LOC, 1.6% field fallback), uom 1 model (235 LOC, 0%), product 25 models (5 248 LOC, 4.3%), analytic 9 models (1 286 LOC, 0%). All four pass the <5% `OdooFieldKind::Other` gate. Two extractor fixes shipped: (1) `emitters/module.py` — added `_dedup_by_model_name()` to keep the richest class when `_inherit` causes multiple Python classes to share a model_name (base had 2 duplicates: `base` + `res.users`); (2) `mod.rs` — added `OdooFieldKind::Other` variant for unrecognized field types (`fields.Image` ×8, `fields.Properties` ×1, `fields.PropertiesDefinition` ×1 in product). `pub mod extracted;` wired into `odoo_blueprint/mod.rs`.
84+
85+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `46dcbcc`. `cargo test -p lance-graph-ontology --lib` green (192 tests). Wave A audit: base 1.6%, uom 0%, product 4.3%, analytic 0% (aggregate ~1.7% weighted by field count).
86+
87+
---
88+
89+
## [Sonnet agent] D-ODOO-EXT-1 — Python ast extractor scaffold + uom smoke test
90+
91+
Created `tools/odoo-blueprint-extractor/` — a stdlib-only Python 3 package (1 669 LOC across 19 files) that parses Odoo ORM classes via `ast` and emits `OdooEntity` Rust consts with `OdooConfidence::Extracted` provenance. Covers all seven parsers (`classes`, `fields`, `methods`, `decorators`, `state_machine`, `constraints`, `regulation`), two emitters (`rust`, `module`), and `audit/fallback_log`. Smoke test on `uom` addon passes 6/6: emits `EXT_UOM_UOM` with `model_name: "uom.uom"`, `kind: OdooEntityKind::Model`, `confidence: OdooConfidence::Extracted`, balanced braces, 0% `::Other` field fallback. The `regulation.py` 30-entry anchor table is wired; uom has no regulatory text so `regulation_iri: &[]` as expected. EXT-3's `OdooEntityKind` and `regulation_iri` fields landed before this commit — the emitter already emits them correctly. EXT-2 inherits: 9 fields, 16 methods (10 classified, 6 legitimate helpers), 2 constraints extracted from uom cleanly; `@api.ondelete` decorator correctly mapped to `Override`.
92+
93+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `29e918c`. Smoke test PASS.
94+
95+
---
96+
## [Sonnet agent] D-ODOO-EXT-3 — OdooEntityKind + regulation_iri provenance slot
97+
98+
Added `OdooEntityKind::{Model,Transient,Abstract}` enum and `OdooEntity.kind` field to `mod.rs`, plus `OdooProvenance.regulation_iri: &'static [&'static str]` slot. Back-filled `kind: OdooEntityKind::Model` and `regulation_iri: &[]` across all 70 `OdooEntity` consts in `l1.rs``l15.rs` (3+3+6+6+5+4+6+6+6+5+4+5+5+4+2 = 70 lane consts; 2 more in `mod.rs` tests). The sole blocking issue was a missing `OdooEntityKind` in each lane's `use super::{}` import — the `kind:` and `regulation_iri:` values were already present in the lane files. Fixed all 15 import blocks. Corrected stale `tree-sitter` doc comment in `OdooConfidence::Extracted`.
99+
100+
**Branch:** `claude/activate-lance-graph-att-k2pHI`, commit `7f21133`. `cargo test -p lance-graph-ontology --lib` green (192 tests).
34101

35102
---
36103

.claude/board/EPIPHANIES.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
## 2026-05-28 — E-CODEBOOK-INHERITS-FROM-OGIT — every identity (entities, savants, atoms, ontology classes, regulation rules, accounts) lives as a codebook entry inherited from OGIT; LE-byte SoA per mailbox stores the codes; bitpacked u64 is a desperation-bucket fallback; the SoA doesn't guess
2+
3+
**Status:** FINDING (architectural correction, supersedes the role-key-as-canonical interpretation of `I-VSA-IDENTITIES`; drives the v2-step codebook foundation in `contract::callcenter::ogit_uris`).
4+
5+
**Click (the 2026-05-28 user-given doctrine, distilled across four messages):**
6+
7+
1. **`Vsa16kF32` deprecated** as cross-boundary carrier (matches CLAUDE.md "The Click" 2026-05-26 baton-scoping update). Inter-mailbox state is the `(u16, CausalEdge64)` baton; ephemeral in-mailbox compute may still use `Vsa16kF32`.
8+
2. **Every data lives as LE-byte SoA per mailbox** (`E-MAILBOX-IS-BINDSPACE`). Row content = codes; never raw bits.
9+
3. **Codebook for everything — including the semantic ontology graph.** Entities, savants, atoms, ontology classes, regulation rules, accounts (Kontenrahmen positions) all get codebook entries.
10+
4. **Inherited from OGIT, because the SoA doesn't guess.** Identities are deterministic — `OntologyRegistry` resolves OGIT URI → stable row index. No hashing, no FNV-seeded random bits, no autogenerated IDs.
11+
5. **Bitpacked u64 (RoleKey slices in `Binary16K`) is a desperation-bucket fallback.** Useful only when codebook lookup is unavailable (ephemeral Hamming compare); not canonical identity.
12+
6. **The codebook is RICH, not flat** — Kontenerkennung is the canonical example: each entry carries a parent chain (SKR03 → SKR04 → custom) + NARS-truth confidence per link + multi-dimensional dispatch over `(business type × transaction type × form × regulation × law × entity × product)`.
13+
7. **The audit query is the load-bearing read**: *"how were similar transactions / entities handled before · what patterns are required by regulation · what currently exists · what needs audit vs what is confidently repeating existing patterns"* — answered by composing episodic memory + AriGraph SPO-G audit-witness chain + regulation-ontology codebook + NARS confidence threshold + Pearl 2³ on the emitted `CausalEdge64`. High confidence → repeat (no audit); below floor → escalate.
14+
15+
**Mechanism (the codebook layer, full shape):**
16+
17+
- **Identity:** OGIT URI under `https://ogit.adaworldapi.com/<domain>#<Name>` (e.g. `callcenter/savants#FiscalPositionResolver`). `OntologyRegistry::resolve(uri)` → stable row index (u32 codebook code).
18+
- **Inheritance:** typed parent chain per entry, NARS-truth-weighted per link (deduction down a chain, revision across siblings).
19+
- **Multi-dim applicability:** each entry carries selectors over (business × transaction × form × regulation × law × entity × product); dispatch resolves the cross-product match.
20+
- **Regulation as ontology:** legal/regulatory patterns (HGB, GoB, AO, UStG, IFRS, GoBD) are themselves OGIT URIs with inheritance + applicability; floor-of-compliance is a typed predicate over them.
21+
- **Audit threshold:** NARS confidence on a `CausalEdge64` emission < `audit_floor` → escalate (LLM resolves the <25% tail per CLAUDE.md "The Click"); ≥ floor → confident pattern repetition committed to AriGraph SPO-G as both the action and its audit witness.
22+
- **Storage:** LE-byte SoA columns per mailbox store the codebook codes (u32 row indices). No bitpacked planes. The `Baton` (`(u16, CausalEdge64)`) carries the code across mailbox boundaries.
23+
24+
**Fix (what lands today + what's queued):**
25+
26+
- **Today (this commit):** `contract::callcenter::ogit_uris` ships the canonical OGIT URI per savant + `savant_ogit_uri(id) → &'static str` lookups (8 tests). `contract::callcenter::role_keys` stays compiled as the documented desperation-bucket fallback (module doc updated). `D-ODOO-BP-1b` Wave 1 (L1–L5) already shipped 4008 lines of typed `OdooEntity` content (`e4c747a`); Wave 2 (L6–L10) running in parallel.
27+
- **Queued (separate D-ids):** (a) `savants.ttl` under `data/ontologies/ogit/callcenter/` + `OntologyRegistry::hydrate_from_*` wiring for the 25 savants; (b) Kontenerkennung-style inheritance + NARS confidence per link (`CodebookEntry { uri, parent: Option<u32>, link_truth: NarsTruth, applicability: ... }`); (c) regulation-ontology codebook (HGB / GoB / AO / UStG / IFRS / GoBD as OGIT URIs); (d) audit-threshold dispatch in `cognitive-shader-driver` (NARS confidence vs `audit_floor``CausalEdge64` Pearl 2³ + AriGraph SPO-G witness OR escalation Baton).
28+
29+
**Lesson (generalizes):** "consult before guess" (CLAUDE.md §"Driving Seat") extends beyond grepping the codebase — it extends to **identity itself**. The SoA doesn't guess: every row's identity comes from a deterministic codebook lookup (OGIT → registry → row index). Inventing identities (FNV-seeded random bits in a slice, hash of a name) is the same anti-pattern as inventing types that already exist — both are 30-turn rediscovery taxes. The fix is the same: route every identity through `OntologyRegistry`.
30+
31+
**Cross-ref:** `E-MAILBOX-IS-BINDSPACE` (LE-byte SoA per mailbox), `E-BATON-1` (`(u16, CausalEdge64)` cross-boundary state), `I-VSA-IDENTITIES` (Layer-2 catalogue doctrine — clarified: catalogue is OGIT-resolved, NOT bitpacked random bits), `E-SAVANT-COMPOSITION-1` (Reasoner trait surface was wrong — codebook foundation is the canonical identity layer the typed compositions reach for), CLAUDE.md "The Click" 2026-05-26 baton-scoping update (Vsa16kF32 deprecated as carrier), CLAUDE.md INTEGRATION_PLANS line 470 (Pillar 1: "OGIT as universal SPO-G lingua franca with `ontology_context_id: u32` per named graph"), `.claude/plans/odoo-savant-reasoners-v2.md` (v2 reshape — Group F per-savant compositions now compose over OGIT-codebook identities, not RoleKey slices), `.claude/plans/odoo-business-logic-blueprint-v1.md` (BP-1b content layer is OGIT-compatible via `model_name``classify_odoo`/`hydrate_odoo`).
32+
## 2026-05-28 — E-SAVANT-COMPOSITION-1 — the `Reasoner` trait surface (D-ODOO-SAV-4, PR #420) is the wrong shape: savants are typed compositions over `CausalEdge64` + `Tactic` + `callcenter/role_keys`, not service impls
33+
34+
**Status:** FINDING (architectural correction, drives `odoo-savant-reasoners-v2`).
35+
36+
**Click:** v1's "MED on dispatch shape" caveat resolved on review against CLAUDE.md "P-1 The Click" + "P0 AGI-as-glove". v1 shipped `Reasoner` trait + 4 `*Reasoner` impls (`CustomerCategoryReasoner`, `NextBestActionReasoner`, `PostingAnomalyReasoner`, `OtherReasoner`) + `SavantConclusion` struct + `SavantSuggestion` enum + `build_conclusion(savant, ctx)` free function. **Three doctrine litmus tests in CLAUDE.md name this verbatim**: (1) "new capability lands as a new column, not a new layer" — `Reasoner` is a new layer; (2) "free function on a carrier's state = reject" — `build_conclusion(savant, ctx)` is the named anti-pattern; (3) "wrap the axes in a new struct = breaks the SIMD sweep" — `SavantConclusion`/`SavantSuggestion` duplicate `CausalEdge64`. The substrate v1 should have composed instead is already shipped: **`CausalEdge64`** (the 64-bit causal neuron with SPO palette + NARS truth + Pearl 2³ + inference mantissa — *the conclusion IS the emitted edge*), **`Tactic` trait + 34 kernels** (PR #411 ratified explicitly as "the Elixir-like recipe layer ... later fronts the real fingerprint substrate via cognitive-shader-driver with no change to the 34 call sites"), **33-TSV atoms** (PR #411 `contract::atoms::CANONICAL_ATOMS`), **role-key catalogues** (`I-VSA-IDENTITIES` names `callcenter/role_keys.rs` as the future Layer-2 home).
37+
38+
**Mechanism (right shape):** each savant = (role-key identity in `callcenter/role_keys.rs` — one Vsa16kF32 slice per savant) + (typed composition of `Tactic` dispatches over `ThoughtCtx`) + (`CausalEdge64` emission spec: SPO palette + Pearl 2³ + v2 signed mantissa). No new trait. No new conclusion type. No new dispatch service. The shader runs the composition over the SoA columns; the savant's "decision" rides in the emitted `EdgeColumn` row. Per `E-BATON-1`: cross-boundary state IS the `(u16, CausalEdge64)` baton, so the conclusion *literally is* the baton's edge.
39+
40+
**Fix:** `odoo-savant-reasoners-v2` plan + INTEGRATION_PLANS PREPEND + STATUS_BOARD rows (D-ODOO-SAV-5a..5e) + this epiphany — landed in the same commit per board hygiene. v2 keeps v1 compiling under `legacy-reasoner` feature with `#[deprecated]` migration pointers (per `I-LEGACY-API-FEATURE-GATED`) until woa-rs migrates its `Reasoner::reason()` call sites to `SavantPattern` resolution. Removal in a follow-up PR after the migration.
41+
42+
**Lesson (generalizes):** the "consult before guess" rule in CLAUDE.md §"Driving Seat" (3) names this failure mode — *"Grepping ndarray for a primitive name when the family-codec-smith agent or the `encoding-ecosystem.md` knowledge doc has the answer is a rediscovery tax, not a diligence win."* v1 was four trait impls shipped before reading PR #411 (`recipe_kernels.rs` + `Tactic` trait), `causal-edge/edge.rs` (the canonical edge primitive), or `vsa-switchboard-architecture.md` (the three-layer Layer-2 catalogue doctrine). Every one of those contained the answer to "where does the savant's dispatch live." The codex P1 review on PR #420 was the surface signal; this is the underlying diagnosis. Going forward: a plan with "MED on dispatch shape" should ship with the review pass done *before* the implementation D-id, not as a follow-up.
43+
44+
**Cross-ref:** PR #420 (v1 ship), PR #411 (33-TSV atoms + 34-tactic `Tactic`), PR #418 + `E-BATON-1` (mailbox-owned SoA, CE64 as cross-boundary state), `causal-edge/edge.rs` (v2 layout, signed mantissa), `lance-graph-contract::recipe_kernels` (the `Tactic` trait + 34 kernels), CLAUDE.md "P-1 The Click" + "P0 AGI-as-glove" litmus tests, `I-VSA-IDENTITIES` (Layer-2 role catalogues), `I-LEGACY-API-FEATURE-GATED` (deprecation discipline), `.claude/plans/odoo-savant-reasoners-v1.md` (the shipped v1) → `.claude/plans/odoo-savant-reasoners-v2.md` (this reshape).
145
## 2026-05-27 — E-AUDIT-1 — `with_jsonl_audit` jsonl-feature build break: a default-feature `cargo check` masks feature-gated error-type mismatches
246

347
**Status:** FINDING

0 commit comments

Comments
 (0)