Skip to content

feat(ogar-vocab): APP‖class machinery — typed PortSpec::APP_PREFIX + app render-classid composition#97

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/port-app-prefix
Jun 22, 2026
Merged

feat(ogar-vocab): APP‖class machinery — typed PortSpec::APP_PREFIX + app render-classid composition#97
AdaWorldAPI merged 2 commits into
mainfrom
claude/port-app-prefix

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

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 0x000N literals + re-implementing the bit math.

Typed prefixesPortSpec::APP_PREFIX (provided default 0x0000 = shared core; overridden per §2: OpenProject=0x0001, Odoo=0x0002, WoA=0x0003, SMB=0x0004, Healthcare/Medcare=0x0005, Redmine=0x0007). Pinned by app_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 compose render_classid_for::<OpenProjectPort>(concept)0x0001_DDCC rather 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-targets clean.

claude added 2 commits June 22, 2026 17:49
…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.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@AdaWorldAPI AdaWorldAPI merged commit 2ce9056 into main Jun 22, 2026
1 check passed
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
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