Skip to content

refactor(op-canon): re-export ogar_vocab::class_ids — one source of truth#50

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/op-canon-class-ids-from-ogar
Jun 19, 2026
Merged

refactor(op-canon): re-export ogar_vocab::class_ids — one source of truth#50
AdaWorldAPI merged 1 commit into
mainfrom
claude/op-canon-class-ids-from-ogar

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

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.

Diff

Before After
~180 lines of constants + ALL + 4 drift tests one pub use ogar_vocab::class_ids::*; + one slim port-local guard
crates/op-canon/Cargo.toml       |   4 +
crates/op-canon/src/class_ids.rs | 183 ++++++-------------------------
3 files changed, 44 insertions(+), 149 deletions(-)

The 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 -rs ports 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 an ogar-vocab git dep) — is the architectural choice you steered toward (de-dup over self-contained-seed).

Tests

cargo test -p op-canon 9 unit + 1 doctest, all green. clippy + fmt clean.

Pair

Symmetric PR on the Redmine side: redmine-rs (same shape).


Generated by Claude Code

…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.
@AdaWorldAPI AdaWorldAPI merged commit 3476add into main Jun 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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::*;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants