Remove the open-estate button fix for EstateIsReady tasks queued before the button

Open
#1,887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp, sql
Domain
backend, data

Research direction

Start in EstateIsReadyCorrespondenceTaskV2Handler.Handle, where the temporary AddOpenEstateButtonIfMissing is called, and read the method itself. Its tests are in EstateIsReadyCorrespondenceTaskV2HandlerTests, along with MessageDetailsByLanguage.CopyInRecipientLanguage. Done when the method, its call, and its tests are gone and the remaining tests pass. Removal is gated on prod checks (App Insights log, task_queue SQL) that a newcomer cannot run, so confirm with a maintainer before deleting anything.

Written by the indexing model from the issue text.

Description

The heir-dialog change (digdir/oed PR #775) gives every correspondence message an open-estate button and removes the estate link from the message bodies. EstateIsReady tasks queued in the task queue before that change carry the old message: the link is in the body and there is no button. Because the dialog a heir gets shows only the buttons of its first message, such a task would start a dialog with no way into the estate for any message appended later.

To cover those tasks, EstateIsReadyCorrespondenceTaskV2Handler has a temporary AddOpenEstateButtonIfMissing that adds the button when the queued message has none. It logs at Information level each time it adds one:

Added the open-estate button to the EstateIsReady message for {InstanceId}, queued before the button existed

When to remove

Once the tasks queued before #775 reached production have run. Prod keeps queuing EstateIsReady tasks in the old shape until the deploy, and each runs on its access date, so this is not a fixed time after the deploy. Remove when all of these hold:

  • The log line above no longer appears in prod App Insights.
  • No unexecuted EstateIsReadyCorrespondenceTaskV2 task created before the deploy is left in the prod task_queue.
  • No dead-lettered (executed IS NULL AND scheduled IS NULL) EstateIsReadyCorrespondenceTaskV2 task created before the deploy is left either. oed-admin can requeue one at any time, and after the removal it would start a heir dialog without a button. Requeue or delete those first.

Checked in prod on 2026-11-02: 538 queued tasks, all with both party ids (each starts a dialog) and a valid instance id as SendersReference in both the nb and nn copies, so the fix adds the button to every one; none dead-lettered.

-- Pre-deploy EstateIsReady tasks still unexecuted, by state. Set the deploy time.
SELECT
  CASE
    WHEN scheduled IS NULL THEN 'dead-lettered'
    ELSE 'queued'
  END AS state,
  count(*)
FROM oed.task_queue
WHERE type = 'Altinn.App.Tasks.Correspondence.EstateIsReadyCorrespondenceTaskV2'
  AND executed IS NULL
  AND created < '<deploy time, UTC>'
  AND (scheduled IS NULL OR scheduled < '2126-01-01')
GROUP BY 1;

Remove when 'queued' and 'dead-lettered' are both 0.

What to remove

  • AddOpenEstateButtonIfMissing and its call in EstateIsReadyCorrespondenceTaskV2Handler.Handle.
  • The tests for it in EstateIsReadyCorrespondenceTaskV2HandlerTests (the payload queued before the button, QueuedBeforeTheButton, GivenTexts, and the tests that use them).
  • MessageDetailsByLanguage.CopyInRecipientLanguage, if nothing else uses it then. It can be folded back into InRecipientLanguage.
  • The paragraph about the handler fix under "Open-estate button" in docs/superpowers/specs/2026-10-15-heir-dialog-design.md.
Dominant language
No language data
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Altinn/oed

All issues in Altinn/oed

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.