feat(ogar-vocab): APP‖class machinery — typed PortSpec::APP_PREFIX + app render-classid composition#97
Merged
Merged
Conversation
…prefix
Implements the §2 allocation table in APP-CLASS-CODEBOOK-LAYOUT.md as
typed associated constants on PortSpec, so consumers re-export the
reserved prefix instead of hardcoding hex literals like 0x0001.
The trait gains a provided (defaulted) associated const:
const APP_PREFIX: u16 = 0x0000;
Default 0x0000 is the shared canonical core — the cross-app ontology
every consumer reuses. Each of the six app ports overrides with its
reserved prefix from the §2 table:
OpenProjectPort 0x0001
OdooPort 0x0002
WoaPort 0x0003
SmbPort 0x0004
HealthcarePort 0x0005
RedminePort 0x0007
These values are straight from the §2 allocation table; the doc
explicitly states "reserving costs nothing" — no codebook is
materialised until an app mints its first private class. This PR is
reserving (implementing the table as typed data), not minting a new
class_id.
Change is non-breaking: the provided default (0x0000) means every
PortSpec impl that does not override APP_PREFIX continues to compile
and behaves as shared-core, which is the correct default.
A new test `app_prefixes_match_the_allocation_table` asserts all six
prefix values against the §2 table. Existing 26 tests are unchanged
and continue to pass.
…sition Companion to the typed PortSpec::APP_PREFIX in this branch: adds `ogar_vocab::app`, the central high-u16 composition machinery from APP-CLASS-CODEBOOK-LAYOUT.md §0/§4, so consumers re-export ONE source of the bit math instead of each re-implementing `(prefix << 16) | concept` locally. - render_classid(prefix, concept) -> u32 compose the full classid - render_classid_for::<P: PortSpec>(concept) compose from P::APP_PREFIX - app_of(classid) -> u16 high half (render lens, §4 key) - concept_of(classid) -> u16 low half (shared RBAC+ontology) This resolves the duplication where each consumer (op-canon #56, the redmine-canon twin) defines its own `render_classid` over a local 0x000N literal: they now compose via `render_classid_for::<OpenProjectPort>(concept)` reading the typed PortSpec::APP_PREFIX — one source of truth, same discipline as class_ids. Composing the high half is reserving/stamping, not minting a class_id (§2); concept (low-u16) mints stay gated on the 5+3 pass. Core (hi=0x0000) is bit-identical to the bare concept (I-APP1/I-APP5), pinned by test. cargo +1.95 test -p ogar-vocab --lib app:: -> 6 passed; ports:: -> 27 passed; check --workspace --all-targets clean.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Jun 22, 2026
AdaWorldAPI
pushed a commit
that referenced
this pull request
Jun 22, 2026
…aph #592 coordination loop PR #592 (parallel session) closed `ISS-CONTRACT-APP-PREFIX-MIRROR` by mirroring OGAR #97's `PortSpec::APP_PREFIX` / `render_classid_for` into `lance_graph_contract::ogar_codebook` as `AppPrefix` + `render_classid_for_concept` (wire-compat, parity-pinned, no `ogar-vocab` dep). Its coordination note left the OGAR-side companion — the spine-vs-membrane import-path distinction in OGAR #100 §2 — to this session. This commit closes that loop. Changes to docs/OGAR-CONSUMER-BEST-PRACTICES.md: §2 — new preface block: pins the BBB-barrier rule (spine-internal crates freely depend on `ogar-vocab`; membrane crates restricted to `lance-graph-contract` only), with the allowed-deps × canonical-path table. Both paths return identical classids — the choice is dep-tree posture, not concept identity. Pattern 1 split — Pattern 1a (spine, `ogar_vocab::ports::*Port::class_id`) + Pattern 1b (membrane, `lance_graph_contract::ogar_codebook::canonical_concept_id`). Pattern 2 split — Pattern 2a (spine, `*Port::APP_PREFIX | concept`) + Pattern 2b (membrane, `AppPrefix::*.render(cid)` or `render_classid_for_concept(AppPrefix::*, name)` — the one-call helper). Cites lance-graph #592, names the parity test `app_prefixes_match_ogar_allocation_table` as the drift fuse. §5 trigger phrases — extended with `BBB-barrier` · `contract::ogar_codebook` · `canonical_concept_id` · `AppPrefix` · `render_classid_for_concept` · `lance_graph_contract::ogar_codebook` · `membrane consumer` · `spine vs membrane`. §6 cross-refs — sharpened lance-graph #591 entry (surfaced the gap) and added lance-graph #592 entry (closed it with the membrane mirror). Patterns 3 + 4, §3 anti-pattern catalogue, §4 worked Medcare migration narrative — unchanged (they're correct as-is; the membrane variant inherits from the new 1b/2b without further branching). Docs-only. Closes the consumer/membrane half of the ISS-CONTRACT-APP-PREFIX-MIRROR coordinated fix. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP
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.
Adjusts OGAR to the OGAR#95 APP-CLASS-CODEBOOK-LAYOUT spec (§2/§4) by providing the high-u16 render-prefix layer as typed data + central composition, so consumers re-export ONE source instead of hardcoding
0x000Nliterals + re-implementing the bit math.Typed prefixes —
PortSpec::APP_PREFIX(provided default0x0000= shared core; overridden per §2: OpenProject=0x0001, Odoo=0x0002, WoA=0x0003, SMB=0x0004, Healthcare/Medcare=0x0005, Redmine=0x0007). Pinned byapp_prefixes_match_the_allocation_table.Central composition — new
ogar_vocab::app(§0/§4):render_classid(prefix, concept) -> u32,render_classid_for::<P: PortSpec>(concept)(reads the port's APP_PREFIX),app_of(classid) -> u16(high/render half),concept_of(classid) -> u16(low/shared RBAC+ontology half). Consumers composerender_classid_for::<OpenProjectPort>(concept)→0x0001_DDCCrather than a local literal.Non-breaking (provided default). Reserving/stamping the high half is not minting a class_id (§2 'reserving costs nothing'); concept (low-u16) mints stay gated on the 5+3 pass. Core (hi=0x0000) is bit-identical to the bare concept (I-APP1/I-APP5), pinned by test.
cargo +1.95 test -p ogar-vocab --lib: app:: 6 passed, ports:: 27 passed;check --workspace --all-targetsclean.