Set client version to lowest for compat if server version can't be recognized #612
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#612
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "jolheiser/go-sdk:low-version"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a possible resolution for gitea/tea#531
@ -100,0 +101,4 @@
if strings.TrimSpace(raw) != "" {
// Version was something, just not recognized
// Default to lowest version for safety
c.serverVersion = version1_11_0
IMO, this should not happen silently. If users are not aware that the server version wasn't recognised, and that a limited feature set is available, they could get properly confused. And it'll be hard to actually find that this is the root cause.
Good point, I can add some output to let the user know.
I would let the programms using the sdk handle this ... they can decide what to do with that error
we should just declair an err that
errors.Is
could check and if the program want to have some "just use it with this or that version" ... like you propose, there is a clientOption already for it ...@6543
In relation to
tea
then, do you think we should add a flag (or similar) to "set/force" a version?Using the raw SDK, people can set it, but afaik
tea
doesn't have a way for users to set it should an error occur.Apologies, this is slightly off-topic for this PR, but I want to make sure we put the fix(es) in the right place.
What if we (as @jolheiser said) have a "set/force" version, but as for this fallback we return an err that says "hey we weren't able to determine a version so we set it as 1.xyz" so a user can parse the error, and see oh its error x and I can handle that/report it to user, but it won't prevent the program from calling additional calls.
as per comment
@6543 I've updated to return a special error that can be checked via
errors.As
which holds the raw version given back from the server, but also returns the client set to1.11.0
. The user can then decide how best to move forward.Regarding
tea
, we can either add a--force-version
(or something shorter) flag to force a version, or we can just check for this new error and print it out to the user, but allow them to continue using it in the meantime.But perhaps that's better discussed in an issue on the
tea
repo.@jolheiser can not update base-branch :D might enable maintainer edit
Updated and enabled in case it's needed.