Repository navigation
Stop SSE streams leaking on cancel, keep network capture to its own session, and read code fences like GitHub in the docs link checker - #4193
Conversation
…ion, and read fences like GitHub in the docs link checker createSseEndpoint now cleans up when the client cancels the stream, when the request is already aborted before start, when abort fires during subscribe, and when subscribe throws. A throwing unsubscribe no longer stops the stream from closing. Network capture ties each response listener to its session, so a response that was still loading at stop, restart or clear is not pushed afterwards. lib/doc-links.ts closes a fence only on a bare line with the same marker that is at least as long, treats a backtick line with backticks after the marker as inline code, gives repeated headings github-slugger's suffixes, and no longer reports a file named like ..notes.md as outside the repository. Across the repository's tracked Markdown this reports 6 fewer broken links than main and no new ones.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thanks @ramybarsoum for the careful tests. We're closing this one. On main the SSE helper already tears a dead stream down on the next heartbeat or failed write, so a cancelled stream is released within one heartbeat interval instead of leaking for the session. The capture and link-checker cases don't change how gstack's workflows run today, so we'd rather not take a three-area change for them. If you have a case where a stream stays subscribed past the heartbeat, or a real doc the link gate misreports, please reply with it and we'll reopen. |
Live activity and inspector streams now release their subscriptions as soon as a client goes away, network capture keeps each session's responses to itself, and the docs link checker reads code fences the way GitHub renders them. That keeps the browser sidebar from leaking connections and keeps the docs link gate from reporting false broken links.
Why (in your own words)
Three places in gstack keep running after the thing they belong to has ended.
createSseEndpointonly cleaned up on the request's abort signal. A cancelled stream kept its subscription and heartbeat. A request that was already aborted still subscribed. A subscriber whoseunsubscribethrew stopped the stream from closing.network --capture stop, or started a new capture, was pushed into the buffer afterwards.# A,# A,# A-1), and reported a file named like..notes.mdas outside the repository.The fix ties each listener and subscription to its own session and cleans up on every way a stream can end. The link checker now follows CommonMark and github-slugger.
Live evidence
The new regression tests against
origin/main's source forlib/doc-links.ts,browse/src/sse-helpers.tsandbrowse/src/network-capture.ts, and then on this branch:I also ran
brokenLinksover every tracked.mdfile in the repo.origin/mainreports 203 broken links and this branch reports 197. The branch adds none, and the 6 it no longer reports are false positives indocs/troubleshooting.mdanchors.Scope
browse/src/sse-helpers.tsbrowse/src/network-capture.tslib/doc-links.tschangelog.d/fix-state-transition-races.mdbun run typecheck, which is clean.browse/test/sse-helpers.test.ts,browse/test/data-platform.test.ts,browse/test/server-sanitize-surrogates.test.ts,test/docs-only.test.tsandtest/docs-only-workflow.test.ts. 103 pass. The one failure istest/docs-only.test.ts"a wrong-case docs tree", which also fails onorigin/mainon a case-insensitive macOS disk.--capture stopruns are now dropped instead of arriving late. The countstopprints now matches what--exportwrites.clearCapturehas no production caller today. Its revision counter only protects the path the tests use.Liveness proof (required for external contributors)
Pending. @ramybarsoum will attach the
GSTACK PRscreenshot before marking this ready for review.Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)