feat: add stateless npm declaration indexing - #43
Conversation
| # Fail fast above this per-service-worker cap; npm-unit requests are never | ||
| # written to the Redis job queue. | ||
| concurrency: 8 | ||
| requestTimeoutMs: 45000 |
There was a problem hiding this comment.
🟠 High codeapi/values.yaml:69
npmUnit.requestTimeoutMs is only injected into the service-worker deployment, but the API forwarding path reads it via NPM_UNIT_REQUEST_TIMEOUT as well. Setting this Helm value above the API's default causes the API to abort the synchronous /internal/npm-unit request after ~46 seconds even though the worker is configured to wait longer, so longer timeouts silently don't take effect end-to-end. Inject the same value into the API container's environment (or use a separately configured forwarding timeout) so both sides honor the configured limit.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @helm/codeapi/values.yaml around line 69:
`npmUnit.requestTimeoutMs` is only injected into the service-worker deployment, but the API forwarding path reads it via `NPM_UNIT_REQUEST_TIMEOUT` as well. Setting this Helm value above the API's default causes the API to abort the synchronous `/internal/npm-unit` request after ~46 seconds even though the worker is configured to wait longer, so longer timeouts silently don't take effect end-to-end. Inject the same value into the API container's environment (or use a separately configured forwarding timeout) so both sides honor the configured limit.
| timedOut ? 'Registry request timed out' : 'Registry gateway was unavailable', | ||
| true, | ||
| ); | ||
| } finally { |
There was a problem hiding this comment.
🟠 High api/npm-unit.ts:183
The fetch timeout is cleared in the finally block right after fetch() resolves, before readBoundedTarball() reads the response body. A registry gateway that sends headers quickly but then stalls its chunked body leaves readBoundedTarball() waiting indefinitely — SANDBOX_NPM_UNIT_FETCH_TIMEOUT no longer bounds the fetch, so connections can accumulate. Keep the abort timer active through body consumption and pass controller.signal into readBoundedTarball so a stalled stream is still aborted.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @api/src/api/npm-unit.ts around line 183:
The fetch timeout is cleared in the `finally` block right after `fetch()` resolves, before `readBoundedTarball()` reads the response body. A registry gateway that sends headers quickly but then stalls its chunked body leaves `readBoundedTarball()` waiting indefinitely — `SANDBOX_NPM_UNIT_FETCH_TIMEOUT` no longer bounds the fetch, so connections can accumulate. Keep the abort timer active through body consumption and pass `controller.signal` into `readBoundedTarball` so a stalled stream is still aborted.
I implemented a stateless sandbox route for indexing the TypeScript declaration surface of exact npm packages without executing package code.
web-tree-sitter@0.24.7andtree-sitter-wasms@0.1.13.Change Type
Testing
npmUnit.enabled=true.Checklist