chore(host-papp): add console.info diagnostics for SSO request flow#156
Open
duewarn wants to merge 1 commit into
Open
chore(host-papp): add console.info diagnostics for SSO request flow#156duewarn wants to merge 1 commit into
duewarn wants to merge 1 commit into
Conversation
Adds structured logs across the lifecycle of a remote-signer request issued by `userSession`: - `signPayload` / `signRaw` / `getRingVrfAlias` each log on entry (`queueing in requestQueue`), when the inner queue task starts (`task RUNNING — messageId=...`), when the request statement has been submitted to chain (`request submitted — waiting for response`), and when a matching response arrives (`response RECEIVED`). - The per-call `responseFilter` logs a single `MATCH` line on the exact statement that resolves the wait, instead of being silent. - `subscribe(callback)` classifies each batch of incoming statements into "relevant" (responding to a messageId we are still waiting on) and "stale" (typically a response from a previous session, since bulletin paseo retains statements for ~7 days). The header line reports both counts; details are printed only for the relevant subset, so a freshly opened session that sees dozens of historical responses no longer produces a wall of text. - `withQueueTimeout` logs the freed-queue event so a stuck signer doesn't fail silently. - `auth/impl.ts` calls the optional `globalThis.__registerStatementStoreTopicLabel` hook with a `handshake` label for the handshake topic, complementing the `peer-incoming` / `self-outgoing` labels registered by statement-store (any host-side wrapper around `subscribeStatements` can render readable subscription IDs from these labels). Tracking of pending message ids is module-level (single `Set<string>` shared by all sessions of the package). `messageId` values come from `nanoid()` and are unique across sessions, so the shared set has no risk of false positives even with several SSO sessions running. No behaviour change.
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.
Summary
Adds structured logs across the lifecycle of a remote-signer request issued by
userSession.Logs added in
userSession.tsFor each of
signPayload/signRaw/getRingVrfAlias:queueing in requestQueueon call entry (before pool admission)task RUNNING — messageId=...when the inner queue task actually starts (queue admitted)request submitted — waiting for response messageId=...after the request statement reaches chainresponse RECEIVED — messageId=...when the matching response arrives<method> filter] MATCH expected=... respondingTo=...from the per-callresponseFilteron the exact statement that resolves the waitwithQueueTimeoutlogs the freed-queue event so a stuck signer doesn't fail silently.Stale-message classification
subscribe(callback)now classifies each batch of incoming statements into:respondingTomatches a messageId we are still waiting on (tracked in a module-levelSet<string>)The header line reports both counts; details are only printed for the relevant subset. A freshly opened session that sees dozens of historical responses no longer produces a wall of text.
Handshake topic label
auth/impl.tscalls the optionalglobalThis.__registerStatementStoreTopicLabelhook with ahandshakelabel, complementing thepeer-incoming/self-outgoinglabels registered by statement-store. A host-side wrapper aroundsubscribeStatementscan render readable subscription IDs from these labels (e.g.sub#1[handshake]).Notes on shared state
pendingExpectedMessageIdsis module-level (a singleSet<string>shared by all sessions of the package).messageIdvalues come fromnanoid()and are unique across sessions, so the shared set has no risk of false positives even with several SSO sessions running.Related
chore/signing-flow-logs— installs the topic-label hook on host startup.Test plan
vitest run packages/host-papp— 22 passednx run @novasamatech/host-papp:build) — clean