Skip to content

Fix the notification 400 in the CMS, and warn about UseInternalScheduler - #209

Merged
frederikvig merged 2 commits into
masterfrom
fix/cms-navigation-and-scheduler
Nov 7, 2026
Merged

frederikvig merged 2 commits into
masterfrom
fix/cms-navigation-and-scheduler

Conversation

@frederikvig

@frederikvig frederikvig commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Closes #206. Closes #207.

Notification 400 on the add-on's page in the CMS (#206)

The navigation reads <episerver-common-settings> to find the name of the antiforgery field and header. Our _ShellLayout rendered the token but not that element, so the navigation sent no token and /Optimizely/CMS/stores/notification returned 400. The built-in CommonLayout renders both, so this adds the same tag helper.

Cleanup job not firing with UseInternalScheduler on Optimizely (#207)

When I filed this I said the cause was unknown, but I'd missed that it's deliberate: UseOptimizelyNotFoundHandler calls TryUnschedule on the job, with a comment saying Optimizely sites use the built-in scheduled job. That has been there since the job was added in 089d317.

I kept that behaviour, because running both schedulers isn't obviously what anyone wants, and changing it would be a decision about the design rather than a fix. What was wrong is that the flag silently did nothing, so:

  • UseOptimizelyNotFoundHandler now logs a warning when the flag is on, saying it can be removed and which job does the cleanup.
  • The readme says which scheduler applies where.

If you'd rather have the flag win on Optimizely sites, it's a small change, so say so.

Testing

  • Geta.NotFoundHandler.Tests 224/224 and Geta.NotFoundHandler.Optimizely.Tests 82/82, including new tests for the warning.
  • Review caught that my first version based the warning on the result of TryUnschedule, which is also true when there was nothing to remove, so a site using Coravel for its own jobs would have got the warning with the flag off. It now reads the flag, and the new test fails with the old condition.
  • Notification request returns 400 on the add-on's page in the CMS on CMS 13 #206 in Chrome inside the CMS on CMS 13.1: stores/notification went from 400 to 200 on page load and when opening the bell, the panel opens, and the navigation and the page below still render.
  • Suggestions cleanup job doesn't fire with UseInternalScheduler in the Optimizely sample site #207 in the sandbox with a cron of every minute, an old row and a recent row in the suggestions table, checked after 130 seconds:
    • as it was: both rows left, so the job didn't run
    • with the TryUnschedule line commented out: old row removed, recent row kept
  • In the sandbox, the warning appears once with the flag on and not at all with it off.

Not tested

  • The sandbox has no notifications, so the panel was only seen empty.

Known limits

These were already the case, and I left them as they need a decision about the design:

  • The job is only removed if UseOptimizelyNotFoundHandler runs after UseNotFoundHandler, the order the readme shows. In the other order the job stays on the internal scheduler, so the warning is wrong and the cleanup can run on both schedulers.
  • A site leaving out UseOptimizelyNotFoundHandler altogether, which is tolerated, also keeps the job on the internal scheduler and gets no warning about it.
  • Review suggested one decision point instead: the Optimizely package would tell the core not to register the job at all, so nothing gets scheduled and then removed, and the call order stops mattering. That would be the better design if you want to fix these.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ

frederikvig and others added 2 commits November 6, 2026 20:42
The layout of the add-on's page in the CMS didn't render
<episerver-common-settings>, which the navigation reads to find out how to
send the antiforgery token, so its notification request failed with a 400.

UseOptimizelyNotFoundHandler has always removed the suggestions cleanup job
from the internal scheduler, on purpose, so turning on UseInternalScheduler
on an Optimizely site silently did nothing. It now logs a warning, and the
readme says which scheduler applies where.

Closes #206. Closes #207.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ
From review. TryUnschedule also returns true when there was nothing to remove,
so a site using Coravel for its own jobs got the warning with the flag off. The
warning now also says the flag can be removed, which is the only way to clear it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ
@frederikvig
frederikvig merged commit 0096dd0 into master Nov 7, 2026
1 check passed
@frederikvig
frederikvig deleted the fix/cms-navigation-and-scheduler branch November 7, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant