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

@Ma77Ball Ma77Ball commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

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

Ma77Ball commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

/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?

@aglinxinyuan aglinxinyuan 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.

LGTM!

@codecov-commenter

codecov-commenter commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.12%. Comparing base (6d604f3) to head (f1c0321).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5311      +/-   ##
============================================
- Coverage     51.15%   51.12%   -0.03%     
+ Complexity     2413     2380      -33     
============================================
  Files          1054     1053       -1     
  Lines         40923    40514     -409     
  Branches       4381     4317      -64     
============================================
- Hits          20933    20712     -221     
+ Misses        18791    18610     -181     
+ Partials       1199     1192       -7     
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.86% <100.00%> (+0.11%) ⬆️
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 Harness.
📢 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>
@xuang7 xuang7 added release/v1.2 back porting to release/v1.2 and removed release/v1.2 back porting to release/v1.2 labels Jun 5, 2026
@xuang7

xuang7 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Hi @Ma77Ball, we'd like to include this fix in the v1.2 release. Since this PR was merged before the release/v1.2 label existed, the auto-backport didn't trigger. Could you open a manual backport PR targeting release/v1.2? Please note in the PR description that it is a backport and link the original PR (#5311). Thank you.

xuang7 pushed a commit that referenced this pull request Jun 11, 2026
…5311) [release/v1.2 backport] (#5615)

### What changes were proposed in this PR?

Backport of #5311 ("fix(frontend): stop forum login from looping when
Flarum auth fails") to `release/v1.2`.

Applies as a clean `git cherry-pick -x` of the merged squash commit
`af664995`, no conflicts and no prerequisite chain. Frontend-only: 2
files changed, 75 insertions, 4 deletions. The introduced diff is
identical to the original PR (only blob-index hashes in the patch header
differ).

For the full change description see #5311. In brief:
`DashboardComponent.forumLogin` recursed `auth -> register -> auth`
without bound when Flarum `auth()` kept failing with a non-404/500
status. This adds an `attemptRegister` flag so registration is attempted
at most once (the post-register call passes `forumLogin(false)`, which
then falls through to `displayForum = false`), and adds an error handler
on the `register()` subscription so a failed registration hides the
forum instead of being silently dropped.

### Any related issues, documentation, discussions?

Closes: #5618 (backport tracking task). Backports #5311 (which closes
#5310 on `main`). Requested by @xuang7 for the v1.2 release; the PR was
merged before the `release/v1.2` label existed, so auto-backport did not
trigger.

### How was this PR tested?

This is a backport with no changes beyond the single cherry-picked
commit, so it relies on the existing tests carried over from #5311
(added cases in `dashboard.component.spec.ts` covering the bounded retry
and the failed-registration path). Run them with `yarn test
--include='**/dashboard.component.spec.ts'` from `frontend/`.

Backport fidelity was verified locally: the diff introduced by the
cherry-pick is byte-identical to the original #5311 diff. The
`dashboard.component.ts` file is not byte-identical to `main@af66499`
only because `release/v1.2` lacks the unrelated footer change
(#5153/#5444) that renamed `gitCommitHash`/`Version.raw` to
`buildNumber`/`Version.buildNumber`; that line is outside the
`forumLogin` fix and is left untouched here.

Full compile and unit-test runs are left to CI.

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

Generated-by: Claude Code (Claude Opus 4.8)

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

5 participants