fix: create the Gitee release for a new version instead of crashing - #250
Open
yujiezhang-ops wants to merge 1 commit into
Open
yujiezhang-ops wants to merge 1 commit into
yujiezhang-ops wants to merge 1 commit into
Conversation
Gitee answers GET releases/tags/<tag> for a tag with no release as HTTP 200 and a literal `null`, not 404, so the first sync of v0.8.6 hit the non-object branch. That branch then crashed on request.method, which urllib's Request only sets when a method is passed explicitly. Earlier successful runs only ever re-synced an existing release. Treat `null` as "no release yet" and report the method via get_method(). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
The Gitee sync for v0.8.6 failed (run 36236699168) with
AttributeError: 'Request' object has no attribute 'method'. Two bugs stacked:null, not 404, for a tag without a release.GET /api/v5/repos/maimory/BootAgent/releases/tags/v0.8.6answers HTTP 200 with bodynull(checked directly;v9.9.9does the same).gitee_releaseonly treated 404 as "no release yet", so the first sync of any new version fell into the non-object error path. Earlier successful runs only re-synced the already-existing v0.8.5.urllib.request.Requestonly sets.methodwhen one is passed explicitly, so building the message raisedAttributeError. All three messages now useget_method().request_jsonis split sogitee_releasecan read anullbody (read_json) while other callers still require an object.Gitee already mirrors
mainat8890920and tagv0.8.6, so creating the release againsttarget_commitish: mainis safe.Test plan
null→ missing, 404 → missing, existing release returned, non-object response raisesRuntimeErrornamingGET <url>instead ofAttributeErrorpython -m unittest scripts.test_sync_gitee_ota_release scripts.test_retain_gitee_release_line: 12 passedgitee_release(..., "v0.8.6")→None,v0.8.5→ release 1132764 with its OTA assetsversion=v0.8.6🤖 Generated with Claude Code