fix(settings): route flext-cli Field through m facade - #62
Conversation
Drop the direct pydantic Field import from layer-0 settings and absorb the Makefile custom-WHAT projection. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughThe Makefile now supports project-defined custom handlers, uses ancestry-based submodule setup checks, and documents both behaviors. CLI settings now use ChangesCustom handler dispatch
Submodule setup validation
CLI settings metadata
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Makefile`:
- Around line 655-659: Guard both attach_branch_at_head call sites in the
detached-HEAD handling flow so an existing declared branch is accepted only when
it already points to the intended commit; if refs/heads/$$branch exists at a
different commit, reject the state and require manual reconciliation before
attaching HEAD. Preserve attachment when the branch is absent or already
matches, and ensure attach_branch_at_head is never allowed to overwrite
divergent local commits.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a2c0d444-efca-4b35-9659-81f26f535d86
📒 Files selected for processing (2)
Makefilesrc/flext_cli/_settings.py
| if git -C "$$child_root" merge-base --is-ancestor "$$gitlink" HEAD; then \ | ||
| attach_branch_at_head "$$child_root" "$$branch"; \ | ||
| elif git -C "$$child_root" rev-parse --verify "$$remote_ref" >/dev/null 2>&1 && \ | ||
| git -C "$$child_root" merge-base --is-ancestor "$$head" "$$remote_ref"; then \ | ||
| attach_branch_at_head "$$child_root" "$$branch"; \ |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Do not force-move an existing declared branch.
attach_branch_at_head runs git branch -f "$$branch" HEAD. If refs/heads/$$branch already points to local commits, either detached-HEAD path can replace that ref with $$head. The prior commits become unreachable and can later be garbage-collected. This conflicts with the stated rule that setup does not discard commits.
Reject this state when the declared local branch exists at a different commit. Require the user to reconcile it before attaching HEAD.
Proposed safeguard
attach_branch_at_head() { \
child_root="$$1"; \
branch="$$2"; \
+ head=$$(git -C "$$child_root" rev-parse HEAD); \
+ existing=$$(git -C "$$child_root" rev-parse --verify "refs/heads/$$branch" 2>/dev/null || :); \
+ if [ -n "$$existing" ] && [ "$$existing" != "$$head" ]; then \
+ printf 'ERROR: %s: local branch %s points to %s, not detached HEAD %s; reconcile it yourself\n' "$$child_root" "$$branch" "$$existing" "$$head" >&2; \
+ exit 1; \
+ fi; \
git -C "$$child_root" branch --quiet -f "$$branch" HEAD || { \🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Makefile` around lines 655 - 659, Guard both attach_branch_at_head call sites
in the detached-HEAD handling flow so an existing declared branch is accepted
only when it already points to the intended commit; if refs/heads/$$branch
exists at a different commit, reject the state and require manual reconciliation
before attaching HEAD. Preserve attachment when the branch is absent or already
matches, and ensure attach_branch_at_head is never allowed to overwrite
divergent local commits.
Summary
pydantic.Fieldin_settings.pywithflext_core.m.Field.Test plan
make check PROJECT=flext-cli CHECK_GATES=lint,format,pyreflyMade with Cursor
Summary by cubic
Routed
flext-clisettings Field declarations throughflext_core.m.Fieldto unify settings metadata and avoid directpydanticusage. Also extended theMakefiledispatcher to support_custom_<verb>_<what>targets and tightened submodule setup behavior.Refactors
pydantic.Fieldwithflext_core.m.FieldinFlextCliSettings.New Features
Makefile: Support_custom_<verb>_<what>and list them in help; submodule setup now skips unnecessary fetches, attaches the branch when appropriate, and shows clearer errors without discarding commits.Written for commit be013e0. Summary will update on new commits.