Skip to content

ogar-from-rails: DO arm mirrors controllers verbatim + re-export (delete singulariser)#153

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/osm-render-ergonomics
Jul 4, 2026
Merged

ogar-from-rails: DO arm mirrors controllers verbatim + re-export (delete singulariser)#153
AdaWorldAPI merged 1 commit into
mainfrom
claude/osm-render-ergonomics

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jul 4, 2026

Copy link
Copy Markdown
Owner

What

Delete the singulariser. It invented a namespace out of string-munged
controller names — arbitrary, lossy (English plurals aren't invertible by
heuristic: Searches → searche, Capabilities → capabilitie), and
irreversible. The controller's own name is the faithful identity; the
semantics already live in the classid, not in a prettified string.

The DO arm is now a faithful controllers mirror

Mirrors app/controllers/ 1:1, then re-exports for ergonomics:

  • container_of snake-cases the controller stem verbatim — no
    singularisation:

    controller module
    Api::NodesController nodes
    MapsController maps
    SearchesController searches
    ChangesetCommentsController changeset_comments

    Reversible, and it matches Rails' own resource routes (/nodes).

  • render_osm emits generated/controllers.rs (was actions.rs); the
    osm-domain crate does #[path=…] pub mod controllers; + pub use controllers::*;, so both paths resolve:

    osm_domain::controllers::nodes::show(input)  // faithful
    osm_domain::nodes::show(input)               // re-exported surface

Unchanged

The (part_of : is_a) rail and the is_a archetype axis (index → list, …)
are untouched — only the invented singular container naming is gone. The
collapse of api-vs-web controllers onto one canonical tile (with all sources
cited) stays.

Verified

  • container_of verbatim test replaces the deleted singulariser test.
  • Parked snapshot regenerated (controllers.rs, osm_actions.rail);
    osm-domain builds; module names are now nodes / capabilities /
    changeset_comments (no searche / capabilitie).

Supersedes the earlier "add an inflector" version of this PR — pulling the
splinter out instead of sanding it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP

@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: 55741704bb

ℹ️ 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-rails/src/lib.rs Outdated
Comment on lines +170 to +176
if let Some(base) = stem.strip_suffix("ies") {
if base
.chars()
.last()
.is_some_and(|c| !"aeiouAEIOU".contains(c))
{
return format!("{base}y");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve -ie singulars when stripping plural s

For controllers whose singular model already ends in ie, Rails pluralizes by just adding s (for example MovieMoviesController or CookieCookiesController). This branch treats any consonant before ies as a consonant-y plural, so controller_to_model("MoviesController") now returns Movy and container_of returns movy; before this change, the old trailing-s strip returned Movie correctly, so actions for these common model names no longer attach to the real model/generated module.

Useful? React with 👍 / 👎.

…singulariser)

Delete the singulariser entirely. It was inventing a namespace out of
string-munged controller names — arbitrary, lossy (English plurals aren't
invertible by heuristic: `Searches → searche`, `Capabilities → capabilitie`),
and irreversible. The controller's own name IS the faithful identity; the
semantics live in the classid, not in a prettified string.

The DO arm is now a faithful `controllers` module that mirrors
`app/controllers/` 1:1:
- `container_of` snake-cases the controller stem **verbatim**, no
  singularisation: `NodesController → nodes`, `MapsController → maps`,
  `SearchesController → searches`, `ChangesetCommentsController →
  changeset_comments`. Reversible; matches Rails' own resource routes.
- `controller_to_model` likewise stops singularising (returns `Nodes`).
- render_osm emits `generated/controllers.rs` (was `actions.rs`); osm-domain
  does `#[path=…] pub mod controllers;` + `pub use controllers::*;`, so both
  `osm_domain::controllers::nodes::show(input)` and the re-exported
  `osm_domain::nodes::show(input)` resolve.

The (part_of:is_a) rail + the `is_a` archetype axis (index→list, …) are
unchanged — only the invented singular container naming is gone. Regenerated
the parked snapshot; osm-domain builds; `container_of` verbatim test replaces
the deleted singulariser test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP
@AdaWorldAPI AdaWorldAPI force-pushed the claude/osm-render-ergonomics branch from 5574170 to 5997b04 Compare July 4, 2026 23:32
@AdaWorldAPI AdaWorldAPI changed the title ogar-from-rails: real inflector for controller singularisation (ergonomics) ogar-from-rails: DO arm mirrors controllers verbatim + re-export (delete singulariser) Jul 4, 2026
AdaWorldAPI pushed a commit that referenced this pull request Jul 4, 2026
… + package)

The Python counterpart of render_osm: same ruff → OGAR substrate, a
language-pluggable emit back-end. Proves the pull-back side of the transpiler
is not Rust-specific — OSM (and odoo) come out of the one substrate in Python
import shape, just like Rust.

Emits under python/:
- osm/models.py           — one @DataClass per THINK class; associations →
                            typed id fields; each grounded model has CLASS_ID.
- osm/controllers/<name>.py — the DO arm as a FAITHFUL mirror of app/controllers/,
                            one module per source controller by its verbatim
                            (snake) name — `osm.controllers.nodes.show(inp)`,
                            standalone, not methods. No singularisation (mirrors
                            the Rust `controllers` module).
- osm/__init__.py         — re-exports each controller at the package root
                            (`osm.nodes` ≡ `osm.controllers.nodes`) + CLASS_IDS.
- ogar_sdk.py             — the substrate-pull SDK (Python mirror of Rust
                            lance_graph_contract::ogar_codebook): CODEBOOK +
                            class_id(concept) + render_classid(concept, prefix)
                            (canon-high). Ships OSM (0x0F) AND odoo/commerce
                            (0x02) — the pull is domain-agnostic.

Verified: example builds clean; py_compile green on package + SDK; functional
smoke — osm.controllers.nodes.show + re-exported osm.nodes.show both callable,
class_id('osm_node')=0xf01, render_classid('account_move',0x0002)=0x2020002,
osm.nodes.show({}) raises NotImplementedError('port Api::NodesController#show').

Stacks on #153 (the faithful-controllers / no-singulariser change) so the
container module names are verbatim (nodes/searches/capabilities, not
searche/capabilitie). Typed params (dict Input → typed) remain the ruff brick.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP
@AdaWorldAPI AdaWorldAPI merged commit 05d8286 into main Jul 4, 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