Skip to content

Turn off A2 actor sync in AT22 - #2222

Merged
allinox merged 2 commits into
mainfrom
feat/no-a2-actor-sync-in-at22
May 19, 2026
Merged

Turn off A2 actor sync in AT22#2222
allinox merged 2 commits into
mainfrom
feat/no-a2-actor-sync-in-at22

Conversation

@allinox

@allinox allinox commented May 19, 2026

Copy link
Copy Markdown
Contributor

Description

To test decoupling from A2, we turn off the actor syncing to A2 in AT22 (and dev)

Also: Added optional delay to cookie listener hook to minimize risk of the "reload modal" appearing in the current tab when changing the actor in that same tab.

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Summary by CodeRabbit

  • Configuration Updates

    • Updated feature flag settings across environment-specific configuration files to manage system behavior
  • Improvements

    • Modified reload alert mechanism with new configurable timing parameters that support customizable response delays for improved alert triggering across different scenarios

Review Change Stack

Copilot AI review requested due to automatic review settings May 19, 2026 13:36
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@allinox has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 5 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4243677c-9375-4305-8107-791b5765403f

📥 Commits

Reviewing files that changed from the base of the PR and between 81949f9 and 8757f7a.

📒 Files selected for processing (1)
  • src/resources/Cookie/CookieMethods.ts
📝 Walkthrough

Walkthrough

The PR extends the useCookieListener React hook with a delayResponse parameter to defer cookie-changed signals via setTimeout. The ReloadAlert component is updated to use this new capability with a 2000ms delay. Feature flags controlling RouteChangeReporteeViaAltinn2 are added and toggled across configuration environments.

Changes

Delayed Cookie Listener Response

Layer / File(s) Summary
Cookie listener hook with delayResponse parameter
src/resources/Cookie/CookieMethods.ts
useCookieListener function signature now accepts an optional delayResponse parameter (default 0ms). Cookie-changed signals are scheduled via setTimeout instead of firing immediately, with JSDoc and useEffect dependencies updated.
ReloadAlert integration with delayed listener
src/components/ReloadAlert/ReloadAlert.tsx
ReloadAlert's useCookieListener call now passes 2000 for both interval and delayResponse, configuring a 2-second delay for the reload alert trigger.
Feature flag configuration updates
backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/appsettings.AT22.json, appsettings.Development.json
RouteChangeReporteeViaAltinn2 feature flag is added to AT22 (set to false) and toggled to false in development configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🍪 A cookie listener waits with grace,
Two seconds slow its measured pace,
Through ReloadAlert it gently flows,
While feature flags control the show.
Delayed but sure, the alert takes flight! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: disabling A2 actor sync in AT22 environment, which is supported by the configuration changes in appsettings.AT22.json and the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/no-a2-actor-sync-in-at22

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the kind/feature-request Used when issue is a new feature or request label May 19, 2026

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.

Pull request overview

This PR disables routing “change reportee” via Altinn 2 (A2) in the AT22 and Development environments to support testing decoupling from A2. It also adds an optional delay to the cookie-change listener to reduce the chance of showing the reload modal in the same tab immediately after changing actor.

Changes:

  • Added delayResponse support to the useCookieListener hook and used it for the AltinnPartyId reload alert.
  • Disabled RouteChangeReporteeViaAltinn2 in appsettings.Development.json and appsettings.AT22.json.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/resources/Cookie/CookieMethods.ts Adds delayed cookie-change signaling to useCookieListener.
src/components/ReloadAlert/ReloadAlert.tsx Uses the new useCookieListener delay to defer showing the reload dialog.
backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/appsettings.Development.json Turns off Altinn 2 reportee-routing feature flag in Development.
backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/appsettings.AT22.json Turns off Altinn 2 reportee-routing feature flag in AT22.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/resources/Cookie/CookieMethods.ts
Comment thread src/resources/Cookie/CookieMethods.ts

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/resources/Cookie/CookieMethods.ts`:
- Around line 35-40: The polling effect creates a new delayed timeout each time
the cookie differs but only clears the interval, causing accumulation of pending
timers; fix by storing the timeout id (from setTimeout) in a variable (e.g.,
timeoutId) scoped inside the effect, only scheduling a new setTimeout when
timeoutId is null/undefined, and calling clearTimeout(timeoutId) whenever the
cookie matches again or in the effect cleanup; ensure you still
clearInterval(checkCookie) and also null out the timeoutId after clearing so
subsequent polls can schedule correctly (refer to setTimeout, clearTimeout,
setCookieChanged and checkCookie).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 02982bc4-4476-474c-acbe-ab3af4346ac8

📥 Commits

Reviewing files that changed from the base of the PR and between 3b32984 and 81949f9.

📒 Files selected for processing (4)
  • backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/appsettings.AT22.json
  • backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI/appsettings.Development.json
  • src/components/ReloadAlert/ReloadAlert.tsx
  • src/resources/Cookie/CookieMethods.ts

Comment thread src/resources/Cookie/CookieMethods.ts Outdated
@allinox
allinox requested review from Nyeng, TheTechArch and sonwit May 19, 2026 13:45
@sonarqubecloud

Copy link
Copy Markdown

@TheTechArch TheTechArch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ode to the Decoupling (PR #2222)

In AT22 the flag was flipped,
The Altinn 2 sync, at last, unzipped.
No more shall actors cross that bridge—
We've cut the cord at the ridge.

The cookie listener, once too keen,
Would flash a modal on the screen.
"Reload! Reload!" it'd cry and shout,
Before the tab had figured out
That it had changed the actor's name—
The current tab was not to blame.

A gentle delay, a breath, a pause,
Now guards against that jarring cause.
A moment's grace before the bell,
So the same tab can change and tell
Its own cookies, "Yes, that's me—
No need to scream. I hold the key."

Two-two-two-two, the PR number gleams,
A tidy cut of tangled seams.
Old Altinn loosens one more thread,
And dev moves on to what's ahead.

@allinox
allinox merged commit 2af3796 into main May 19, 2026
10 checks passed
@allinox
allinox deleted the feat/no-a2-actor-sync-in-at22 branch May 19, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature-request Used when issue is a new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants