refactor(op-canon): re-export ogar_vocab::class_ids — one source of truth#50
Conversation
…ruth Follow-on to AdaWorldAPI/OGAR#76 (class_ids landed in ogar-vocab itself). The local class_ids block was byte-identical to redmine-canon::class_ids; both now re-export from ogar_vocab::class_ids so the constants cannot drift across ports. The codebook is minted once in OGAR; the typed constants come from there. Changes: - Cargo.toml: add ogar-vocab git dep (branch=main). - src/class_ids.rs: replaced 180+ lines of constants + 4 drift tests with one `pub use ogar_vocab::class_ids::*` + one slim port-local guard. The retained port-local test (snapshot_concepts_match_re_exported_constants) is the one that's still meaningful here: it verifies the vendored snapshot agrees with OGAR's published codebook for every concept. A regen that produces an id disagreeing with the codebook contract (ids never re-move) fails CI before any consumer breaks. OGAR carries the upstream forward+reverse guards (constants ↔ CODEBOOK). cargo test -p op-canon: 9 unit + 1 doctest, all green. clippy + fmt clean.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f9d47d2aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ("project_custom_value", PROJECT_CUSTOM_VALUE), | ||
| ("project_enabled_module", PROJECT_ENABLED_MODULE), | ||
| ]; | ||
| pub use ogar_vocab::class_ids::*; |
There was a problem hiding this comment.
Preserve the OpenProject-only
ALL list
With the locked OGAR revision, ogar_vocab::class_ids::ALL is the global codebook, not the OpenProject snapshot list: it includes 0x02XX commerce entries such as commercial_line_item, commercial_document, and tax_policy (source). Before this change, op_canon::class_ids::ALL enumerated only concepts present in crates/op-canon/data/op.ogar.json; downstream code that iterates op_canon::class_ids::ALL and resolves each name through Snapshot::concept(...) will now see non-OpenProject names and either panic/drop them or treat commerce ids as OpenProject concepts. Please keep a port-local ALL or otherwise filter the re-export while re-exporting the individual constants.
Useful? React with 👍 / 👎.
What
Follow-on to AdaWorldAPI/OGAR#76 (class_ids landed in
ogar-vocabitself).The local
class_idsblock was byte-identical toredmine-canon::class_ids. Both now re-export fromogar_vocab::class_idsso the constants cannot drift across ports. The codebook is minted once in OGAR; the typed constants come from there.Diff
ALL+ 4 drift testspub use ogar_vocab::class_ids::*;+ one slim port-local guardThe retained port-local test (
snapshot_concepts_match_re_exported_constants) is the one still meaningful here: every concept the vendored snapshot promotes must agree with OGAR's published codebook at the same id. A regen that drifts from the codebook contract (ids never re-move) fails CI before any consumer breaks.OGAR carries the upstream forward+reverse guards (constants ↔
CODEBOOK), so they're not duplicated here.Why
The two
-rsports stop carrying the same byte-identical numbers in two places. A future OGAR codebook promotion needs to update one source, not three. The trade-off — losing strict self-containment (gains anogar-vocabgit dep) — is the architectural choice you steered toward (de-dup over self-contained-seed).Tests
cargo test -p op-canon9 unit + 1 doctest, all green. clippy + fmt clean.Pair
Symmetric PR on the Redmine side: redmine-rs (same shape).
Generated by Claude Code