Skip to content

Commit 5a1f187

Browse files
authored
Merge pull request #585 from AdaWorldAPI/claude/medcare-bridge-lance-graph-wmx76z
refactor(ontology): move OGAR port bridges to lance-graph-ogar — restore OGIT/OGAR SoC
2 parents d8bd3e6 + 17f7182 commit 5a1f187

15 files changed

Lines changed: 116 additions & 98 deletions

Cargo.lock

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/lance-graph-ogar/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ serde = ["ogar-vocab/serde", "ogar-adapter-surrealql/serde"]
7272
# folds ogar-class-view's transitive git contract onto it = ONE source.
7373
lance-graph-contract = { path = "../lance-graph-contract" }
7474

75+
# OGIT spine (the NamespaceBridge trait + registry + namespace/error types the
76+
# OGAR-driven port bridges build on). The OGIT/OGAR seam: the bridges live HERE
77+
# (OGAR) because they couple to ogar-vocab; the trait + registry they implement
78+
# against live in lance-graph-ontology (OGIT). OGIT does NOT depend on OGAR.
79+
lance-graph-ontology = { path = "../lance-graph-ontology" }
80+
7581
# ── OGAR Active-Record forks: git deps @ main (the canonical superset; matches
7682
# symbiont's pins so they resolve to ONE source in the golden image) ──
7783
ogar-vocab = { git = "https://github.com/AdaWorldAPI/OGAR", branch = "main" }
@@ -89,3 +95,8 @@ ogar-adapter-surrealql = { git = "https://github.com/AdaWorldAPI/OGAR", branch =
8995
# the patch (see the CONSUMER REQUIREMENT note in the header).
9096
[patch."https://github.com/AdaWorldAPI/lance-graph"]
9197
lance-graph-contract = { path = "../lance-graph-contract" }
98+
99+
[dev-dependencies]
100+
# TTL fixtures for the moved bridge scope-lock / codebook-convergence tests
101+
# stage on-disk via tempfile::tempdir() + std::fs (matches lance-graph-ontology).
102+
tempfile = "3"

crates/lance-graph-ontology/src/bridges/medcare_bridge.rs renamed to crates/lance-graph-ogar/src/bridges/medcare_bridge.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ mod tests {
4949
//! Healthcare fixtures differ.
5050
5151
use super::*;
52-
use crate::bridge::{BridgeError, NamespaceBridge};
53-
use crate::error::Error;
54-
use crate::namespace::NamespaceId;
55-
use crate::namespace_registry::NamespaceRegistry;
56-
use crate::registry::OntologyRegistry;
52+
use lance_graph_ontology::bridge::{BridgeError, NamespaceBridge};
53+
use lance_graph_ontology::error::Error;
54+
use lance_graph_ontology::namespace::NamespaceId;
55+
use lance_graph_ontology::namespace_registry::NamespaceRegistry;
56+
use lance_graph_ontology::registry::OntologyRegistry;
5757
use ogar_vocab::class_ids;
5858
// PortSpec needed in scope for `HealthcarePort::aliases()`.
5959
use ogar_vocab::ports::PortSpec;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//! OGAR-driven tenant port bridges.
2+
//!
3+
//! This is the OGAR side of the OGIT/OGAR separation (operator,
4+
//! 2026-06-20). These bridges couple to `ogar_vocab::ports` /
5+
//! `ogar_vocab::class_ids` (the OGAR codebook + `PortSpec` class schema),
6+
//! so they live here in `lance-graph-ogar`, NOT in `lance-graph-ontology`
7+
//! (which is OGIT and must not depend on `ogar-vocab`). The OGIT-side
8+
//! legacy bridges (`WoaBridge` / `SpearBridge` / `SharePointBridge` /
9+
//! `OgitBridge`) stay in `lance_graph_ontology::bridges`.
10+
//!
11+
//! # Two layers
12+
//!
13+
//! - The **generic harness** [`unified::UnifiedBridge<P: PortSpec>`] is the
14+
//! one-and-only `lance_graph_ontology::NamespaceBridge` impl for
15+
//! OGAR-driven ports. It inherits everything that varies between ports
16+
//! (`NAMESPACE` / `BRIDGE_ID` / public-name → class_id aliases) from
17+
//! `ogar_vocab::ports::PortSpec`. Adding a port is `impl PortSpec for
18+
//! FooPort {…}` in OGAR — no bridge boilerplate here.
19+
//! - The **per-port aliases** ([`OpenProjectBridge`], [`RedmineBridge`],
20+
//! [`MedcareBridge`]) are thin `type` aliases over the harness.
21+
//!
22+
//! # OGAR-driven ports (`UnifiedBridge<P>` aliases)
23+
//!
24+
//! - [`OpenProjectBridge`]: `UnifiedBridge<ogar_vocab::ports::OpenProjectPort>`
25+
//! — locks to the `OpenProject` namespace. `WorkPackage` / `TimeEntry`
26+
//! / `Project` etc. resolve to OGAR canonical class_ids via the
27+
//! port's alias table.
28+
//! - [`RedmineBridge`]: `UnifiedBridge<ogar_vocab::ports::RedminePort>` —
29+
//! locks to the `Redmine` namespace. `Issue` / `TimeEntry` / `Project`
30+
//! etc. resolve to the SAME OGAR canonical class_ids as the
31+
//! OpenProject equivalents, so cross-fork convergence is the default
32+
//! not the exception.
33+
//! - [`MedcareBridge`]: `UnifiedBridge<ogar_vocab::ports::HealthcarePort>`
34+
//! — locks to the `Healthcare` namespace. `Patient` / `Diagnosis` /
35+
//! `LabValue` / `Medication` / `Treatment` / `Visit` / `VitalSign`
36+
//! resolve to the `0x09XX` Health codebook (Northstar T9).
37+
38+
pub mod unified;
39+
40+
mod medcare_bridge;
41+
mod openproject_bridge;
42+
mod redmine_bridge;
43+
44+
pub use medcare_bridge::{HealthcarePort, MedcareBridge};
45+
pub use openproject_bridge::{OpenProjectBridge, OpenProjectPort};
46+
pub use redmine_bridge::{RedmineBridge, RedminePort};
47+
pub use unified::UnifiedBridge;
48+
49+
// Compatibility shims for the pre-migration constants. `bridges`
50+
// previously re-exported `OPENPROJECT_CODEBOOK` / `REDMINE_CODEBOOK`
51+
// directly; both now live in `ogar_vocab::ports::*_ALIASES` (the
52+
// canonical layer is the single source of truth). The re-exports here
53+
// are `#[deprecated]` in the per-port modules and forward to the OGAR
54+
// constants — existing consumers keep compiling (codex P2 on PR #570).
55+
#[allow(deprecated)]
56+
pub use openproject_bridge::OPENPROJECT_CODEBOOK;
57+
#[allow(deprecated)]
58+
pub use redmine_bridge::REDMINE_CODEBOOK;

crates/lance-graph-ontology/src/bridges/openproject_bridge.rs renamed to crates/lance-graph-ogar/src/bridges/openproject_bridge.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ mod tests {
4949
//! `UnifiedBridge<OpenProjectPort>` instead of a local struct.
5050
5151
use super::*;
52-
use crate::bridge::{BridgeError, NamespaceBridge};
53-
use crate::error::Error;
54-
use crate::namespace::NamespaceId;
55-
use crate::namespace_registry::NamespaceRegistry;
56-
use crate::registry::OntologyRegistry;
52+
use lance_graph_ontology::bridge::{BridgeError, NamespaceBridge};
53+
use lance_graph_ontology::error::Error;
54+
use lance_graph_ontology::namespace::NamespaceId;
55+
use lance_graph_ontology::namespace_registry::NamespaceRegistry;
56+
use lance_graph_ontology::registry::OntologyRegistry;
5757
use ogar_vocab::class_ids;
5858
// PortSpec needed in scope for `OpenProjectPort::aliases()` (the
5959
// method is a trait item — codex P1 on PR #570).

crates/lance-graph-ontology/src/bridges/redmine_bridge.rs renamed to crates/lance-graph-ogar/src/bridges/redmine_bridge.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ pub const REDMINE_CODEBOOK: &[(&str, u16)] = ogar_vocab::ports::REDMINE_ALIASES;
3535
#[cfg(test)]
3636
mod tests {
3737
use super::*;
38-
use crate::bridge::{BridgeError, NamespaceBridge};
39-
use crate::error::Error;
40-
use crate::namespace::NamespaceId;
41-
use crate::namespace_registry::NamespaceRegistry;
42-
use crate::registry::OntologyRegistry;
38+
use lance_graph_ontology::bridge::{BridgeError, NamespaceBridge};
39+
use lance_graph_ontology::error::Error;
40+
use lance_graph_ontology::namespace::NamespaceId;
41+
use lance_graph_ontology::namespace_registry::NamespaceRegistry;
42+
use lance_graph_ontology::registry::OntologyRegistry;
4343
use ogar_vocab::class_ids;
4444
// PortSpec needed in scope for `RedminePort::aliases()` (the method
4545
// is a trait item — codex P1 on PR #570).

crates/lance-graph-ontology/src/bridges/unified.rs renamed to crates/lance-graph-ogar/src/bridges/unified.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
//! `P::NAMESPACE`), so downstream context-based routing can
4646
//! distinguish per-port data from the default (unbound) context.
4747
48-
use crate::bridge::{BridgeError, BridgeFromRegistry, EntityRef, NamespaceBridge};
49-
use crate::error::{Error, Result};
50-
use crate::namespace::{NamespaceId, OgitUri, SchemaKind, SchemaPtr};
51-
use crate::namespace_registry::NamespaceRegistry;
52-
use crate::registry::OntologyRegistry;
48+
use lance_graph_ontology::bridge::{BridgeError, BridgeFromRegistry, EntityRef, NamespaceBridge};
49+
use lance_graph_ontology::error::{Error, Result};
50+
use lance_graph_ontology::namespace::{NamespaceId, OgitUri, SchemaKind, SchemaPtr};
51+
use lance_graph_ontology::namespace_registry::NamespaceRegistry;
52+
use lance_graph_ontology::registry::OntologyRegistry;
5353
use ogar_vocab::ports::PortSpec;
5454
use std::marker::PhantomData;
5555
use std::sync::Arc;

crates/lance-graph-ogar/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ pub use ogar_class_view::OgarClassView;
7878
/// The calcified canonical AR shape (attributes + family `Association`s).
7979
pub use ogar_vocab::Class;
8080

81+
// ── OGAR-driven tenant port bridges (moved out of lance-graph-ontology,
82+
// which is OGIT and must not depend on ogar-vocab) ──
83+
pub mod bridges;
84+
85+
pub use bridges::{
86+
HealthcarePort, MedcareBridge, OpenProjectBridge, OpenProjectPort, RedmineBridge, RedminePort,
87+
UnifiedBridge,
88+
};
89+
8190
/// Codebook parity-guard — the drift fuse between OGAR's authoritative codebook
8291
/// (`ogar_vocab::class_ids::ALL`) and the contract's zero-dep wire mirror
8392
/// (`lance_graph_contract::ogar_codebook::CODEBOOK`). Two depths so it cannot be

crates/lance-graph-ontology/tests/bridge_codebook_convergence.rs renamed to crates/lance-graph-ogar/tests/bridge_codebook_convergence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! `REDMINE_CODEBOOK`) keyed off the shared
1919
//! `lance_graph_ontology::bridges::codebook::*` constants.
2020
21-
use lance_graph_ontology::bridges::{OpenProjectBridge, RedmineBridge};
21+
use lance_graph_ogar::bridges::{OpenProjectBridge, RedmineBridge};
2222
use ogar_vocab::class_ids as codebook;
2323
use lance_graph_ontology::{NamespaceBridge, OntologyRegistry};
2424
use std::fs;

crates/lance-graph-ontology/tests/bridge_scope_lock.rs renamed to crates/lance-graph-ogar/tests/bridge_scope_lock.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
//! or `BridgeError::NotInScope` (the latter when the namespace itself is
1212
//! present but the public name was filed under a different bridge id).
1313
14-
use lance_graph_ontology::bridges::{MedcareBridge, OgitBridge, WoaBridge};
14+
use lance_graph_ogar::bridges::MedcareBridge;
15+
use lance_graph_ontology::bridges::{OgitBridge, WoaBridge};
1516
use lance_graph_ontology::{NamespaceBridge, OgitUri, OntologyRegistry};
1617
use std::fs;
1718
use std::sync::Arc;

0 commit comments

Comments
 (0)