Skip to content

fix(frontend): stop forum login from looping when Flarum auth fails#5311

Merged
aglinxinyuan merged 8 commits into
apache:mainfrom
Ma77Ball:fix/forumsPage
Jun 3, 2026
Merged

fix(frontend): stop forum login from looping when Flarum auth fails#5311
aglinxinyuan merged 8 commits into
apache:mainfrom
Ma77Ball:fix/forumsPage

Conversation

@Ma77Ball
Copy link
Copy Markdown
Contributor

@Ma77Ball Ma77Ball commented Jun 1, 2026

What changes were proposed in this PR?

  • Add an attemptRegister flag to DashboardComponent.forumLogin so a Flarum registration is attempted at most once, breaking the infinite auth -> register -> auth cycle that occurred when auth() kept failing with a non-404/500 status.
  • After registering, the recursive call now passes forumLogin(false); if auth still fails on that pass it falls through to displayForum = false instead of looping.
  • Add an error handler to the register() subscription so a failed registration hides the forum rather than being silently dropped.

Any related issues, documentation, or discussions?

Closes: #5310

How was this PR tested?

  • Ran yarn format:fix (clean, no files changed).
  • Manually traced the control flow: auth fail (non-404/500) now does auth, register, auth, then stop, instead of recursing without bound.

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.8 in compliance with ASF

@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI labels Jun 1, 2026
@Ma77Ball
Copy link
Copy Markdown
Contributor Author

Ma77Ball commented Jun 1, 2026

/request-review @Yicong-Huang

@github-actions github-actions Bot requested a review from Yicong-Huang June 1, 2026 20:57
@Yicong-Huang
Copy link
Copy Markdown
Contributor

@aglinxinyuan could you PTAL?

Copy link
Copy Markdown
Contributor

@aglinxinyuan aglinxinyuan left a comment

Choose a reason for hiding this comment

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

LGTM!

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.09%. Comparing base (6d604f3) to head (f1c0321).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5311      +/-   ##
============================================
- Coverage     51.15%   51.09%   -0.06%     
+ Complexity     2413     2380      -33     
============================================
  Files          1054     1053       -1     
  Lines         40923    40514     -409     
  Branches       4381     4317      -64     
============================================
- Hits          20933    20702     -231     
+ Misses        18791    18616     -175     
+ Partials       1199     1196       -3     
Flag Coverage Δ *Carryforward flag
access-control-service 41.89% <ø> (ø) Carriedforward from 5b09ca1
agent-service 33.76% <ø> (ø) Carriedforward from 5b09ca1
amber 51.61% <ø> (-0.01%) ⬇️ Carriedforward from 5b09ca1
computing-unit-managing-service 0.00% <ø> (-1.39%) ⬇️ Carriedforward from 5b09ca1
config-service 0.00% <ø> (-54.69%) ⬇️ Carriedforward from 5b09ca1
file-service 38.42% <ø> (ø) Carriedforward from 5b09ca1
frontend 45.82% <100.00%> (+0.07%) ⬆️
pyamber ?
python 90.83% <ø> (-0.02%) ⬇️ Carriedforward from 5b09ca1
workflow-compiling-service 57.25% <ø> (-1.15%) ⬇️ Carriedforward from 5b09ca1

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang
Copy link
Copy Markdown
Contributor

General comment: can you use a test to guard this behavior?

@aglinxinyuan aglinxinyuan added this pull request to the merge queue Jun 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jun 3, 2026
@aglinxinyuan aglinxinyuan added this pull request to the merge queue Jun 3, 2026
Merged via the queue into apache:main with commit af66499 Jun 3, 2026
16 checks passed
juliethecao pushed a commit to juliethecao/texera that referenced this pull request Jun 4, 2026
…pache#5311)

### What changes were proposed in this PR?
- Add an `attemptRegister` flag to `DashboardComponent.forumLogin` so a
Flarum registration is attempted at most once, breaking the infinite
`auth -> register -> auth` cycle that occurred when `auth()` kept
failing with a non-404/500 status.
- After registering, the recursive call now passes `forumLogin(false)`;
if auth still fails on that pass it falls through to `displayForum =
false` instead of looping.
- Add an error handler to the `register()` subscription so a failed
registration hides the forum rather than being silently dropped.
### Any related issues, documentation, or discussions?
Closes: apache#5310
### How was this PR tested?
- Ran `yarn format:fix` (clean, no files changed).
- Manually traced the control flow: auth fail (non-404/500) now does
auth, register, auth, then stop, instead of recursing without bound.
### Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.8 in compliance with ASF

---------

Signed-off-by: Matthew B. <mgball@uci.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forum (discussion) page loops endlessly when Flarum auth fails

4 participants