ogar-from-rails: DO arm mirrors controllers verbatim + re-export (delete singulariser)#153
Conversation
There was a problem hiding this comment.
💡 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".
| if let Some(base) = stem.strip_suffix("ies") { | ||
| if base | ||
| .chars() | ||
| .last() | ||
| .is_some_and(|c| !"aeiouAEIOU".contains(c)) | ||
| { | ||
| return format!("{base}y"); |
There was a problem hiding this comment.
Preserve -ie singulars when stripping plural s
For controllers whose singular model already ends in ie, Rails pluralizes by just adding s (for example Movie → MoviesController or Cookie → CookiesController). 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
5574170 to
5997b04
Compare
… + 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
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), andirreversible. 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
controllersmirrorMirrors
app/controllers/1:1, then re-exports for ergonomics:container_ofsnake-cases the controller stem verbatim — nosingularisation:
Api::NodesControllernodesMapsControllermapsSearchesControllersearchesChangesetCommentsControllerchangeset_commentsReversible, and it matches Rails' own resource routes (
/nodes).render_osmemitsgenerated/controllers.rs(wasactions.rs); theosm-domaincrate does#[path=…] pub mod controllers;+pub use controllers::*;, so both paths resolve:Unchanged
The
(part_of : is_a)rail and theis_aarchetype 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_ofverbatim test replaces the deleted singulariser test.controllers.rs,osm_actions.rail);osm-domainbuilds; module names are nownodes/capabilities/changeset_comments(nosearche/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