Skip to content

feat(ogar-vocab): canonical_concept_name — the id → concept-name reverse map#98

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/classid-concept-name-reverse
Jun 22, 2026
Merged

feat(ogar-vocab): canonical_concept_name — the id → concept-name reverse map#98
AdaWorldAPI merged 1 commit into
mainfrom
claude/classid-concept-name-reverse

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

Adds the inverse of canonical_concept_id:

pub fn canonical_concept_name(id: u16) -> Option<&'static str>

A linear scan over the existing CODEBOOK (the (name, id) source of truth).
Ids are unique in the codebook — now asserted by a round-trip test over all 39
entries — so the mapping is 1:1 and round-trips both ways:
canonical_concept_id(canonical_concept_name(id)?) == Some(id).

id → name
0x0202 commercial_document
0x0103 billable_work_entry
0x0204 billing_party
0xFFFF / 0x0000 None

Why

This is the capability odoo-rs filed as PROBE-OGAR-ID-TO-CONCEPT-NAME
(its specs/UPSTREAM_WISHLIST.md). A consumer that resolved a classid via a
port alias (name → id) needs the id → concept-name direction to:

  1. stamp a readable COMMENT 'commercial_document (classid:0x00020202)'
    into emitted SurrealQL DDL (today it can only stamp the hex), and
  2. populate Class::canonical_concept from an id so schema_classids
    collapses into a derived view over Class::canonical_id()

without copying the codebook locally, which the Core-First doctrine forbids
(the consumer must pull from the Core, not mint a parallel registry). The
forward+reverse pair also resolves the lexical asymmetry the consumer can't:
both sale.order and account.move resolve to 0x0202 → commercial_document,
where neither name lexically is the concept.

Verified

  • 2 new tests: canonical_concept_name_round_trips (all 39 CODEBOOK entries,
    both directions — doubles as the id-uniqueness guard) +
    canonical_concept_name_known_ids_and_none_for_unknown.
  • Full ogar-vocab suite 85 passing, 0 failed.
  • clippy clean on the new code (exit 0).

Additive, zero behaviour change, no symbol removed. Unblocks the odoo-rs
name-enrichment + canonical_concept fusion (follow-on PR once this lands).

…rse map

The inverse of `canonical_concept_id`: `canonical_concept_name(u16) ->
Option<&'static str>`, a linear scan over the existing CODEBOOK. Ids are
unique in the codebook (now asserted by a round-trip test over all 39
entries), so the mapping is 1:1 and round-trips both ways.

This is the capability odoo-rs filed as PROBE-OGAR-ID-TO-CONCEPT-NAME
(its specs/UPSTREAM_WISHLIST.md): a consumer that resolved a classid via a
port alias (name → id) needs id → concept-name to (a) stamp a readable
`COMMENT 'commercial_document (classid:0x00020202)'` into emitted DDL and
(b) populate `Class::canonical_concept` from an id — WITHOUT copying the
codebook locally (which the Core-First doctrine forbids). The forward step
plus this reverse step also resolves the lexical asymmetry: both
`sale.order` and `account.move` resolve to 0x0202 → `commercial_document`,
where neither name lexically IS the concept.

Additive, zero behaviour change. 2 new tests (round-trip over CODEBOOK +
known-ids/None); full ogar-vocab suite 85 passing, clippy clean on the new
code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@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 7e67718 into main Jun 22, 2026
1 check passed
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