Commit 34c53f6
committed
fix(coderabbit #458): route deprecated nars_rule() through inference_type()
CodeRabbit caught that the deprecated nars_rule() shim duplicated the
Chain/ChainRev/Fork/Collider → Deduction/Induction/Abduction mapping
that already lives in the canonical inference_type() method.
Two-source mappings drift. If a future PR ever extends the junction
taxonomy or refines a mapping (e.g. Pearl figure → NARS rule discount
calibration), maintainers would have to update both sites and the v1
+ v2 APIs could disagree silently for downstream consumers.
This commit routes nars_rule() through inference_type() so the v1
shim is a transparent projection:
match self.inference_type() {
Some(InferenceType::Deduction) => Some(NarsRule::Deduction),
Some(InferenceType::Induction) => Some(NarsRule::Induction),
Some(InferenceType::Abduction) => Some(NarsRule::Abduction),
Some(InferenceType::Revision) | Some(InferenceType::Synthesis) | None => None,
}
Revision + Synthesis are NOT junction-derivable (no Pearl junction
maps to either), so those arms return None defensively even though
they are unreachable in practice given the Chain/ChainRev/Fork/
Collider/Unrelated exhaustion.
The existing tests (deprecated_nars_rule_matches_inference_type,
deprecated_nars_rule_none_when_unrelated, from_nars_rule_lifts_to_
inference_type) all continue to pass with the routed shim — the
observable behavior is identical; only the source of truth is
consolidated.
The CodeRabbit comment references the same learnings note that codex
P1 #457 cited: 'When a PR ships v2-feature work with v1 API backward-
compat shims, expect codex review to flag any v1 accessor that
hasn't been routed through the canonical mapping. Resolve before
merge; don\'t defer.'
Provenance: CodeRabbit review on PR #458.1 parent c034829 commit 34c53f6
1 file changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
126 | 135 | | |
127 | 136 | | |
128 | 137 | | |
| |||
0 commit comments