Commit 6ded9e0
committed
feat(odoo-spo): selection_value (wishlist P3)
Adds a fifth enrichment pass to spo_enrich.py: `fields.Selection`
declarations with a statically-resolvable list of 2-tuples emit one
`(odoo:<model>.<field>, selection_value, "<key>")` triple per enum key.
# Shape
`_extract_selection_values(call)` pulls the first element of each 2-tuple
from the Selection list — positional arg 0 OR `selection=` kwarg —
preserving source order, de-duplicating (first occurrence wins).
Skipped (values not statically knowable):
- `selection='_compute_states'` (compute-method ref, a str)
- `selection=STATE_CONSTANT` (bare Name)
- `related=...` / any non-list/tuple selection arg
- individual entries that aren't 2-tuples
Truth `(0.95, 0.90)` — read straight from the field decorator,
authoritative. Scoped to corpus-declared ObjectTypes (the additive
boundary, same as P1); Selection fields bind to the same `model_names`
as relational fields (`_name`, else `_inherit[0]`, per #525's decision).
# Consumer use
Lets odoo-rs lower a Selection field to
`DEFINE FIELD state … ASSERT $value IN ['draft','posted','cancel']`
— the UPSTREAM_WISHLIST P3 ask. The five-pass enrichment is now:
P1 (target/inverse_name) + P0 (deep reads_field) + P1b (inherits_from)
+ P2 (validation_kind) + P3 (selection_value).
# Corpus regen pending
The shipped corpus does not yet carry selection_value triples —
regenerating requires running the script against a live Odoo source
tree (`/home/user/odoo/addons`), not present on this host. The Rust
loader's predicate-histogram match arm gained `selection_value` so a
future regenerated corpus drops into the harness without code changes.
`parses_all_triples` count assertion stays at 24 579; re-locks the
moment a session with the source re-runs enrichment.
# Files
spo_enrich.py:
+`_extract_selection_values` helper, +`SELECTION_VALUE_TRUTH`,
+`selections` param threaded through `_scan_file` / `build_all_facts`
/ `enrich`, +Selection branch in the field loop, +P3 emission loop,
+CLI status field.
test_spo_enrich.py:
+12 tests (6 extraction edge cases + 3 scan-binding + 3 emission).
odoo_ontology.rs:
+doc table row, +histogram match arm for `selection_value`.
EPIPHANIES.md: prepended E-ODOO-SPO-SELECTION-VALUE.
# Tests
python3 -m unittest tests.test_spo_enrich : 53/53 OK (was 41)
cargo test -p lance-graph --lib odoo_ontology : 13/13 OK1 parent 402ab09 commit 6ded9e0
4 files changed
Lines changed: 243 additions & 6 deletions
File tree
- .claude/board
- crates/lance-graph/src/graph/spo
- tools/odoo-blueprint-extractor
- odoo_blueprint_extractor
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
1 | 9 | | |
2 | 10 | | |
3 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
Lines changed: 101 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | 81 | | |
65 | 82 | | |
| |||
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
113 | 133 | | |
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
117 | 137 | | |
118 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
119 | 173 | | |
120 | 174 | | |
121 | 175 | | |
| |||
222 | 276 | | |
223 | 277 | | |
224 | 278 | | |
| 279 | + | |
225 | 280 | | |
226 | 281 | | |
227 | 282 | | |
| |||
262 | 317 | | |
263 | 318 | | |
264 | 319 | | |
| 320 | + | |
265 | 321 | | |
266 | 322 | | |
267 | 323 | | |
| |||
311 | 367 | | |
312 | 368 | | |
313 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
314 | 376 | | |
315 | 377 | | |
316 | 378 | | |
| |||
359 | 421 | | |
360 | 422 | | |
361 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
362 | 429 | | |
363 | 430 | | |
364 | 431 | | |
| |||
393 | 460 | | |
394 | 461 | | |
395 | 462 | | |
| 463 | + | |
396 | 464 | | |
397 | | - | |
| 465 | + | |
398 | 466 | | |
399 | 467 | | |
400 | 468 | | |
401 | 469 | | |
402 | 470 | | |
| 471 | + | |
403 | 472 | | |
404 | 473 | | |
405 | 474 | | |
406 | 475 | | |
| 476 | + | |
407 | 477 | | |
408 | 478 | | |
409 | | - | |
410 | | - | |
| 479 | + | |
| 480 | + | |
411 | 481 | | |
412 | 482 | | |
413 | 483 | | |
| |||
468 | 538 | | |
469 | 539 | | |
470 | 540 | | |
| 541 | + | |
471 | 542 | | |
472 | 543 | | |
473 | 544 | | |
| |||
544 | 615 | | |
545 | 616 | | |
546 | 617 | | |
| 618 | + | |
| 619 | + | |
547 | 620 | | |
548 | 621 | | |
549 | 622 | | |
| |||
661 | 734 | | |
662 | 735 | | |
663 | 736 | | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
664 | 757 | | |
665 | 758 | | |
666 | 759 | | |
667 | 760 | | |
668 | 761 | | |
669 | 762 | | |
670 | 763 | | |
671 | | - | |
672 | | - | |
| 764 | + | |
| 765 | + | |
673 | 766 | | |
674 | 767 | | |
675 | 768 | | |
676 | 769 | | |
| 770 | + | |
677 | 771 | | |
678 | 772 | | |
679 | 773 | | |
| |||
733 | 827 | | |
734 | 828 | | |
735 | 829 | | |
| 830 | + | |
736 | 831 | | |
737 | 832 | | |
738 | 833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
596 | 728 | | |
597 | 729 | | |
0 commit comments