feat(ogar-vocab): class_ids module — canonical home for codebook constants#76
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Promotes the compile-time
pub const u16class-id constants from the two-rsconsumer crates (redmine-canon::class_ids,op-canon::class_ids) intoogar-vocabitself. TheCODEBOOKlives here, so the named constants that vouch for it live here too.Why
The two consumer crates have ended up with byte-identical
class_idsmodules (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-vocabthe canonical home. Follow-on PRs on each port will swap their localclass_ids.rsforpub 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_idswith onepub const u16per 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 inALLagrees withcanonical_concept_id(name)for the same name.every_codebook_entry_has_a_const(reverse gate) — ifCODEBOOKpromotes a new concept,ALLmust 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 RedmineIssueand an OpenProjectWorkPackageboth route onPROJECT_WORK_ITEM).Tests
ogar-vocabunit tests 46 → 50 (+4 class_ids tests);cargo check --workspace --all-targets+cargo test --workspacegreen.Follow-ons
Two thin PRs on the
-rsports to replace the localclass_ids.rswith a re-export fromogar_vocab::class_ids. No surface change for downstream consumers.