chadek opened a new pull request, #44608:
URL: https://github.com/apache/superset/pull/44608

   ### SUMMARY
   
   Split out of #44470 per [rusackas's 
review](https://github.com/apache/superset/pull/44470#issuecomment-3335678901) 
so that PR stays just the fix. This is the local test rig referenced in that 
PR's testing instructions.
   
   `superset-embedded-sdk/src/index.test.ts` mocks `MessageChannel` and 
`Switchboard`, so it can't exercise the parts of the bug that only exist 
between two real documents: the port-transfer handshake, what survives a 
navigation the dashboard makes on its own, and how many guest tokens the host's 
endpoint is actually asked for.
   
   This rig runs a host app and a stand-in for Superset's embedded page on two 
origins, loads the built UMD bundle in headless Chromium, and drives it over 
the real `@superset-ui/switchboard`. `node testrig/drive.mjs` runs 39 checks 
covering:
   
   - a first embed rendering on exactly one minted token
   - an internal navigation re-authenticating the new document, in order (token 
before theme)
   - a `get` still in flight when the user navigates rejecting as 
`PortClosedError` instead of hanging, and the same on `unmount()`
   - a navigation that leaves the embedded page minting no token at all
   - the refresh timer following the current document after a reload
   - both directions of the race between the initial token fetch and a 
navigation that happens while it's still in flight
   
   **Depends on #44468's fix (#44470) to pass.** This PR itself carries no fix 
code, only the test tooling — checked against `master` as it stands today, 
`drive.mjs` fails, reproducing the bug. I ran it locally against 
`fix/embedded-sdk-internal-navigation` (i.e. this branch's files, on top of 
that fix) and got 39/39 passing; the README documents running it against `git 
show HEAD~1:...` of `src/index.ts` to watch the checks fail for the same 
reason. Recommend merging #44470 first, or reviewing this diff on its own and 
trusting the local run.
   
   Not wired into CI (`.github/workflows/embedded-sdk-test.yml` only runs `npm 
test`/`npm run build`): it needs a Chromium binary on `PATH`, and the unit 
tests already gate the merge. It's meant as a manual/local tool for exercising 
the cross-document behavior when touching this handshake again.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — no product code change, test tooling only.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-embedded-sdk
   node testrig/drive.mjs            # headless, builds the bundle if it is 
stale
   node testrig/drive.mjs --headed   # watch it happen
   node testrig/drive.mjs --verbose  # + the pages' console output
   ```
   
   Needs a `chromium`, `chromium-browser` or `google-chrome` on `PATH`, or 
`CHROMIUM_PATH` pointing at one. Run it on top of #44470's branch to see 39/39 
pass, or on `master` alone to watch it reproduce the bug.
   
   To poke at it by hand: `node testrig/server.mjs`, then open 
`http://localhost:8100`. See `testrig/README.md` for the query params that 
reach the two token-fetch races.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue: split out of #44470, which fixes #44468
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to