Repository navigation
feat(bridge): expose per-install id to the hosted frontend #1765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
synap5e
wants to merge
5
commits into
main
Choose a base branch
from
synap5e/feat/desktop-install-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+140
−2
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
78150d4
feat(bridge): expose per-install id to the hosted frontend (OBL-219)
synap5e c20447c
chore(bridge-types): bump to 0.6.0 for the getInstallId addition
synap5e b82bfaf
fix(bridge): only give the install id to cloud pages, and only a mach…
synap5e 78b0b61
fix(bridge): require a trusted-cloud main frame for the install id
synap5e 1381307
fix(bridge): compare the install-id sender frame by process and routi…
synap5e File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue:
getInstallId()is typed as returningstring, and the preload casts withas string, but there are two paths here that do not produce an install id.Unregistered handler.
ipcRenderer.sendSyncon a channel with no listener leavesevent.returnValueunset and resolves toundefined. This handler is registered insideregisterDownloadHandlers(), called atsrc/main/index.ts:2211. If the hosted frontend can reach the bridge before that call runs, the cast silently yieldsundefinedand the frontend putsundefinedinto a header.Pre-init fallback, which worries me more. The comment on this block says "getDeviceId() is safe post-initDeviceId()", but nothing in this file enforces that — it is an assumption about startup ordering held in a comment. And
deviceId.tsis explicit about what happens when the assumption does not hold: "It must only be called afterinitDeviceId()has resolved; if called earlier it falls back to a random UUID flagged as'random_fallback'."That failure is silent and points the wrong way. A random UUID is a perfectly well-formed string, so nothing downstream notices — cloud receives a valid-looking
X-Comfy-Install-Idthat is different on every launch, and the attribution this feature exists for quietly stops working while every dashboard still shows data. The description says the frontend reads this "inline while building request headers", so the first requests after launch are precisely where a race would land.I could not prove the race is reachable without tracing the full startup against window creation, so I am not claiming it fires today. The ask is to make the contract honest rather than ordering-dependent: return
undefined(or an explicit sentinel) when the id is not yet initialised and let the frontend omit the header, rather than returning something indistinguishable from a real id.getIdClass()is already exported next door and would let this answer "not ready" precisely. The preload signature and the.d.tswould then wantstring | undefined, which the frontend is already prepared for since it feature-detects the method anyway.The new test covers the happy path well. A case for "id not initialised" would pin whichever behaviour you choose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the return type: agreed. It now returns the id only when it's machine-derived and omits it otherwise, typed
string | undefined, with a test. Done in b82bfaf.