-
Notifications
You must be signed in to change notification settings - Fork 0
5+3 council: real-corpus proof + auto-resolves + LAND verdict (Q1-Q9 queue) #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| //! **Real-corpus probe** — compile a REAL Odoo addon tree through the V3 | ||
| //! substrate (`compile_source`), no toy fixtures (5+3 council R5 finding: | ||
| //! every prior `compile_source` call site was an inline snippet). | ||
| //! | ||
| //! Run: `cargo run -p od-ontology --example real_corpus_probe` | ||
| //! (env `ODOO_MODELS` overrides the addon dir; defaults to the account | ||
| //! addon of a sibling odoo checkout). | ||
| //! | ||
| //! Measured 2026-07-07 on /home/user/odoo addons/account/models (55 files, | ||
| //! incl. the 7380-line account_move.py): | ||
| //! files=55 models=71 attrs=642 assocs=293 actions=1496 kausal=347 | ||
| //! classid_resolved=14 | ||
| fn main() { | ||
| let dir = std::env::var("ODOO_MODELS") | ||
| .unwrap_or_else(|_| "/home/user/odoo/addons/account/models".into()); | ||
| let Ok(entries) = std::fs::read_dir(&dir) else { | ||
| eprintln!("real_corpus_probe: {dir} not present — run next to an odoo checkout"); | ||
| return; | ||
| }; | ||
| let (mut files, mut models, mut actions, mut kausal, mut classid_hits, mut attrs, mut assocs) = | ||
| (0usize, 0usize, 0usize, 0usize, 0usize, 0usize, 0usize); | ||
| for e in entries { | ||
| let p = e.expect("dir entry").path(); | ||
| if p.extension().is_none_or(|x| x != "py") { | ||
| continue; | ||
| } | ||
| let src = std::fs::read_to_string(&p).expect("read source"); | ||
| files += 1; | ||
| let ccs = od_ontology::compile_source(&src); | ||
| models += ccs.len(); | ||
| for cc in &ccs { | ||
| attrs += cc.class.attributes.len(); | ||
| assocs += cc.class.associations.len(); | ||
| actions += cc.actions.len(); | ||
| kausal += cc.actions.iter().filter(|a| a.kausal.is_some()).count(); | ||
| if cc.facet.facet_classid() != 0 { | ||
| classid_hits += 1; | ||
| } | ||
| } | ||
| } | ||
| println!( | ||
| "REAL-CORPUS: files={files} models={models} attrs={attrs} assocs={assocs} \ | ||
| actions={actions} kausal={kausal} classid_resolved={classid_hits}" | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| //! **Real-source compile pin** — the V3 substrate over a REAL Odoo model file, | ||
| //! not a toy fixture. | ||
| //! | ||
| //! 5+3 council finding (R5, 2026-07-07): every `compile_source` call site was | ||
| //! an inline 4–20-line snippet, so "the transpile is complete" had never been | ||
| //! exercised against real Odoo source. This test compiles the VERBATIM | ||
| //! `addons/account/models/account_move.py` (7 380 lines, vendored at | ||
| //! `data/account_move_real.py` exactly like the `account_move_form_view.xml` | ||
| //! fixture precedent) through `compile_source` and pins what comes out. | ||
| //! | ||
| //! The full-addon sweep lives in `examples/real_corpus_probe.rs` (55 files → | ||
| //! 71 models / 1 496 actions / 347 kausal, measured 2026-07-07); this test is | ||
| //! the committed, always-running slice of that run. | ||
|
|
||
| use od_ontology::compile_source; | ||
|
|
||
| #[test] | ||
| fn real_account_move_compiles_through_the_v3_substrate() { | ||
| let src = include_str!("../../../data/account_move_real.py"); | ||
| assert!(src.lines().count() > 7_000, "the fixture is the real file, not a stub"); | ||
|
|
||
| let compiled = compile_source(src); | ||
|
|
||
| // The file defines exactly account.move (account.move.line lives in its | ||
| // own file). Counts below are drift-fuses from the 2026-07-07 run — a | ||
| // change means the frontend's harvest or the vendored fixture moved; | ||
| // re-run, re-pin, and say so in the commit. | ||
| assert_eq!(compiled.len(), 1, "models harvested from the real file"); | ||
|
|
||
| let move_cc = compiled | ||
| .iter() | ||
| .find(|cc| cc.class.name == "account_move") | ||
| .expect("account.move is lifted"); | ||
|
|
||
| // Identity: the canon-high render classid rides the facet. | ||
| assert_eq!(move_cc.facet.facet_classid(), 0x0202_0002); | ||
|
|
||
| // THINK arm: the real model is field-rich (109 declared fields in the | ||
| // briefing; the frontend's harvest of THIS file's declarations lands | ||
| // attributes + associations — pinned from the run). | ||
| assert_eq!(move_cc.class.attributes.len(), 104, "attrs (2026-07-07 fuse)"); | ||
| assert_eq!(move_cc.class.associations.len(), 38, "assocs (2026-07-07 fuse)"); | ||
| assert_eq!(move_cc.class.computed_fields.len(), 93, "computed fields (2026-07-07 fuse)"); | ||
|
|
||
| // DO arm: hundreds of real methods arrive as ActionDefs, a substantial | ||
| // subset with a causal trigger (depends/constrains/onchange). | ||
| assert_eq!(move_cc.actions.len(), 354, "DO-arm ActionDefs (2026-07-07 fuse)"); | ||
| assert_eq!( | ||
| move_cc.actions.iter().filter(|a| a.kausal.is_some()).count(), | ||
| 92, | ||
| "kausal-carrying subset (2026-07-07 fuse)" | ||
| ); | ||
|
|
||
| // Spot identity: the flagship compute exists with its body facts. | ||
| let amount_compute = move_cc | ||
| .actions | ||
| .iter() | ||
| .find(|a| a.predicate == "_compute_amount") | ||
| .expect("the real _compute_amount arrives as an ActionDef"); | ||
| assert!( | ||
| !amount_compute.reads.is_empty() || amount_compute.kausal.is_some(), | ||
| "_compute_amount carries facts (reads or kausal)" | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
ODOO_MODELSis unset outside the author's machine, this hard-coded/home/user/odoodefault misses the documented sibling checkout and then returns exit 0. That makescargo run -p od-ontology --example real_corpus_probelook successful while compiling zero real files, so the real-corpus proof can be silently skipped in local or CI verification runs; derive the default relative to the repo or exit with an error.Useful? React with 👍 / 👎.