Skip to content

Bugfix: Removed most of the usage of UserInfo.getSessionId()#995

Open
jongpie wants to merge 14 commits into
mainfrom
bugfix/more-auth-session-and-quiddity-issues
Open

Bugfix: Removed most of the usage of UserInfo.getSessionId()#995
jongpie wants to merge 14 commits into
mainfrom
bugfix/more-auth-session-and-quiddity-issues

Conversation

@jongpie

@jongpie jongpie commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Core Unlocked Package Changes

Fixed #761 and fixed #964 by updating Logger Apex class to remove most of the usage of System.UserInfo.getSessionId() - it can't cause problems if we don't use it 😆

  • Now the only place that the session ID is referenced is when using the REST save method. The user session ID is synchronously passed to the internal class RestApiSaver - and passing it like this will (intentionally) force a synchronous runtime exception when there isn't a session ID (instead of it silently failing async)

To help validate that this change doesn't cause any regressions, I've added some extra metadata (used only in the pipeline & testing) to recreate previously reported issues related to quiddity & user session ID:

With the extra metadata in place & the changes in Logger, everything still seems to be working as expected (without the use of System.UserInfo.getSessionId()). More testing will be done prior to merging this.

Pipeline Changes

Pipeline overhaul: made some big restructuring of .github/workflows/build.yml for maintainability and speed improvements

  • Made two composite actions (setup-npm and authorize-dev-hub) for some stuff that's used throughout the build (and was previously duplicated a bunch)
  • Pulled out the scratch-org test logic into a reusable workflow (test-scratch-org.yml), with parameters to control scratch def file, OmniStudio toggle, optional extra-metadata directory, and Codecov toggle
  • Updated build.yml to use the new actions & workflows, which eliminates a ton of duplication
  • Moved the scratch org tests a single matrix-driven caller. Adding a new scratch org now just requires a few new lines to be added to the matrix.
  • All scratch orgs now run in parallel instead of in batches of 3 (a huge thanks to thanks @jamessimone and @mitchspano for getting the dev hub limit increased 🥳)
  • Added a new state-and-country-picklists scratch org as a small follow-up to issue Testing Error in Orgs with State & Country Code Picklists #976
  • Added a new hourly cleanup workflow (delete-stale-scratch-orgs.yml) to delete orphaned pipeline scratch orgs older than 2 hours (it'll skip any scratch orgs tied to GitHub Actions that are still running)

jongpie added 9 commits June 4, 2026 16:03
…e previously reported issues related to quiddity & user session ID

* Added an example email service, ExampleInboundEmailService, to have a full solution to re-test issue #155
* Added Experience Cloud metadata SSO logins, auth provider, and custom registration handlers, to have a full solution to re-test issue #224
…Id() - it can't cause problems if we don't use it ^_^

Now the only place that the session ID is referenced is when using the REST save method. The user session ID is synchronously passed to the internal class RestApiSaver - and passing it like this will (intentionally) force a synchronous runtime exception when there isn't a session ID (instead of it silently failing async)
…t a time), thanks to @jamessimone and @mitchspano for getting the devhub limit increased!
…e much easier

- Split common CI setup into two composite actions, .github/actions/setup-npm/action.yml and .github/actions/authorize-dev-hub/action.yml
- Extracted the scratch-org test sections into a new reusable workflow at .github/workflows/test-scratch-org.yml, with parameters for definition
  file, OmniStudio install, optional extra metadata directory, and Codecov upload toggle
- Converted the 7 near-identical scratch-org jobs in build.yml into a single matrix-driven caller of the reusable workflow. Adding a new scratch org is now one matrix row; downstream `needs:` lists shrink from 8/9 names to 3.
- Pipeline scratch orgs are now create with `--alias pipeline-scratch-org` and a `--description` containing the GitHub run ID, so the in-job deletion can make sure it's targeting the correct scratch org
- Scratch org delete step has been updated to use `continue-on-error: true` so a transient delete failure does not mask a real test failure.
…to run an hourly cleanup of orphaned pipeline scratch orgs older than 2 hours

* For each scratch org, it parses the run ID out of the description and asks the GitHub REST API whether the owning run is still active. Orgs whose run is queued or in-progress are skipped, so a slow but healthy build never has its scratch org deleted while the job is still running.
…ng the previously used versions, built for Node 20)
@jongpie jongpie had a problem deploying to Advanced Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to OmniStudio Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Event Monitoring Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to State & Country Picklists Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Base Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Platform Cache Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org June 4, 2026 20:56 — with GitHub Actions Failure
… JWT file so that it's still available for subsequent sf CLI commands

I thought deleting it would be safe & a good idea for security - but it broke everything ~_~
@jongpie jongpie had a problem deploying to Event Monitoring Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to State & Country Picklists Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Advanced Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to OmniStudio Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Base Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Platform Cache Scratch Org June 4, 2026 22:14 — with GitHub Actions Failure
…de script to export the current user's username to .env so that deploying the example email service works in the pipeline
@jongpie jongpie temporarily deployed to Base Scratch Org June 4, 2026 23:01 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org June 4, 2026 23:01 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Platform Cache Scratch Org June 4, 2026 23:01 — with GitHub Actions Inactive
@jongpie jongpie had a problem deploying to Advanced Scratch Org June 4, 2026 23:01 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to State & Country Picklists Scratch Org June 4, 2026 23:01 — with GitHub Actions Failure
@jongpie jongpie temporarily deployed to OmniStudio Scratch Org June 4, 2026 23:01 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Event Monitoring Scratch Org June 4, 2026 23:01 — with GitHub Actions Inactive
jongpie added 2 commits June 4, 2026 20:42
…t's causing pipeline issues and is out o' scope
…job run at the same time as (instead of as a prerequisite for) 'lwc-jest-tests' and 'scratch-org-tests'
@jongpie jongpie deployed to Advanced Scratch Org June 5, 2026 00:46 — with GitHub Actions Active
@jongpie jongpie deployed to OmniStudio Scratch Org June 5, 2026 00:46 — with GitHub Actions Active
@jongpie jongpie deployed to Experience Cloud Scratch Org June 5, 2026 00:46 — with GitHub Actions Active
@jongpie jongpie deployed to Platform Cache Scratch Org June 5, 2026 00:46 — with GitHub Actions Active
@jongpie jongpie temporarily deployed to Base Scratch Org June 5, 2026 00:46 — with GitHub Actions Inactive
@jongpie jongpie deployed to Event Monitoring Scratch Org June 5, 2026 00:46 — with GitHub Actions Active
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.79%. Comparing base (05ce16c) to head (39d4b0f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #995      +/-   ##
==========================================
+ Coverage   93.76%   93.79%   +0.03%     
==========================================
  Files          58       58              
  Lines        6335     6319      -16     
  Branches      204      204              
==========================================
- Hits         5940     5927      -13     
+ Misses        393      390       -3     
  Partials        2        2              
Flag Coverage Δ
Apex 93.12% <100.00%> (+0.03%) ⬆️
LWC 96.27% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jongpie jongpie temporarily deployed to Base Scratch Org June 5, 2026 01:07 — with GitHub Actions Inactive
@jongpie jongpie deployed to Base Scratch Org June 5, 2026 01:21 — with GitHub Actions Active
@jongpie jongpie added Type: Bug Something isn't working tech-debt Layer: Logger Engine Items related to the core logging engine Salesforce issue labels Jun 5, 2026
@jongpie jongpie added optimization cleanup Logging Source: Apex Items related to using Logger within Apex Logging Source: Flow Items related to using Nebula Logger within Flow Package Type: Managed Package Issues and enhancements that specifically apply to the managed package Logging Source: Lightning Components Items related to using Nebula Logger using JavaScript within lightning components (lwc & aura) Package Type: Unlocked Package Issues and enhancements that specifically apply to the unlocked package Logging Source: API Items related to using Nebula Logger via REST API Logging Source: OmniStudio Items related to using Nebula Logger within OmniStudio labels Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Layer: Logger Engine Items related to the core logging engine Logging Source: Apex Items related to using Logger within Apex Logging Source: API Items related to using Nebula Logger via REST API Logging Source: Flow Items related to using Nebula Logger within Flow Logging Source: Lightning Components Items related to using Nebula Logger using JavaScript within lightning components (lwc & aura) Logging Source: OmniStudio Items related to using Nebula Logger within OmniStudio optimization Package Type: Managed Package Issues and enhancements that specifically apply to the managed package Package Type: Unlocked Package Issues and enhancements that specifically apply to the unlocked package Salesforce issue tech-debt Type: Bug Something isn't working

Projects

None yet

2 participants