Skip to content

fix(backend): resolve verified issues #111 #127 #122 #109 #114 - #152

Merged
devin-ai-integration[bot] merged 5 commits into
mainfrom
devin/1795353341-backend-issues
Nov 22, 2026
Merged

devin-ai-integration[bot] merged 5 commits into
mainfrom
devin/1795353341-backend-issues

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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's snapshot_json) was still called from history_cmd, stats_cmd, workspace_cmd, and cli_common just to count or list scans. All four now use bounded ScansPage calls; Scans() is documented as tests/dumps only.

#127 — checksum-only updates were silent. When no release signing key is compiled in, /api/v1/update used to accept an unsigned release with no signal. staged now logs a WARN ("update verification was CHECKSUM-ONLY ...") and the response carries signed: false + a warning field, 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. WriteTimeout stays 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 in exportDeadline, which sets a 5-minute absolute SetWriteDeadline per 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. reportModel loaded the previous scan's complete rows — every message, remediation, and metadata_json unmarshal — to feed scans.Compare, which only reads fingerprint/analyzer/path for the old side. It now uses FindingIdentities for 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 existing queued state and parks it in a bounded FIFO (MaxScanQueue = 32); drainQueue runs from each finishing run's cleanup before runs.Done(), starting 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. Tests split accordingly: TestConcurrentScanCapQueuesBeyondCapacity (FIFO accept + drain) and TestScanQueueOverflowStillRejects (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

Devin Review

…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.
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

…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).

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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