Skip to content

Conversation

@martinothamar
Copy link
Contributor

@martinothamar martinothamar commented Jan 28, 2026

Description

Companion PR for Altinn/app-lib-dotnet#1645

Related Issue(s)

  • N/A

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

  • Bug Fixes
    • Improved trace data handling for PDF propagation: validates tracestate as non-empty, attempts safe decoding with error handling, and falls back to preserving original value while logging failures. This adds a graceful recovery path to keep trace information consistent and propagation more reliable.

@martinothamar martinothamar self-assigned this Jan 28, 2026
@martinothamar martinothamar added kind/bug Something isn't working backport This PR should be cherry-picked onto older release branches labels Jan 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Validates tracestate as a non-empty string and attempts Base64 decoding via atob() inside a try/catch in the PDF trace propagation module; on decode failure it preserves the original tracestate and logs an error. Traceparent handling is unchanged.

Changes

Cohort / File(s) Summary
Tracestate base64 decoding enhancement
src/features/propagateTraceWhenPdf/index.ts
Added validation that tracestate is a non-empty string and a try/catch-wrapped atob() decode; on failure the original tracestate value is preserved and an error is logged. Traceparent logic unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
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.
Description check ❓ Inconclusive The description includes the required template structure with all major sections present. However, the Description section is minimal (only referencing a companion PR) and no checklist items are marked as completed despite the template requesting explicit selections. Expand the Description section to explain what the change does and why it's needed. Mark relevant checklist items as completed (e.g., testing status, documentation needs) to clarify verification approach.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding base64 decoding logic for the tracestate header in PDF handling.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/pdf-base64-decode-tracestate

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.

@danielskovli
Copy link
Contributor

LGTM! Hvis du merger uten en approve her, får du kanskje #yolo badge 😄

@martinothamar martinothamar force-pushed the fix/pdf-base64-decode-tracestate branch from 95bc264 to b02b721 Compare February 2, 2026 07:26
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 45%)
0.0% Condition Coverage on New Code (required ≥ 45%)

See analysis details on SonarQube Cloud

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

Labels

backport This PR should be cherry-picked onto older release branches kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants