Skip to content

feat(ogar-vocab): all_promoted_classes() — single enumerator over the 32 promoted concepts#90

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/ogar-all-promoted-classes
Jun 21, 2026
Merged

feat(ogar-vocab): all_promoted_classes() — single enumerator over the 32 promoted concepts#90
AdaWorldAPI merged 1 commit into
mainfrom
claude/ogar-all-promoted-classes

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

The W0.2 prerequisite from the Redmine Integration Plan

Per the post-#89 fixup, the Foundation phase needs an enumerator so
rm-store has one call site for whole-schema DDL emission via
ogar_adapter_surrealql::emit_surrealql_ddl(&[Class]). Today the
32 promoted classes have constructor fns but no enumerator → drift-prone.

The fix

#[must_use]
pub fn all_promoted_classes() -> Vec<Class> {
    vec![
        project(), project_work_item(), billable_work_entry(),
        // ... 26 more, all 32 in class_ids::ALL order
    ]
}

Usage:

let ddl = emit_surrealql_ddl(&all_promoted_classes());

Tests (4)

  • length-matches-class_ids::ALL — forward gate against new
    codebook entries that forget the constructor call
  • position-by-position canonical_concept + canonical_id match — pins
    order as part of the contract
  • no duplicates — defensive against copy-paste typos
  • every entry has a canonical_id — catches a class constructed
    without setting its canonical_concept

64/64 ogar-vocab tests pass.

Unblocks

  • W0.2 rm-store substrate (Redmine Integration Plan)
  • Any future consumer that needs to walk all 32 codebook concepts

🤖 Generated with Claude Code

… 32 promoted concepts

Adds `pub fn all_promoted_classes() -> Vec<Class>` to ogar-vocab.
Returns every promoted class fn's output (`project()`,
`project_work_item()`, …, `currency_policy()`) in `class_ids::ALL`
order.

# Why

Drives the W0.2 prerequisite called out in the Redmine Integration
Plan (REDMINE-INTEGRATION-PLAN.md, post-#89 fixup). Before this,
the 32 promoted constructor fns existed but weren't enumerable as
a slice — a consumer wanting to drive all of them at once
(e.g. `ogar_adapter_surrealql::emit_surrealql_ddl(&[Class])` for
a whole-schema DDL emit) had to hand-list 32 calls, drift-prone.

```rust
use ogar_vocab::all_promoted_classes;
use ogar_adapter_surrealql::emit_surrealql_ddl;

let ddl = emit_surrealql_ddl(&all_promoted_classes());
// → SurrealQL DDL for the full 32-concept schema, in codebook
//   (class_ids::ALL) order.
```

# Tests (4)

- `all_promoted_classes_matches_class_ids_all_in_length` — count gate
- `all_promoted_classes_matches_class_ids_all_order` — position-by-position
  pin: each entry's canonical_concept + canonical_id match the same
  position in class_ids::ALL
- `all_promoted_classes_has_no_duplicates` — defensive against
  copy-paste typos in the enumerator
- `all_promoted_classes_every_class_has_canonical_id` — every entry
  must round-trip through canonical_id()

A new codebook promotion that adds to `class_ids::ALL` but forgets a
constructor call here fails the length/order tests immediately.

# Coverage

64/64 ogar-vocab unit tests pass.
@AdaWorldAPI AdaWorldAPI merged commit eb0a59a into main Jun 21, 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.

1 participant