Skip to content

feat(ogar-vocab): class_ids module — canonical home for codebook constants#76

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

feat(ogar-vocab): class_ids module — canonical home for codebook constants#76
AdaWorldAPI merged 1 commit into
mainfrom
claude/ogar-vocab-class-ids

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

Promotes the compile-time pub const u16 class-id constants from the two -rs consumer crates (redmine-canon::class_ids, op-canon::class_ids) into ogar-vocab itself. The CODEBOOK lives here, so the named constants that vouch for it live here too.

Why

The two consumer crates have ended up with byte-identical class_ids modules (same 26 project-mgmt + 6 commerce constants, same drift-guard tests). That's a smell — the codebook is a single artifact minted once in OGAR, and the constants are its typed face. They shouldn't be re-declared in every consumer.

This PR makes ogar-vocab the canonical home. Follow-on PRs on each port will swap their local class_ids.rs for pub use ogar_vocab::class_ids; (re-export), so the two ports stop duplicating the same numbers and instead inherit OGAR's drift guards.

New surface (additive)

  • pub mod class_ids with one pub const u16 per promoted concept (26 project-mgmt + 6 commerce = 32 constants).
  • class_ids::ALL: &[(&str, u16)] — every (name, id) pair the constants vouch for, for tabular dispatch / debug.

Drift guards

  • constants_match_codebook (forward gate) — every entry in ALL agrees with canonical_concept_id(name) for the same name.
  • every_codebook_entry_has_a_const (reverse gate) — if CODEBOOK promotes a new concept, ALL must learn it (catches "promotion landed without exposing a const").
  • constants_are_unique_and_non_zero.
  • divergent_curator_names_share_one_constant — pins the headline pairs (a Redmine Issue and an OpenProject WorkPackage both route on PROJECT_WORK_ITEM).

Tests

ogar-vocab unit tests 46 → 50 (+4 class_ids tests); cargo check --workspace --all-targets + cargo test --workspace green.

Follow-ons

Two thin PRs on the -rs ports to replace the local class_ids.rs with a re-export from ogar_vocab::class_ids. No surface change for downstream consumers.

…tants

Promotes the compile-time `pub const u16` class-id constants from the two
`-rs` consumer crates (`redmine-canon::class_ids`, `op-canon::class_ids`)
into `ogar-vocab` itself. The CODEBOOK lives here, so the named constants
that vouch for it live here too. Follow-on PRs on each port will swap
their local block for a `pub use ogar_vocab::class_ids;` re-export so the
ports stop duplicating the same byte-identical numbers.

New surface (additive):
- `pub mod class_ids` with one `pub const u16` per promoted concept
  (26 project-mgmt + 6 commerce = 32 constants).
- `class_ids::ALL: &[(&str, u16)]` — every (name, id) pair the constants
  vouch for, for tabular dispatch / debug.

Drift guards (in `class_ids::tests`):
- constants_match_codebook (forward gate) — every entry in ALL agrees
  with canonical_concept_id(name) for the same name.
- every_codebook_entry_has_a_const (reverse gate) — if CODEBOOK promotes
  a new concept, ALL must learn it.
- constants_are_unique_and_non_zero.
- divergent_curator_names_share_one_constant — pins the headline pairs.

ogar-vocab unit tests 46 -> 50; workspace check + test green.

The constants are the codebook's typed face. Ports re-exporting them
inherits OGAR's drift guards "for free", and the two ports stay
byte-identical mechanically.
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