Repository navigation
ogar-from-ruff: keep invalid and unresolved Rails enums visible (O1b-a) - #374
Merged
Merged
Conversation
A duplicate Rails enum key made lift_enum return None, and lift_model's filter_map dropped the whole declaration without a trace. An enum whose variant list the Ruby walker could not see lifted to Static(vec![]), which reads as a known enum with no values. Rails labels were the key copied into the label slot, which the emitter then published as ogar:variantValue. EnumSource gains three additive variants: Unlabeled(keys) for fixed keys with no source label, Unresolved(reason) for an enum whose variant list was not recovered, and Invalid(reason) for a declaration that cannot be represented faithfully. lift_enum maps unique keys to Unlabeled, a duplicate key to Invalid (the declaration stays on the class), and empty options to Unresolved. It returns None only for non-enum attributes. Rails integers stay out of OGAR. The emitter writes variant names without variantValue for Unlabeled, and a reason with no variants for Unresolved and Invalid. The SurrealQL adapter asserts the key set for Unlabeled and emits a plain string field for Unresolved and Invalid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMMWgnUU9g7Ldyn6sbk
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
AdaWorldAPI
marked this pull request as ready for review
November 7, 2026 23:44
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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 was wrong
After #373, the Rails enum lift still had three problems.
lift_enumreturnedNone, andlift_model'sfilter_mapdiscarded the declaration without a trace.Static(vec[]). That reads as a known enum with no values.ogar-emitterpublished that slot asogar:variantValue, which asserts a value the source never declared.The change
EnumSourcegains three additive variants. The enum is already#[non_exhaustive], so this does not break other crates.Unlabeled(keys)Unresolved(reason)Invalid(reason)lift_enumnow returnsNoneonly for an attribute that is not an enum. Otherwise:UnlabeledInvalid("duplicate enum keyk")UnresolvedRails integers are still never stored in OGAR.
Downstream outputs:
Unlabeled: oneogar:variantNameper key and noogar:variantValue.UnresolvedandInvalid: a reason triple and no variants.Unlabeled: asserts the key set.UnresolvedandInvalid: a plain string field with a comment, and no value assertion.ogar-from-schemastill producesStaticand is not changed here.Validation
cargo test -p ogar-vocab -p ogar-from-ruff -p ogar-emitter -p ogar-adapter-surrealql: all pass.cargo clippy --workspace --all-targets -- -D warnings: clean.Each guard was disabled on top of the committed change; every disable turned at least one test red:
Nonelift_enum_duplicate_key_is_kept_as_invalidStatic(vec[])lift_enum_without_visible_variants_is_unresolved_not_staticlift_enum_unlabeled_carries_keys_and_no_rails_integerUnlabeledemitsvariantValueunlabeled_enum_emits_names_and_no_variant_valueFollow-up
O1b-b will read ruff's typed enum forms (the array form, an unresolved constant, the legacy kwarg form) once that ruff change lands on ruff
main.Generated by Claude Code