fix: only use id directly if scheme is null#93
Conversation
WalkthroughAudit evidence and shared Tilda URI construction now select ChangesTilda subject handling and source updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cs`:
- Line 57: The subject derivation in AuditCoordinationFunctions is using the
wrong fallback when SubjectParty.Scheme is present. Update the subject-building
logic in the method that assigns subject so it uses the scheme-prefixed
identifier (Scheme + Id) whenever Scheme is set, and only uses the plain Id when
Scheme is null. Keep the change localized to the existing req.SubjectParty
handling so npdid stays classified correctly and the query path is selected from
the intended identifier.
In `@src/Dan.Plugin.Tilda/Functions/AuditReportFunctions.cs`:
- Line 57: The subject derivation in AuditReportFunctions should follow the PR
contract: use SubjectParty.Id when SubjectParty.Scheme is null, and when Scheme
is present build the subject from Scheme plus Id instead of switching to
NorwegianOrganizationNumber. Update the logic around the subject variable so the
later npdid/lookup branching in this function continues to receive the expected
identifier format.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 60c6fb61-7cce-4174-81f2-8fda34dd53f8
📒 Files selected for processing (2)
src/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cssrc/Dan.Plugin.Tilda/Functions/AuditReportFunctions.cs
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Dan.Plugin.Tilda/TildaSources/TestTilsyn.cs`:
- Around line 41-50: The parameterless TestTilsyn constructor leaves the _code
field unset, but GetAlertUri, GetSingleAlertUri, and PostAlertUri all embed it
in the generated query string. Update TestTilsyn so _code is always initialized
before any URI methods can run, either by removing or redirecting the
parameterless constructor to the DI-backed constructor, or by giving it a safe
default/fallback value consistent with the existing constructor behavior.
In `@src/Dan.Plugin.Tilda/TildaSources/TildaDataSource.cs`:
- Around line 86-87: The subject value in TildaDataSource needs to be
scheme-aware: the current logic in TildaDataSource.GetAuditReportUri-style URI
construction branches on req.SubjectParty.Scheme but still emits only the raw Id
or NorwegianOrganizationNumber, which omits the required scheme:id format.
Update the subject construction used for all three GetUri call sites so that
when SubjectParty.Scheme is present it prefixes the identifier with that scheme,
and otherwise falls back to the existing identifier-only value. Keep the change
localized to the shared subject-building logic in TildaDataSource so the audit
report, transfer, and other URI paths all receive the same correctly formatted
subject.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 06085af8-bcb9-4126-ba84-9ed3547a5729
📒 Files selected for processing (3)
src/Dan.Plugin.Tilda/TildaSources/Digitaliseringsdirektoratet.cssrc/Dan.Plugin.Tilda/TildaSources/TestTilsyn.cssrc/Dan.Plugin.Tilda/TildaSources/TildaDataSource.cs
💤 Files with no reviewable changes (1)
- src/Dan.Plugin.Tilda/TildaSources/Digitaliseringsdirektoratet.cs
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cs (1)
58-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftCentralize the Tilda subject-resolution rule.
This
Scheme/Id/NorwegianOrganizationNumberbranch now exists here and insrc/Dan.Plugin.Tilda/TildaSources/TildaDataSource.cs:84-91. Pulling it into one shared helper would reduce the chance thatnpdidclassification and URI construction drift apart again.Based on learnings and the matching upstream contract in
src/Dan.Plugin.Tilda/TildaSources/TildaDataSource.cs:84-91, this subject-selection rule is repository-wide.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cs` around lines 58 - 59, The subject-resolution logic is duplicated and can drift between AuditCoordinationFunctions and TildaDataSource. Extract the shared Scheme/Id/NorwegianOrganizationNumber selection into one helper used by both the npdid classification in AuditCoordinationFunctions and the URI construction in TildaDataSource, so both paths always derive the subject the same way.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cs`:
- Around line 58-59: The subject-resolution logic is duplicated and can drift
between AuditCoordinationFunctions and TildaDataSource. Extract the shared
Scheme/Id/NorwegianOrganizationNumber selection into one helper used by both the
npdid classification in AuditCoordinationFunctions and the URI construction in
TildaDataSource, so both paths always derive the subject the same way.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6e65c173-7889-4c3f-8fc2-bb77c759da34
📒 Files selected for processing (3)
src/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cssrc/Dan.Plugin.Tilda/Functions/AuditReportFunctions.cssrc/Dan.Plugin.Tilda/TildaSources/Digitaliseringsdirektoratet.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Dan.Plugin.Tilda/Functions/AuditReportFunctions.cs
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Dan.Plugin.Tilda/Extensions/EvidenceHarvesterRequestExtension.cs`:
- Around line 47-50: GetTildaSubject can return null when Scheme is present but
NorwegianOrganizationNumber is missing, which later breaks callers that assume a
non-null string. Update the return logic in
EvidenceHarvesterRequestExtension.GetTildaSubject to fall back to
req.SubjectParty.Id whenever NorwegianOrganizationNumber is null, ensuring the
method always returns a non-null value for AuditReportFunctions and
AuditCoordinationFunctions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8bed358f-a789-4bcb-8cfb-36946f9e5588
📒 Files selected for processing (4)
src/Dan.Plugin.Tilda/Extensions/EvidenceHarvesterRequestExtension.cssrc/Dan.Plugin.Tilda/Functions/AuditCoordinationFunctions.cssrc/Dan.Plugin.Tilda/Functions/AuditReportFunctions.cssrc/Dan.Plugin.Tilda/TildaSources/TildaDataSource.cs
Description
If scheme is not null, subjectparty id is prepended with scheme id. Only use id directly if scheme is null
Documentation
Summary by CodeRabbit
New Features
Bug Fixes
Chores