[FIX] common: keep one broken plugin from taking odev down with it - #184
Open
sea-odoo wants to merge 1 commit into
Open
[FIX] common: keep one broken plugin from taking odev down with it#184sea-odoo wants to merge 1 commit into
sea-odoo wants to merge 1 commit into
Conversation
A plugin whose commands cannot be imported took the whole registration with it: every plugin was loaded inside one try block, so a single unparsable file left odev with none of the plugin commands at all, whichever plugin the developer was actually working in. Worse, the recovery pulled every plugin over that error - development branches included - and a conflicting stash pop then left conflict markers in the working tree, which is how a checkout ends up with the unparsable files that started this. - odev: load each plugin's commands on its own, report the ones that fail by name and carry on with the rest; retry only the plugins that failed, and only when the pull actually brought something back, an import that failed for its own reasons repeating the same error otherwise. - odev: leave a plugin alone unless it is on a branch odev owns - the default branch, `main`, `master` or `beta`. A detached head, a branch with no remote counterpart or a development branch belongs to whoever is working in it, and pulling it would at best fail and at worst rebase work in progress. Pull the ref the remote knows the branch as rather than the local name, and report a pull that fails instead of raising through it. - git: restore the working tree when a stash pop conflicts, rather than leaving the conflict markers in place, and say that the changes are still in the stash - where the conflicts can be resolved by hand. Assisted by Claude Opus 5
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.
Description
A plugin whose commands cannot be imported took the whole registration with it. Every plugin was loaded inside one
tryblock, so a single unparsable file left odev with none of the plugin commands — whichever plugin the developer happened to be working in:The recovery path then made it worse. It pulled every plugin over that one error — development branches included — with
Stasharound the pull, and a conflictinggit stash popleft conflict markers in the working tree while keeping the stash entry. Which is exactly how a checkout ends up with the unparsable python files that started this, on the next run.Odev._register_plugin_commandstakes the plugins to register and returns the ones that failed, each with the error that stopped it, rather than raising on the first. Each plugin is loaded on its own, reported by name, and the rest carry on.Odev._pull_pluginleaves a plugin alone unless it is on a branch odev owns — the default branch,main,masterorbeta. A detached head, a branch with no remote counterpart, or a development branch belongs to whoever is working in it; pulling it would at best fail and at worst rebase work in progress. It pulls the ref the remote knows the branch as rather than the local name, and reports a failed pull instead of raising through it. Resolving the default branch goes through the GitHub API, which the recovery path cannot depend on, so that lookup falls back to the conventional names.Stash.__exit__restores the working tree when the pop conflicts instead of leaving the markers in place, and says the changes are still in the stash — where the conflicts can actually be resolved by hand.Tests
tests/tests/common/test_odev.pygains aplugin_fixturehelper and four cases: a broken plugin not preventing a healthy one from registering its commands, a development branch being skipped rather than pulled, a failing pull being reported rather than raised, and the retry being skipped when nothing was pulled. The two existing registration tests are updated to the new return-based contract. Full suite passes: 361 passed, 3 subtests passed.Linked Issues
Compliance
docsdirectoryrequirements.txtfile, if anyAssisted by Claude Opus 5