Let a host app sign the panel in and open a run - #72
Closed
DavertMik wants to merge 3 commits into
Closed
Conversation
A desktop app that launches Chrome with this extension loaded drops handoff.json beside the manifest: a project token for v2, a web session for the JSON:API, and optionally the run to open. The tester pastes nothing. A file, not argv — --load-extension command lines are readable by every process on the machine. Only the project token is stored; the session token stays in memory and is re-read, like the one /api/login returns. The project is pinned, since one project's token was handed over. Disconnect cannot delete a file it does not own, so it marks that push answered and a newer one wins. Also: opening a run from a URL now reports whether it landed anywhere. A run that 404s used to leave the panel showing nothing at all.
A panel the host has just opened consumes the offer during its own boot, so the poke that follows found the run already opened and reported none. The host asked whether its run is up, so answer that.
Adopting a handoff used to delete the General token saved for that host, so closing the host's browser left the panel with nothing and the tester re-pasting a token they had already given us. Both credentials are kept side by side instead. The project token is tagged with the project it was issued for and used only there, so a switch elsewhere falls back to the account token — which also means the switcher only has to be pinned for a tester who has no token of their own. The host's name is stored with the connection, because the card has to name whose session ended after the file it came from is gone.
Author
|
Superseded by #73, which carries these commits plus the auth change that grew out of them: authorizing at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A desktop app that launches Chrome with this extension loaded can hand the panel a ready session, so the tester never pastes a token to run the test the app just sent them to. Built for Testeiya, but nothing here knows about Testeiya beyond the name it puts in the file.
The contract
The host drops
handoff.jsonbeside the manifest and opens the panel:{ "app": "Testeiya", "baseUrl": "https://app.testomat.io", "projectId": "my-project", "jwt": "eyJ…", "projectToken": "tstmt_…", "runUrl": "https://app.testomat.io/projects/my-project/runs/abcd1234", "at": 1756160000000 }Two credentials because the panel talks to two APIs:
projectTokenis what/api/v2takes,jwtis a web session for the routes v2 lacks.runUrlis optional.atis milliseconds and has to grow on every push.A file rather than a command line:
--load-extensionargv is readable by every process on the machine, and these are credentials. A panel already open takes a new push throughwindow.TestomatHandoff.apply(), which answers{ok, projectId, run}so the host can report the result; a build without that global predates this contract.Beside a token the tester pasted
An offer overlays the ordinary sign-in, it never replaces it. Their General token and their preferences are kept, and each request uses whichever credential fits — the project token on the project it was issued for, their own token anywhere else, the handed session for the web API. So the project switcher stays open for a tester who has their own token and is pinned for one who does not, and when the host closes its browser the panel keeps working on their token instead of falling back to nothing.
jwtis never stored. It lives in memory exactly like the onePOST /api/loginreturns, and is re-read from the file on every panel load — which is why the file stays until the host that wrote it deletes it. Disconnect can't delete a file it doesn't own, so it marks thatatanswered and a newer push wins.Also here
openRunFromUrlnow reports whether it actually landed the panel on a view. A run that 404s used to leave the panel showing nothing at all — reachable today through "Run in Extension", and reachable more often once a host is pushing runs.Checked
Driven against a real project on a real instance: cold boot, a live poke switching runs in place, both API surfaces answering, decline-then-newer-push, a handoff landing on top of an existing token and the fallback after the file goes. With no host involved the panel logs one
ERR_FILE_NOT_FOUNDforhandoff.jsonat boot — that is the check for the file, not a fault.🤖 Generated with Claude Code