Repository navigation
Fix the notification 400 in the CMS, and warn about UseInternalScheduler - #209
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #206. Closes #207.
Notification
400on 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_ShellLayoutrendered the token but not that element, so the navigation sent no token and/Optimizely/CMS/stores/notificationreturned400. The built-inCommonLayoutrenders both, so this adds the same tag helper.Cleanup job not firing with
UseInternalScheduleron Optimizely (#207)When I filed this I said the cause was unknown, but I'd missed that it's deliberate:
UseOptimizelyNotFoundHandlercallsTryUnscheduleon 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:
UseOptimizelyNotFoundHandlernow logs a warning when the flag is on, saying it can be removed and which job does the cleanup.If you'd rather have the flag win on Optimizely sites, it's a small change, so say so.
Testing
Geta.NotFoundHandler.Tests224/224 andGeta.NotFoundHandler.Optimizely.Tests82/82, including new tests for the warning.TryUnschedule, which is alsotruewhen 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.stores/notificationwent from400to200on page load and when opening the bell, the panel opens, and the navigation and the page below still render.TryUnscheduleline commented out: old row removed, recent row keptNot tested
Known limits
These were already the case, and I left them as they need a decision about the design:
UseOptimizelyNotFoundHandlerruns afterUseNotFoundHandler, 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.UseOptimizelyNotFoundHandleraltogether, which is tolerated, also keeps the job on the internal scheduler and gets no warning about it.🤖 Generated with Claude Code
https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ