Commit 230e5f4
committed
fix(bridges): codebook convergence + seed OpenProject/Redmine + co-located tests
Addresses three review items left open after PR #558 (OpenProjectBridge,
C4) and PR #559 (RedmineBridge, C5):
1. codex P1 on #559 — Preserve codebook IDs across Redmine aliases
RegistryState::append reuses entity_type_id only when the exact
ogit_uri matches, so ogit.Redmine:Issue and ogit.OpenProject:WorkPackage
minted distinct ids despite the C5 PR body promising both routed to
the same project_work_item arm.
Fix: both bridges now override NamespaceBridge::entity() with a
codebook-aware lookup. Public names in the per-port codebook table
(OPENPROJECT_CODEBOOK / REDMINE_CODEBOOK) synthesize EntityRefs
whose entity_type_id is the OGAR codebook class_id from the new
bridges::codebook module — the single source of truth shared by
both bridges. WorkPackage and Issue both route to
codebook::PROJECT_WORK_ITEM = 0x0102.
2. codex P2 on #558 — Seed OpenProject before exposing bridge
OpenProject (and Redmine) were missing from
NamespaceRegistry::seed_defaults(), so SchemaPtr::ontology_context_id()
stamped 0 (the unbound/export-only context) on every OpenProject row.
Fix: add OpenProject (ctx_id=6) and Redmine (ctx_id=7) to seed_defaults().
Bridge entity() synthesis stamps the seeded ctx_id via the new public
accessor NamespaceRegistry::seed_context_id, replacing the private
SEED_NAMESPACE_REGISTRY static (single source of truth across the
registry's append() path and the bridge codebook path).
3. CodeRabbit on #558 — Add co-located #[cfg(test)] unit tests
Both openproject_bridge.rs and redmine_bridge.rs now ship
inline test modules covering constructor success/failure, contract
methods (bridge_id, g_lock), codebook-driven entity() resolution,
stamped context_id, full codebook walk, and fallback-to-registry
for non-codebook names. Integration tests stay (scope_lock +
bridge_codebook_convergence).
Also: PR #559 was merged into the C4 branch (not main) due to a
stacked-PR base-update gap; RedmineBridge never reached main. This
PR brings it back along with the convergence fix.
New tests:
- tests/bridge_codebook_convergence.rs (5 tests): WorkPackage/Issue
share class_id; Project/TimeEntry symmetric pin; port-specific
aliases (Status/IssueStatus, Type/Tracker) converge; namespace_ids
stay distinct; seeded ctx_id stamped.
- tests/redmine_bridge_scope_lock.rs (4 tests): re-add the C5 scope-lock
contract symmetric to openproject_bridge_scope_lock.rs.
- 7 inline unit tests per bridge file (14 total).
- 2 unit tests in bridges::codebook (constants + monotonicity).
Files:
- crates/lance-graph-ontology/src/bridges/codebook.rs (new)
- crates/lance-graph-ontology/src/bridges/mod.rs (re-export codebook + RedmineBridge)
- crates/lance-graph-ontology/src/bridges/openproject_bridge.rs (codebook override + co-located tests)
- crates/lance-graph-ontology/src/bridges/redmine_bridge.rs (new — re-add after lost #559 merge)
- crates/lance-graph-ontology/src/namespace_registry.rs (seed_defaults + seed_context_id accessor)
- crates/lance-graph-ontology/src/registry.rs (use the new accessor; drop private static)
- crates/lance-graph-ontology/tests/bridge_codebook_convergence.rs (new)
- crates/lance-graph-ontology/tests/redmine_bridge_scope_lock.rs (new — re-add)1 parent c05394f commit 230e5f4
8 files changed
Lines changed: 1075 additions & 48 deletions
File tree
- crates/lance-graph-ontology
- src
- bridges
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 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 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
26 | 39 | | |
27 | 40 | | |
28 | 41 | | |
29 | 42 | | |
30 | 43 | | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| 48 | + | |
34 | 49 | | |
35 | 50 | | |
36 | 51 | | |
37 | 52 | | |
38 | 53 | | |
39 | 54 | | |
40 | | - | |
| 55 | + | |
| 56 | + | |
41 | 57 | | |
42 | 58 | | |
43 | 59 | | |
0 commit comments