Skip to content

feat(package-vulnerability-scanner): scan as the signed-in viewer - #454

Draft
amylin1249 wants to merge 8 commits into
pvs-01-test-toolingfrom
pvs-02-viewer-identity
Draft

feat(package-vulnerability-scanner): scan as the signed-in viewer#454
amylin1249 wants to merge 8 commits into
pvs-01-test-toolingfrom
pvs-02-viewer-identity

Conversation

@amylin1249

@amylin1249 amylin1249 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Split out of #428 into small, reviewable PRs (tracking issue #415). Stacked 2/10 — stacked on #453, merge bottom-up.

Every endpoint now calls Connect as the signed-in viewer (via their session token) instead of the deploying publisher, moves the blocking SDK calls off the event loop, and bounds them with a timeout+retry so an unresponsive Connect server can't hang a request indefinitely. Endpoint shapes are unchanged here; the packages endpoint's batch rework is a later PR.

Two deadlines, bounding different things:

  • CONNECT_API_TIMEOUT_SECONDS (30s) caps how long a caller waits before retrying.
  • CONNECT_REQUEST_TIMEOUT_SECONDS (60s) is a read timeout on the SDK's own session, supplied through a requests adapter. asyncio.to_thread can stop waiting on a stuck call but can't interrupt it, so without this the abandoned threads accumulate and eventually starve the pool. A request that hits it is retried like any other transient failure. Verified against a socket server that accepts and then goes silent: raises ReadTimeout at the deadline, where the unpatched session was still hanging.

requests is now a declared dependency, since main.py imports it directly.

@github-actions

Copy link
Copy Markdown
Contributor

Extension release summary

😴 Changed but won't release

The following extensions have code changes but the manifest version hasn't been incremented:

  • package-vulnerability-scanner: manifest version 3.0.6 ≤ released version 3.0.6

If you intended to release these changes, update the version field in each extension's manifest.json.

See the contributing guide for details.

@amylin1249
amylin1249 marked this pull request as draft July 31, 2026 15:43
Connect API calls now run as the signed-in viewer via their per-request
session token, instead of the deploying publisher, so each person sees the
content they published and their own name. Requires a Connect Visitor API
Key integration (added to requiredFeatures).

Every Connect call also moves off the event loop (asyncio.to_thread) and
gets a bounded timeout with retry-on-transient-failure: the SDK sets no
request timeout of its own, so an unresponsive server would otherwise hang
the calling task indefinitely. A timeout is retried the same as a 5xx before
giving up.

Endpoint shapes are unchanged in this PR (packages is still one request per
content item); that rework is a separate PR.
astral-sh/setup-uv doesn't publish a bare "v9" major-version alias (only
"v9.0.0" exists), so @v9 failed to resolve and every job needing it never
started.
@amylin1249
amylin1249 force-pushed the pvs-02-viewer-identity branch from 62f3e1a to 79f9a69 Compare August 1, 2026 01:46
amylin1249 and others added 4 commits July 31, 2026 22:33
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… cache

Running the new backend suite leaves a .pytest_cache that git ignores via its
own generated file but prettier still walks, so check-format failed after
pytest. Listed alongside .venv, which is ignored for the same reason.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…line

The SDK sets no timeout on its session, so a Connect server that accepts a
connection and then goes quiet hangs the calling thread forever. asyncio can
stop waiting on those calls but cannot interrupt them, so the threads pile up
and eventually starve the pool. A session adapter supplies a default read
timeout through requests' own extension point, and a request that hits it is
retried like any other transient failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@amylin1249
amylin1249 force-pushed the pvs-02-viewer-identity branch from 82f26ba to 0751bb0 Compare August 1, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant