Skip to content

fix: pdf base64 decode tracestate header#3973

Merged
martinothamar merged 1 commit intomainfrom
fix/pdf-base64-decode-tracestate
Mar 2, 2026
Merged

fix: pdf base64 decode tracestate header#3973
martinothamar merged 1 commit intomainfrom
fix/pdf-base64-decode-tracestate

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 propagation for PDFs: tracestate is now validated as non-empty, attempts safe decoding with error handling, and falls back to preserving the original value while logging failures—making trace retention and propagation more robust.

@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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b02b721 and 558d432.

📒 Files selected for processing (1)
  • src/features/propagateTraceWhenPdf/index.ts

📝 Walkthrough

Walkthrough

Validates that tracestate is a non-empty string and attempts Base64 decoding via atob() inside a try/catch in the PDF trace propagation module; on decode failure it keeps 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 decode 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 | ✅ 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 'fix: pdf base64 decode tracestate header' clearly and specifically describes the main change: fixing base64 decoding of the tracestate header in PDF functionality.
Description check ✅ Passed The description follows the template structure with Description, Related Issues, and Verification/QA sections, though no manual testing, automated tests, or other verification items are explicitly marked as completed.

✏️ 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 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
@martinothamar martinothamar force-pushed the fix/pdf-base64-decode-tracestate branch from b02b721 to 558d432 Compare March 2, 2026 07:59
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

@martinothamar martinothamar merged commit d7c4404 into main Mar 2, 2026
14 of 16 checks passed
@martinothamar martinothamar deleted the fix/pdf-base64-decode-tracestate branch March 2, 2026 09:04
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Automatic backport successful!

A backport PR has been automatically created for the release/v4.25 release branch.

The release branch release/v4.25 already existed and was updated.

The cherry-pick was clean with no conflicts. Please review the backport PR when it appears.

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.

3 participants