Skip to content

Remove extraneous senders from Fiks Arkiv Payload#1685

Merged
tina-ahm merged 6 commits intomainfrom
feature/fiks-arkiv-remove-extraneous-senders
Mar 10, 2026
Merged

Remove extraneous senders from Fiks Arkiv Payload#1685
tina-ahm merged 6 commits intomainfrom
feature/fiks-arkiv-remove-extraneous-senders

Conversation

@tina-ahm
Copy link
Contributor

@tina-ahm tina-ahm commented Mar 6, 2026

Description

Removed the extraneous senders (service owner as "Avsender" and Altinn Studio as "Intern avsender", respectively) so that, by default, only the instance owner is set as "Avsender" in the generated payload for Fiks Arkiv.

Related Issue(s)

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

  • Refactor
    • Simplified Fiks Arkiv behavior: removed service-owner/internal sender lookup so generated archive payloads contain fewer correspondence parties (fewer senders).
  • Tests
    • Updated test fixtures and expectations to match the reduced set of correspondence parties in generated payloads.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

Removed internal sender support: deleted AltinnOrgNo constant, removed CreateInternalSender and GetServiceOwnerParty, eliminated service-owner lookup/usage from payload generation, updated tests and snapshots to omit internal/internal-service korrespondansepart entries.

Changes

Cohort / File(s) Summary
Constants & Factory
src/Altinn.App.Clients.Fiks/Constants/FiksArkivConstants.cs, src/Altinn.App.Clients.Fiks/Factories/KorrespondansepartFactory.cs
Removed internal organization constant AltinnOrgNo and deleted CreateInternalSender factory method.
Payload generation
src/Altinn.App.Clients.Fiks/FiksArkiv/FiksArkivDefaultPayloadGenerator.cs
Dropped retrieval/usage of a service-owner Korrespondansepart and removed additions of an internal sender to generated payloads; removed unused using.
Config resolver & interface
src/Altinn.App.Clients.Fiks/FiksArkiv/FiksArkivConfigResolver.cs, src/Altinn.App.Clients.Fiks/FiksArkiv/IFiksArkivConfigResolver.cs
Removed GetServiceOwnerParty method and associated Altinn CDN dependency/logic from config resolver and its interface.
Unit tests — resolver & generator
test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivConfigResolverTest.cs, test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs
Removed tests and test branches that exercised GetServiceOwnerParty; updated test fixtures and signatures to remove serviceOwnerParty parameters and related mocks/helpers.
Verified snapshots
test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.*
Updated XML verification snapshots to remove korrespondansepart entries for the internal sender and related sender blocks.
Public API verification
test/Altinn.App.Clients.Fiks.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt
Recorded removal of GetServiceOwnerParty(CancellationToken) from IFiksArkivConfigResolver public surface.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Remove extraneous senders from Fiks Arkiv Payload' accurately and specifically describes the main change: removing unnecessary sender entries (service owner and Altinn Studio) from the generated Fiks Arkiv payload.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/fiks-arkiv-remove-extraneous-senders

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.

@tina-ahm tina-ahm requested a review from danielskovli March 6, 2026 12:00
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@src/Altinn.App.Clients.Fiks/FiksArkiv/FiksArkivDefaultPayloadGenerator.cs`:
- Around line 127-131: The code was refactored to only add instanceOwnerParty to
journalEntry.Korrespondansepart (see FiksArkivDefaultPayloadGenerator where
instanceOwnerParty is used) and IFiksArkivConfigResolver.GetServiceOwnerParty
must remain on the interface, but the test mock for that method is now unused;
remove the unused mock setup in FiksArkivDefaultPayloadGeneratorTest (around the
previous line ~282) so the test no longer configures GetServiceOwnerParty, and
ensure the test asserts only against instanceOwnerParty being added to
journalEntry.Korrespondansepart without referencing the removed sender mock.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d7f7c2e5-2f3b-4850-96c8-79ed611ca903

📥 Commits

Reviewing files that changed from the base of the PR and between fa5aa07 and 3df42d6.

📒 Files selected for processing (7)
  • src/Altinn.App.Clients.Fiks/Constants/FiksArkivConstants.cs
  • src/Altinn.App.Clients.Fiks/Factories/KorrespondansepartFactory.cs
  • src/Altinn.App.Clients.Fiks/FiksArkiv/FiksArkivDefaultPayloadGenerator.cs
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.1.verified.txt
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.2.verified.txt
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.3.verified.txt
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.4.verified.txt
💤 Files with no reviewable changes (6)
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.2.verified.txt
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.4.verified.txt
  • src/Altinn.App.Clients.Fiks/Constants/FiksArkivConstants.cs
  • src/Altinn.App.Clients.Fiks/Factories/KorrespondansepartFactory.cs
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.3.verified.txt
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/.Verify/FiksArkivDefaultPayloadGeneratorTest.GeneratePayload_GeneratesCorrectPayload.1.verified.txt

Copy link
Contributor

@danielskovli danielskovli left a comment

Choose a reason for hiding this comment

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

🚀

@tina-ahm tina-ahm added feature Label Pull requests with new features. Used when generation releasenotes backport-ignore This PR is a new feature and should not be cherry-picked onto release branches labels Mar 6, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs (1)

186-216: 🛠️ Refactor suggestion | 🟠 Major

Unused serviceOwnerParty parameter should be removed.

The serviceOwnerParty parameter (line 194) is accepted by TestCase.Create but is never passed to PayloadGeneratorFixture.Create (lines 202-211). This results in unnecessary allocations at lines 61, 83, 95, and 123 where Factories.ServiceOwnerParty(...) is called but discarded.

Additionally, the Factories.ServiceOwnerParty helper (lines 351-352) appears to be unused after this refactor.

♻️ Proposed fix to remove dead code

Remove the parameter from TestCase.Create:

 public static TestCase Create(
     string testIdentifier,
     string fiksArkivMessageType,
     IEnumerable<string> expectedAttachmentFilenames,
     FiksArkivDataTypeSettings primaryDocumentSettings,
     IReadOnlyList<FiksArkivDataTypeSettings>? attachmentSettings,
     FiksArkivDocumentMetadata? archiveDocumentMetadata,
     Korrespondansepart recipientParty,
-    Korrespondansepart serviceOwnerParty,
     Korrespondansepart? instanceOwnerParty,
     Klassifikasjon instanceOwnerClassification,
     string applicationTitle = "Test app",
     string appId = "ttd/test-app"
 )

Remove serviceOwnerParty arguments from all test case calls (lines 61, 83, 95, 123), and delete the unused Factories.ServiceOwnerParty method (lines 351-352).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs`
around lines 186 - 216, Remove the unused serviceOwnerParty parameter from
TestCase.Create and stop passing it into PayloadGeneratorFixture.Create; update
all callers that currently pass Factories.ServiceOwnerParty(...) (the test case
calls at the locations referenced) to omit that argument, and delete the
now-unused Factories.ServiceOwnerParty helper; specifically edit the
TestCase.Create signature to remove the serviceOwnerParty parameter, remove the
corresponding argument in calls to PayloadGeneratorFixture.Create, and remove
the Factories.ServiceOwnerParty method.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs`:
- Around line 186-216: Remove the unused serviceOwnerParty parameter from
TestCase.Create and stop passing it into PayloadGeneratorFixture.Create; update
all callers that currently pass Factories.ServiceOwnerParty(...) (the test case
calls at the locations referenced) to omit that argument, and delete the
now-unused Factories.ServiceOwnerParty helper; specifically edit the
TestCase.Create signature to remove the serviceOwnerParty parameter, remove the
corresponding argument in calls to PayloadGeneratorFixture.Create, and remove
the Factories.ServiceOwnerParty method.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c57f16ac-ee62-4924-b2d2-c55ff7f94278

📥 Commits

Reviewing files that changed from the base of the PR and between 3df42d6 and 2c19e30.

📒 Files selected for processing (5)
  • src/Altinn.App.Clients.Fiks/FiksArkiv/FiksArkivConfigResolver.cs
  • src/Altinn.App.Clients.Fiks/FiksArkiv/IFiksArkivConfigResolver.cs
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivConfigResolverTest.cs
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs
  • test/Altinn.App.Clients.Fiks.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt
💤 Files with no reviewable changes (4)
  • src/Altinn.App.Clients.Fiks/FiksArkiv/IFiksArkivConfigResolver.cs
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivConfigResolverTest.cs
  • src/Altinn.App.Clients.Fiks/FiksArkiv/FiksArkivConfigResolver.cs
  • test/Altinn.App.Clients.Fiks.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs (1)

164-170: The test is correct as written; the null! suppressions don't pose a robustness risk.

The GeneratePayload method validates the messageType at the start (line 65 of FiksArkivDefaultPayloadGenerator.cs) and throws immediately if unsupported, before accessing any fixture state. This negative-path test correctly exercises that guard without depending on later validation.

Using factory methods instead of null! would be more idiomatic C# and improve readability, but it is not necessary for correctness.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs`
around lines 164 - 170, The test
GeneratePayload_ThrowsException_ForUnsupportedMessageType is correct but uses
null! suppressions that reduce readability; replace the null! arguments passed
into PayloadGeneratorFixture.Create and the null! in Factories.Instance(...)
with the existing factory/helper methods that produce valid dummy fixtures or
defaults (use PayloadGeneratorFixture.Create's normal factory overloads and
Factories.Instance helper) so the test still triggers the early messageType
validation in GeneratePayload but uses explicit, readable test doubles instead
of null! assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs`:
- Around line 164-170: The test
GeneratePayload_ThrowsException_ForUnsupportedMessageType is correct but uses
null! suppressions that reduce readability; replace the null! arguments passed
into PayloadGeneratorFixture.Create and the null! in Factories.Instance(...)
with the existing factory/helper methods that produce valid dummy fixtures or
defaults (use PayloadGeneratorFixture.Create's normal factory overloads and
Factories.Instance helper) so the test still triggers the early messageType
validation in GeneratePayload but uses explicit, readable test doubles instead
of null! assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 666b0b5c-4d8f-42e6-b62f-6aeaad390af0

📥 Commits

Reviewing files that changed from the base of the PR and between 2c19e30 and 24a7776.

📒 Files selected for processing (1)
  • test/Altinn.App.Clients.Fiks.Tests/FiksArkiv/FiksArkivDefaultPayloadGeneratorTest.cs

@sonarqubecloud
Copy link

@tina-ahm tina-ahm merged commit e36c076 into main Mar 10, 2026
13 checks passed
@tina-ahm tina-ahm deleted the feature/fiks-arkiv-remove-extraneous-senders branch March 10, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-ignore This PR is a new feature and should not be cherry-picked onto release branches feature Label Pull requests with new features. Used when generation releasenotes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants