Add strict current-tab session lookup for PTK_AGENT workflow methods#92
Open
k4sperski wants to merge 4 commits intoDenisPodgurskii:masterfrom
Open
Add strict current-tab session lookup for PTK_AGENT workflow methods#92k4sperski wants to merge 4 commits intoDenisPodgurskii:masterfrom
k4sperski wants to merge 4 commits intoDenisPodgurskii:masterfrom
Conversation
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.
Issues
Related to discussion in #85
Phase 3a of the PTK Agent integration.
Builds on the workflow wrapper from #90 and the DAST stop/stale-session fixes from #91
Description
PTK_AGENTworkflow methods now only see the session that belongs to the current tab.PTK_AUTOMATIONbehaviour is unchanged by default.What changed:
startScan(),scanStatus(),stopScan(),getFindings(), andexportFullReport()passsessionScope: "current-tab"to the background automatically_resolveSessionForRequest()instead of each doing their own tab/global lookupstarting,running, orstoppingsession is treated as busy —startScan()will reject until that session finishesstartScan()now verifies the new session is reachable before returning success, so startup failures surface immediately instead of on the next status pollscanStatus()with an explicitsessionIdthat is not found now returns a failure instead of silently mapping it to{ status: "none" }PTK_AUTOMATIONcan use the same strict lookup by passingsessionScope: "current-tab", but does not do so by defaultDesign choices:
PTK_AGENTandPTK_AUTOMATIONhave different defaults on purpose — agent callers get current-tab only, low-level callers keep the existing fallback chain so nothing breakssessionScopeoption) rather than adding separate strict APIs — fewer methods, same backward compatibilitystoppingstate blocks new starts. The tradeoff is you cannot restart immediately while a stop is in progress, but it prevents two sessions running in the same tab3aonly covers which tab a session belongs to. Status normalisation, human-readable error messages, and canonical status enums stay in phase3bso each piece can be reviewed on its ownautomationBridge.test.jscovers what the page-facing bridge sends and normalises,automation.test.jscovers how the background resolves sessions and applies lookup rules. Failures point straight to which layer brokeKnown limitations:
_resolveSessionForRequest()explicitly. A follow-up can tighten this so it is harder to skip.Demo
How Has This Been Tested?
29 new tests covering:
PTK_AGENTworkflow methodsstartScan()verification round-trip and early failure on startup errorsscanStatus()explicit sessionId lookup kept as failure when not foundstopAutomationSession()PTK_AUTOMATIONcompatibility behaviourstarting,running, andstoppingChecklist