Batch-1 hardening: emit_python Optional+ogar_runtime, FK-dedup consolidation, WoA harvest v2 (151 models, import-gate closed)#165
Merged
Conversation
…tal_schema_fields SPEC-B1-2: kill the sqlalchemy.rs lockstep copy of project_rails_fields / is_fk_shadowed_by_association. Rename project_rails_fields to pub(crate) project_total_schema_fields (body unchanged), make is_fk_shadowed_by_association pub(crate), and route both the Rails (Ruby) and SQLAlchemy (Python) producers through the single lib.rs implementation. sqlalchemy.rs's project_sqlalchemy_fields collapses to a thin delegating wrapper; its own is_fk_shadowed_by_association copy is deleted. Adds both_producers_share_explicit_foreign_key_dedup, lifting one Model through both the Ruby and SQLAlchemy entry points and asserting identical FK-dedup outcomes (PR #156 finding (b): explicit foreign_key, not just the <name>_id convention) and identical attribute name sets, proving the shared semantics. classify_woa_domain (a separate lockstep copy of classify_domain) is left untouched per spec — out of scope for this item. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…_module crutch SPEC-B1-1 (Batch-1 Item 1). emit_python now mirrors emit_rust's Option<...> rule exactly: an attribute with `required == Some(false)` wraps in `Optional[...]`; `Some(true)`/`None` (the Odoo path, which never sets `required`) stay bare, so Odoo emit output is bit-for-bit stable. New `emit_python_prelude()` emits the module-level wrapper-contract import block once per module (`from ogar_runtime import (...)`), design option (a) from three considered: inlining aliases per class (b) re-mints a parallel schema truth per file, and a `try/except import *` shim (c) masks import errors — both rejected per "pull, never re-mint". A shipped reference `crates/ogar-from-ruff/python/ogar_runtime.py` supplies the wrapper types so the emitted module py_compiles and imports standalone without any consumer setup. woa_parity_probe.rs: deleted the `wrap_module` hand-rolled import-and-alias crutch; `woa_dataclass_py_compiles_and_instantiates` now composes `emit_python_prelude()` + `emit_python()` and copies the shipped `ogar_runtime.py` next to the emitted module. `instantiate_check.py` adds the emitted module's dir to `sys.path` and registers the module in `sys.modules` before `exec_module` — required because the prelude's `from __future__ import annotations` (PEP 563) makes `dataclasses` resolve ClassVar/InitVar via `sys.modules[cls.__module__]`, which is `None` for a `spec_from_file_location`-loaded module unless registered first (a real mechanical necessity for the mandated prelude content, not a design change). DRIFT list entry flips from "Lücke" to GESCHLOSSEN; `created_at` now emits `Optional[OgDateTime]`. The classid alias line (WOA_ALIASES convergence pin) remains the sole open drift on this fixture. Added `emit_python_wraps_nullable_in_optional_bare_otherwise` (Rails Some(true)/Some(false) + Odoo None, all three required-states) and `emit_python_prelude_imports_from_ogar_runtime`. cargo test -p ogar-from-ruff: 66 + 3 tests green (probe metric + py_compile + instantiate gate). cargo test --workspace: no regressions (all suites green). cargo clippy -p ogar-from-ruff --all-targets --all-features -D warnings: clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nsolidated Two append-only Nachträge on D-PARITY-PROBE-WOA-1: - Item 1: emit_python now wraps required==Some(false) in Optional[…] (mirror emit_rust), prelude imports from ogar_runtime, wrap_module crutch deleted; emitted @DataClass py_compiles + imports standalone. - Item 2: sqlalchemy.rs FK-dedup lockstep copy consolidated onto shared pub(crate) project_total_schema_fields / is_fk_shadowed_by_association. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dels) Regenerate the WoA sink-in substrate harvest against the CURRENT ogar-from-ruff (post Batch-1 Item 1 emit_python prelude+Optional[], Item 2 FK-dedup consolidation): the scratch driver at /tmp/harvest-woa now extracts both models.py (139) and woa/models_shop.py (12) via ruff_sqlalchemy_spo::extract_file, merges via ModelGraph.models.extend() (same "woa" namespace) before minting, and regenerates all four artifacts. Metrics (driver stderr, not hand-estimated): 151 classes, 2154 attributes, 112 associations, 6 aliased / 145 bootstrap, 0/112 dangling .spo edges. v1 gap #2 (models_shop.py out of scope) and gap #3 (emit_python's import list incomplete -> NameError on import) are both RESOLVED: the emitted models.py now carries emit_python_prelude()'s imports, ogar_runtime.py (Item 1's reference wrapper-contract) ships alongside it in this directory, and `python3 -c "import models"` passes (not just py_compile) -- verified directly in this harvest dir, not only in the /tmp scratch driver's out/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-integration Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d7d009a0-6a75-456f-9973-14d780843d56) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Batch-1 hardening — closes three named follow-ups from #158's honesty drift-list, spec'd (Opus) → ground (Sonnet ×3) → reviewed + integration-probed (Opus), rebased onto #164.
Item 1 —
emit_python: Optional[] + real imports (drift entry → CLOSED)required == Some(false)→Optional[…]— exact mirror ofemit_rust's rule; all threerequiredstates tested (RailsSome(true)/Some(false), OdooNone).emit_python_prelude(): emitted modules import fromogar_runtime(design decision: symmetric to the Rust side — the consumer pulls the wrapper contract, never re-mints inline; referencecrates/ogar-from-ruff/python/ogar_runtime.pyships alongside). Completeness-checked: every nameog_scalar_typecan emit resolves — no NameError possible.wrap_modulecrutch is deleted; DRIFT print now honestly readsemit_python Optional[]-Nullability: GESCHLOSSEN, leaving the classid alias as the sole remaining drift.Item 2 — FK-dedup consolidation (kills the lockstep copy)
project_rails_fields→ sharedpub(crate) project_total_schema_fields; the SQLAlchemy copy collapses to a thin wrapper,is_fk_shadowed_by_associationsingle-sourced (explicitforeign_key:first). New cross-producer test pins identical dedup semantics on both paths (identical attribute sets, BTreeSet equality). Review bonus: consolidation silently fixed a dormantmany2many→BelongsTo mismap in the old copy.Item 3 — WoA harvest v2 (
.claude/harvest/woa-rs/)models.py+woa/models_shop.py→ 151 models, 2154 attrs, 112 assocs (0 dangling), 6 aliased / 145 bootstrap. Emitted with the new prelude: HARVEST gap #3 (import-gate) closed for real —python3 -c "import models"→IMPORT_OK 176,ogar_runtime.pyshipped alongside. Gap #2 (models_shop) closed. WoA-side release copy already pushed (claude/woa-repo-backup-update-qb1enp@4061c68).Ledger
Two append-only
docs/DISCOVERY-MAP.mdentries (Item 1 + Item 2), added post-review-sign-off per house rule; HARVEST.md v2 carries the metric table v1→v2.Verified (post-#164 merge)
cargo test --workspace→ 42 suites, 0 failed (incl. 71 ogar-from-ruff tests with the new Optional/prelude/cross-producer pins and #164'sCompiledClass.actionscoexisting).cargo clippy -p ogar-from-ruff --all-targets --all-features -- -D warningsclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Cg8DSUz1U4AvKqXiy9Xx2f