Repository navigation
fix(backend): resolve verified issues #111 #127 #122 #109 #114 - #152
Merged
Merged
Conversation
…date warning - #111: workspace show/stats/history and scan resolution now read one bounded ScansPage page instead of loading the workspace's entire unbounded scan history; Scans() documents itself as tests/dumps-only - #122: exportDeadline wraps the heavy non-streaming export routes (csv/json/jsonl/md/sarif/html/suppressions.csv) with an absolute write deadline so a stalled reader can't hold a handler and its DB slot forever; SSE stays deadline-free - #127: when no release signing key is compiled in, the update endpoint logs a WARN and returns a warning field instead of silently accepting a checksum-only verified release
The report model loaded the previous scan's complete findings — every message, remediation and metadata_json unmarshal — to compute a fingerprint comparison that only reads fingerprint/analyzer/path. On the demo's large preset that's ~42k rows decoded for nothing; FindingIdentities skips both the ORDER BY and the heavy columns, so a report request now buffers one scan's rows, not two.
A fourth concurrent scan used to be an outright ErrTooManyScans -> 503 the user had to retry by hand. start() now creates the scan row (the existing 'queued' lifecycle state) and parks it in a bounded FIFO (MaxScanQueue = 32); drainQueue, called from every finishing run's cleanup before runs.Done(), starts the oldest waiter into the freed slot. Queued scans register a cancels wrapper that drops them from the queue and ends the row 'cancelled', so Cancel and Shutdown need no second path; rows still queued across a restart reconcile to 'interrupted' via the existing startup pass. Only a full queue is a 503 now.
…ines - TestConcurrentScanCapRejectsBeyondCapacity asserted the old hard-503: split it into TestConcurrentScanCapQueuesBeyondCapacity (FIFO accept + drain) and TestScanQueueOverflowStillRejects (full queue still 503). - exportDeadline now skips writers where ResponseController reports ErrUnsupported (httptest recorders, non-HTTP/1 transports) instead of failing the request — the deadline guards real sockets.
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This was referenced Nov 22, 2026
[backend] Report endpoints load the entire findings table of BOTH scans into memory per request
#109
Closed
…otal - start() drains the queue after enqueueing: a slot can free during snapshot+row creation, and only finishing runs used to drain — the queued scan would strand behind an idle service (review BUG_0001). - drainQueue passes entry.ctx to run() instead of minting a new context: the cancels wrapper left in place then cancels the context run actually uses, and a Cancel landing between pop and launch can no longer hit a discarded ctx. Entries whose ctx cancelled between pop and check are finalized as cancelled instead of stranded (review BUG_0002). - workspace show printed len(scans) of a one-row page; it now prints the real count (review BUG_0003).
This was referenced Nov 22, 2026
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
Resolves the verified backend issues re-filed after the #128 sweep. Each fix addresses the actual problem the re-verification flagged, per the per-issue triage in each thread.
#111 — unbounded scan-history loads.
Scans()(full history, every row'ssnapshot_json) was still called fromhistory_cmd,stats_cmd,workspace_cmd, andcli_commonjust to count or list scans. All four now use boundedScansPagecalls;Scans()is documented as tests/dumps only.#127 — checksum-only updates were silent. When no release signing key is compiled in,
/api/v1/updateused to accept an unsigned release with no signal.stagednow logs a WARN ("update verification was CHECKSUM-ONLY ...") and the response carriessigned: false+ awarningfield, so the UI and CLI can surface that the archive was checksum-verified only. Accepting unsigned stays intentional per the issue thread — the gap was silence, not policy.#122 — heavy routes could hold a socket forever.
WriteTimeoutstays unset deliberately (it would kill SSE streams). Instead, non-streaming export/report endpoints (findings.csv|json|jsonl,report.md|sarif|html,suppressions.csv) are wrapped inexportDeadline, which sets a 5-minute absoluteSetWriteDeadlineper request — bounding stalled readers without touching streams. Writers that can't take a deadline (errors.ErrUnsupported, e.g.httptest) are served without one.#109 — report model buffered both scans' full findings.
reportModelloaded the previous scan's complete rows — every message, remediation, andmetadata_jsonunmarshal — to feedscans.Compare, which only reads fingerprint/analyzer/path for the old side. It now usesFindingIdentitiesfor the previous scan: a report request buffers one scan's rows, not two.#114 — capacity was a hard 503. The 4th concurrent scan used to be an outright
ErrTooManyScans.start()now creates the row in the existingqueuedstate and parks it in a bounded FIFO (MaxScanQueue = 32);drainQueueruns from each finishing run's cleanup beforeruns.Done(), starting the oldest waiter into the freed slot. Queued scans register acancels[]wrapper that drops them from the queue and ends the rowcancelled, soCancelandShutdownneed no second path; rows still queued across a restart reconcile tointerruptedvia the existing startup pass. Only a full queue is a 503. Tests split accordingly:TestConcurrentScanCapQueuesBeyondCapacity(FIFO accept + drain) andTestScanQueueOverflowStillRejects(queue bound).Not in this PR per the issue threads: #102 (god-file split) and #104 (tx.Rollback helper) — each marked for its own focused change; #110 (context-lifetime wiring) and #113 (cookie session redesign) — deferred by maintainer decision.
Link to Devin session: https://app.devin.ai/sessions/6097ce99210a4b978fb1b1e6547bf3f5
Open in Devin Desktop: https://app.devin.ai/desktop/session/6097ce99210a4b978fb1b1e6547bf3f5?variant=devin
Requested by: @sanketpatel32
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work