-
Notifications
You must be signed in to change notification settings - Fork 671
perf(workbench): reuse scan matching inputs #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mldangelo-oai
merged 28 commits into
main
from
mdangelo/codex/contributor-scan-history-hardening
Aug 10, 2026
+74
−10
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
657a37e
fix: bound scan history matching
GautamSharma99 2a95b9b
fix: contain scan matching failures to a single batch
mldangelo 2e886e6
fix: keep scan history rendering total over workbench payloads
mldangelo 68f1583
fix: align the severity badge column in finding tables
mldangelo 1ac5da8
test: preserve failure containment across bounded history pages
mldangelo-oai c6440b0
fix: include informational findings in report.md projection
mangeshraut712 16f2bbf
fix: record findings held back by the reportable severity gate
mldangelo a326495
fix: preserve report severity policy and cross-platform validation
mldangelo-oai 8d6fa32
test: terminate synthetic login process after emitting its result
mldangelo-oai 6944c2e
fix: bound durable scan matching and freeze history snapshots
mldangelo-oai b4d0ee3
fix: preserve compatibility with cached scan comparisons
mldangelo-oai 4cc3b51
fix: bound reconciled scan matches and flush login test output
mldangelo-oai 313768a
fix: isolate rejected grouped scan matching optimizations
mldangelo-oai 142cc8b
fix: preserve cross-page scan predecessor batches
mldangelo-oai 3054e90
fix: bound concurrent scan-history matching inputs
mldangelo-oai 8ad7c14
fix: simplify and sanitize scan history rendering
mldangelo-oai 16010bc
chore: merge latest main into hardened scan history
mldangelo-oai e646a29
Merge branch 'main' into mdangelo/codex/contributor-scan-history-hard…
mldangelo-oai a89504e
fix: simplify bounded scan-history matching
mldangelo-oai 95f378b
fix: snapshot matching inputs and reconcile paginated uncertainty
mldangelo-oai e5f3a78
fix: bound comparison status and cached match pagination
mldangelo-oai c3f3d0a
fix: keep cached forced rematches bounded
mldangelo-oai a1bf38a
fix: bound scan comparison pages and stable matching snapshots
mldangelo-oai e3e0421
fix: merge main and simplify bounded scan history
mldangelo-oai 48e2165
refactor: simplify bounded scan history matching batches
mldangelo-oai 128cefa
Merge main and bound large scan comparison projection
mldangelo-oai ab4710e
perf(workbench): reuse scan matching inputs
mldangelo-oai 2a5ba07
Merge current main and preserve unbounded workbench output
mldangelo-oai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { spawnSync } from "node:child_process"; | ||
| import { tmpdir } from "node:os"; | ||
| import { join } from "node:path"; | ||
| import { expect, test } from "bun:test"; | ||
| import { PLUGIN_ROOT } from "./plugin-root.js"; | ||
|
|
||
| test("loads each scan's matching findings once across historical batches", () => { | ||
| const python = Bun.which("python3") ?? Bun.which("python") ?? Bun.which("py"); | ||
| expect(python).not.toBeNull(); | ||
| if (python === null) throw new Error("A Python interpreter is required."); | ||
|
|
||
| const probe = [ | ||
| "import argparse, json, sqlite3, sys", | ||
| "sys.path.insert(0, sys.argv[1])", | ||
| "import workbench_scan_history as history", | ||
| "connection = sqlite3.connect(':memory:')", | ||
| "connection.row_factory = sqlite3.Row", | ||
| "connection.executescript('''", | ||
| "CREATE TABLE security_targets (id TEXT, current_path TEXT);", | ||
| "CREATE TABLE scans (id TEXT, target_path TEXT, target_id TEXT, status TEXT, started_at TEXT);", | ||
| "CREATE TABLE scan_comparisons (before_scan_id TEXT, after_scan_id TEXT);", | ||
| "CREATE TABLE finding_occurrences (id TEXT, finding_id TEXT, scan_id TEXT, details_json TEXT, remediation TEXT, severity TEXT, summary TEXT, title TEXT);", | ||
| "CREATE TABLE finding_triage (occurrence_id TEXT, status TEXT, close_reason TEXT);", | ||
| "CREATE TABLE finding_locations (occurrence_id TEXT, relative_path TEXT, role TEXT, sort_order INTEGER);", | ||
| "''')", | ||
| "for index in range(3):", | ||
| " scan = f'scan-{index}'", | ||
| " connection.execute('INSERT INTO scans VALUES (?, ?, NULL, ?, ?)', (scan, sys.argv[2], 'complete', str(index)))", | ||
| " connection.execute('INSERT INTO finding_occurrences VALUES (?, ?, ?, ?, ?, ?, ?, ?)', (scan, scan, scan, '{}', 'fix', 'high', 'summary', 'title'))", | ||
| "queries = []", | ||
| "connection.set_trace_callback(queries.append)", | ||
| "backfilled = []", | ||
| "result = history.list_unmatched_scan_pairs(connection, argparse.Namespace(repository=sys.argv[2], force=False), backfill_finding_details=lambda _connection, scan: backfilled.append(scan['id']), read_coverage=lambda _scan: {})", | ||
| "print(json.dumps({'result': result, 'backfilled': backfilled, 'findingQueries': sum('FROM finding_occurrences AS occurrences' in query for query in queries)}))", | ||
| ].join("\n"); | ||
|
|
||
| const result = spawnSync( | ||
| python, | ||
| [ | ||
| "-I", | ||
| "-B", | ||
| "-c", | ||
| probe, | ||
| join(PLUGIN_ROOT, "scripts"), | ||
| join(tmpdir(), "codex-security-matching-fixture"), | ||
| ], | ||
| { encoding: "utf8", timeout: 10_000 }, | ||
| ); | ||
|
|
||
| expect(result.status).toBe(0); | ||
| expect(result.stderr).toBe(""); | ||
| expect(JSON.parse(result.stdout)).toMatchObject({ | ||
| backfilled: ["scan-0", "scan-1", "scan-2"], | ||
| findingQueries: 3, | ||
| result: { | ||
| scanCount: 3, | ||
| batches: [ | ||
| { afterScanId: "scan-1", beforeScans: [{ scanId: "scan-0" }] }, | ||
| { | ||
| afterScanId: "scan-2", | ||
| beforeScans: [{ scanId: "scan-0" }, { scanId: "scan-1" }], | ||
| }, | ||
| ], | ||
| }, | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.