Repository navigation
Plan the remote lock and stage its update in one place each - #5591
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Centralize remote lock planning src/datamodel_code_generator/_lock_plan.py, src/datamodel_code_generator/__main__.py, src/datamodel_code_generator/__init__.py, src/datamodel_code_generator/_api_generation.py, scripts/decision_homes.toml, docs/architecture.md |
The new planning module defines path-spelling rules and lock policies. CLI and API generation paths use its helpers to select lock paths and determine update ownership. The decision records and architecture table document the planning rules. |
Share lock staging and publication src/datamodel_code_generator/remote_lock.py, src/datamodel_code_generator/__main__.py, src/datamodel_code_generator/__init__.py, src/datamodel_code_generator/_api_generation.py, scripts/decision_homes.toml, docs/architecture.md |
Shared helpers acquire the publication anchor, reserve private staging, and prepare staged lock files. Generation and commit paths use the helpers; the decision records and architecture table document lock staging. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Possibly related issues
- Issue 5584: The PR centralizes lock path planning across CLI and API paths, which relates to the reported differences in how lockfile spellings resolve.
- Issue 5585: The PR uses a shared lock parent and planning path, which relates to the reported difference in lockfile location between CLI and
generate(). - Issue 5583: The PR changes lock planning and staging for API updates without an output file, matching the reported symlinked-lockfile scenario.
Merge Risk: 
Minimal · up to 7bf66
-
The change centralizes remote-lock planning and staging. No concrete merge-blocking regression is established; merge after normal checks pass.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 14 functions across 5 files. (2 skipped: 2 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
Codex Review SummaryThis 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. |
Merging this PR will degrade performance by 31.8%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Breaking Change AnalysisResult: No breaking changes detected Reasoning: This PR is an internal refactor. It moves the remote lock path and policy logic into a new private module, _lock_plan.py, with remote_lock_plan, owns_lock_update and models_lockfile. It also adds private helpers _open_lock_staging and _staged_lock in remote_lock.py for lock staging, and adds the matching docs and decision-home table rows. I checked each old path against its replacement. The command-line lexical spelling still applies abspath and then resolve. The atomic generate() update still joins a relative lockfile to the caller directory and resolves it. The other generate() runs still use an absolute lockfile as written, and that is kept on purpose under the new legacy-api-lockfile-as-written row. The policy is still update, then locked, then verify if the file exists, then inactive. The target lockfile handoff and RemoteReferenceLock.commit produce the same paths and staged files as before. The only removed items are private: the _RemoteLockPlan NamedTuple in main, which is now imported from _lock_plan, and some inline staging code. No CLI option, public API, template, default value or Python version support changes. The one small runtime difference is that the publication anchor is now released if lock staging cannot be created. That is a cleanup fix, not a change in how errors are reported. The behaviour diff gate does list accepted cells, but all of them are about allOf scalar and array root handling, and their notes credit a separate earlier change. This diff touches no parser or model code, so those output changes do not come from this PR. This analysis was produced by the release draft workflow |
|
🎉 Released in 0.88.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit
Bug Fixes
Documentation