Skip to content

Return std::optional from Utility::stringToEnum - #1249

Merged
TheOneRing merged 1 commit into
mainfrom
work/oauth2
Nov 16, 2026
Merged

TheOneRing merged 1 commit into
mainfrom
work/oauth2

Conversation

@TheOneRing

@TheOneRing TheOneRing commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This fixes a bug where the supported OAuth prompts where incorrectly computed.
It also fixes the assert in SyncFileItemStatusSetSortFilterProxyModel when the filter items changed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A reconnect notification can cancel the retry timer before the failed OAuth job is deleted, preventing a replacement refresh and leaving authentication and queued sync work blocked indefinitely.

No open issues 🎉

What changed in this PR

This PR makes enum conversion failures explicit with std::optional, updating OAuth prompt handling and saved issue filters. It also expands OAuth refresh recovery to preserve credentials during persistent service failures.

Changes:

  • Update enum conversion and its callers to handle unknown values.
  • Add refresh backoff and reconnect retries, preserve client identity, and improve credential-error handling.
  • Expand refresh regression tests and remove an obsolete registration fixture.
File Description
test/​testoauth/​testoauth.cpp Add reusable refresh fixtures and tests for failure recovery and reconnects.
test/​testoauth/​testDynamicTokenRefresh/​clientRegistrationReply.json Remove the obsolete refresh-registration response fixture.
src/​libsync/​creds/​oauth.cpp Handle optional prompt values and refine refresh registration, errors, and token validation.
src/​libsync/​creds/​httpcredentials.h Declare retry timer state and network-change handlers.
src/​libsync/​creds/​httpcredentials.cpp Add ongoing backoff retries and immediate retries on reconnect.
src/​libsync/​creds/​credentialmanager.cpp Correct completion handling during backend retries and parsing failures.
src/​libsync/​common/​utility.h Return an optional enum value from string conversion.
src/​gui/​issueswidget.cpp Reset saved filters when enum conversion fails.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new optional-return contract for stringToEnum() lacks regression coverage for valid zero-valued enums and unknown or empty names across QString and string-literal inputs.

1 open issue

Review effort: Balanced

Comment thread src/libsync/common/utility.h Resolved
Comment thread src/libsync/common/utility.h Resolved
Base automatically changed from work/oauth to main November 16, 2026 10:57
@TheOneRing
TheOneRing enabled stacked auto-merge (rebase) November 16, 2026 11:00
@TheOneRing
TheOneRing merged commit b4b234a into main Nov 16, 2026
13 of 14 checks passed
@TheOneRing
TheOneRing deleted the work/oauth2 branch November 16, 2026 11:30
@openclouders openclouders mentioned this pull request Nov 16, 2026
1 task
@saw-jan saw-jan mentioned this pull request Nov 25, 2026
9 of 22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants