Sitelet https://github.com/Altinn/app-lib-dotnet/pull/1873
Skip to content

fix: stop scheduled instantiation notifications for deleted instances, and let Notifications retry when the instance lookup fails - #1873

Open
danielskovli wants to merge 2 commits into
mainfrom
fix/1864-notification-callback-deleted-instances
Open

danielskovli wants to merge 2 commits into
mainfrom
fix/1864-notification-callback-deleted-instances

Conversation

@danielskovli

@danielskovli danielskovli commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

The app registers a condition endpoint on the instantiation notification it orders, and Altinn Notifications asks it whether to send when the scheduled time comes. The callback answered "send" whenever it couldn't use the instance:

  • A deleted instance is still returned by Storage until it is purged, with a process that never ended, so it was sent. Once purged, the lookup throws, and the catch-all answered "send".
  • An app without Maskinporten can't read the instance as service owner, so every callback failed silently and answered "send", for deleted and submitted instances alike. This is what the reports in Planlagte instansieringsvarsler sendes etter sletting eller innsending #1864 ran into.
  • A transient error also answered "send", so the condition was never checked for that attempt.

The callback now:

  • answers "don't send" when the instance is soft- or hard-deleted, before the app's ICancelInstantiationNotification is asked;
  • answers "don't send" when Storage returns 404;
  • answers 500 on any other failure. Altinn Notifications retries a failed condition check once and sends the notification if the retry fails too, so a network blip delays the notification rather than losing it;
  • logs a missing Maskinporten configuration as an error, since the condition can then never be checked.

The 404 rule relies on Storage answering 404 only for an instance that doesn't exist. Today Storage turns any error into 404; Altinn/altinn-storage#1130 changes that to 500, and this should not ship before it is deployed.

The ICancelInstantiationNotification docs now say that the default sends until the process has ended, which is not necessarily when the form is submitted.

Related

🤖 Generated with Claude Code

…, and let Notifications retry when the instance lookup fails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 675eaa26-5357-4c0b-ae59-18cab0855941

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@danielskovli danielskovli added the bugfix Label Pull requests with bugfix. Used when generation releasenotes label Oct 2, 2026
@danielskovli
danielskovli marked this pull request as ready for review October 2, 2026 13:08
…lback as an error

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Label Pull requests with bugfix. Used when generation releasenotes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Planlagte instansieringsvarsler sendes etter sletting eller innsending

1 participant