Skip to content

feat: ogar-from-elixir scaffold — wide / OGAR arm for HIRO/Bardioc Elixir#17

Merged
AdaWorldAPI merged 4 commits into
mainfrom
claude/ogar-from-elixir-scaffold
Jun 4, 2026
Merged

feat: ogar-from-elixir scaffold — wide / OGAR arm for HIRO/Bardioc Elixir#17
AdaWorldAPI merged 4 commits into
mainfrom
claude/ogar-from-elixir-scaffold

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

ogar-from-elixir scaffold — wide / OGAR arm for the OLD HIRO/Bardioc stack

Queue item #2. Scaffold (per the ruff_ruby_spo pattern adopted in #16) for the wide / OGAR Elixir frontend that fills ogar-vocab::Class + ActionDef per the prefetch ledger in ELIXIR-HIRO-PREFETCH.md §2.

What lands

  • New crate crates/ogar-from-elixir, added to workspace members.
  • Cargo.toml: depends on ogar-vocab only (zero parser deps until tree-sitter wires in).
  • src/lib.rs (~330 lines):
    • pub fn extract(path) -> Vec<Class> — structural arm (Ecto.Schema)
    • pub fn extract_action_defs(path) -> Vec<ActionDef> — behavior arm (GenServer / gen_statem / Phoenix / Oban)
    • Per-construct extractors as todo!() stubs, each doc-commented with the exact Elixir construct to parse + the §2.1/§2.2 prefetch-ledger row it implements
    • Dispatcher branches by use/@behaviour directive (Ecto.Schema, GenServer, Phoenix.Controller, Phoenix.Channel, Phoenix.LiveView, Oban.Worker, :gen_statem, GenStateMachine)
    • 5 locked-shape tests assert the target OGAR shape for hand-built fixtures:
      1. ecto_schema_class_shape_is_lockedAccount (email + belongs_to owner)
      2. gen_statem_action_def_shape_is_locked — Raft follower vote_request carrying all four §6 Rubicon terms (StateGuard, state_timeout_millis=150, guard_failure_policy=Postponable, on_enter=EnterEffect::transition("state","candidate"))
      3. phoenix_controller_action_def_shape_is_lockedcreate (User subject, Sync modal, no kausal)
      4. oban_worker_action_def_shape_is_lockedperform (System subject, Deferred temporal)
      5. dispatch_keys_are_the_expected_use_directives — pins the recognized dispatch keys

The locked-shape tests are the contract: when extraction is wired, the produced Class/ActionDef must match.

Why this is the wide arm (not the narrow SPO arm)

Per #16 §10.1, the narrow SPO arm for Elixir is a future ruff_elixir_spo (mirroring ruff_ruby_spo's ndjson-emitting pattern via ruff_spo_triplet). This crate is the complement: produces OGAR's wide lifecycle IR for lance-graph-ontology consumption. Both arms will feed off the same parsed Elixir AST when wired — one parser, two emitters.

Why gen_statem is the load-bearing case

rafted_value's Raft consensus runs on gen_statem, and the four §6 Rubicon statem terms (onEnter/guardFailurePolicy/StateTimeout/postpone) map 1:1 from gen_statem returns (state_enter, [:postpone], [{:state_timeout, ms, _}], {:next_state, T, _}). The locked-shape test for vote_request covers all four, so when extraction is wired, the Rubicon binding is the immediate consumer.

What's NOT in this PR (intentional)

  • No tree-sitter dep yet. Scaffold compiles with zero parser deps so the target shape can be locked first (same pattern ruff_ruby_spo uses).
  • No real Elixir source parsing (parse_modules is todo!()).
  • No ogar-emitter / ogar-proposal integration — those consume ogar-vocab types directly, so they Just Work once extraction wires in.

Verification

cargo build --workspace should succeed; cargo test -p ogar-from-elixir should pass the 5 locked-shape tests. The todo!() stubs panic at runtime — production code paths (extract, extract_action_defs) intentionally not exercised by tests.

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc92d10d2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/ogar-from-elixir/Cargo.toml Outdated
# the target OGAR shape can be locked first.

[lints]
workspace = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove undeclared workspace lints inheritance

Because this new crate is added as a workspace member, Cargo loads its manifest for any workspace command; however, workspace = true here requires the root manifest to define [workspace.lints], which this repo does not. In the inspected workspace, cargo test -p ogar-from-elixir fails during manifest parsing with error inheriting lints from workspace root manifest's workspace.lints, so the entire workspace is currently unbuildable until this section is removed or the root workspace lints are added.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the latest push. The [lints] workspace = true block was imported from ruff_ruby_spo's Cargo.toml without verifying OGAR's root defines [workspace.lints] (it doesn't — confirmed: no existing OGAR crate uses [lints] for exactly this reason). Removed from crates/ogar-from-elixir/Cargo.toml. Same fix piggybacked into #18's crates/ogar-adapter-surrealql/Cargo.toml since I'd copied the same broken pattern there before this review landed. cargo build --workspace should parse cleanly now.

…rkspace.lints])

Imported from ruff_ruby_spo's pattern; OGAR's root Cargo.toml doesn't declare
[workspace.lints], so cargo fails manifest parsing with 'inheriting lints
from workspace root manifest's workspace.lints'. Existing OGAR crates don't
use [lints] for the same reason. Codex P1 on #17; same bug landed in #18.

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
AdaWorldAPI added a commit that referenced this pull request Jun 4, 2026
…no [workspace.lints])

Imported from ruff_ruby_spo's pattern; OGAR's root Cargo.toml doesn't declare
[workspace.lints], so cargo fails manifest parsing with 'inheriting lints
from workspace root manifest's workspace.lints'. Existing OGAR crates don't
use [lints] for the same reason. Codex P1 on #17; same bug landed in #18.

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
@AdaWorldAPI AdaWorldAPI merged commit 5a564f6 into main Jun 4, 2026
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