Skip to content

Commit 0810fb3

Browse files
committed
fix(work-queue): isolate checkpoint replay and harden smoke gates
- Restore checkpoint records into fresh objects and snapshot new checkpoints, so replaying or appending never mutates the committed checkpoint (regression test in work_queue_replay.test.cjs). - Share getGitHubRequestId between the queue logger and the smoke monitor; tag only the monitor's own ledger failures with a private symbol so dependency errors cannot claim evidence status. - Prefilter vendored image-scan log lines with a fixed `case` before the full-line regexes. - Isolate conclusion-span and object-pack tests from host runner files, Git config and env limits. - Give the final gate's golangci-lint a 40m timeout; propagate impacted-test and `go test -list` failures from test-unit/test-impacted-go instead of reporting them as no tests.
1 parent 091ed8b commit 0810fb3

13 files changed

Lines changed: 397 additions & 106 deletions

‎.github/scripts/smoke_work_queue_monitor.cjs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// ownership comes from the dispatcher's own dispatch_next grants, and terminal
66
// state from each granted Claim (never from the Work, which a retry can reuse).
77

8+
// Same revision as the queue logger, so both apply one request-ID redaction rule.
9+
const { getGitHubRequestId, ownValue, validGitHubRequestId } = require("../../actions/setup/js/work_queue_logging.cjs");
10+
811
const POOL = "smoke-work-queue";
912
const EXPECTED_CLAIMS = 3;
1013
const DISPATCHER_WORKFLOW_ID = "smoke-work-queue-dispatcher.lock.yml";
@@ -17,21 +20,24 @@ const MAX_ARCHIVED_SEGMENTS = 6;
1720
const LEDGER_PATH = "work-queue.jsonl";
1821
const FULL_SHA = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
1922

23+
// Only this module's own ledger inconsistencies carry the tag; a caught dependency
24+
// error claiming `evidence: true` takes the redacted read-error path.
25+
const EVIDENCE = Symbol("smoke-monitor-evidence");
26+
2027
/** A ledger inconsistency, reported without its details. */
2128
function evidenceFailure(code) {
22-
return Object.assign(new Error(), { code, evidence: true });
29+
return Object.assign(new Error(), { code, [EVIDENCE]: true });
2330
}
2431

2532
/** Allowlisted summary of a failed read; messages, headers and bodies are withheld. */
2633
function safeError(operation, error) {
27-
if (error?.evidence === true) {
34+
if (error instanceof Error && Object.hasOwn(error, EVIDENCE)) {
2835
return { operation, status: null, code: error.code, category: "evidence", short_message: "Ledger evidence is missing or inconsistent.", correlation_id: null };
2936
}
3037
const status = Number.isInteger(error?.status) ? error.status : Number.isInteger(error?.response?.status) ? error.response.status : null;
3138
const rawCode = error?.code;
3239
const code = typeof rawCode === "string" && /^[A-Z0-9_]{1,32}$/.test(rawCode) ? rawCode : null;
33-
const rawRequestId = error?.response?.headers?.["x-github-request-id"] ?? error?.request?.requestId;
34-
const correlation_id = typeof rawRequestId === "string" && /^[A-Za-z0-9._-]{1,64}$/.test(rawRequestId) ? rawRequestId : null;
40+
const correlation_id = getGitHubRequestId(error) ?? validGitHubRequestId(ownValue(ownValue(error, "request"), "requestId")) ?? null;
3541
return {
3642
operation,
3743
status,

‎.github/workflows/daily-squid-image-scan.lock.yml‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/daily-squid-image-scan.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ post-steps:
170170
high_fix_found=false
171171
license_found=false
172172
while IFS= read -r line || [[ -n "$line" ]]; do
173+
case "$line" in
174+
*': error: [Critical]'*|*': error: [High]'*|*': warning: [High]'*|*': error: license policy violation:'*) ;;
175+
*) continue ;;
176+
esac
173177
[[ "$line" =~ $critical_pattern ]] && critical_found=true
174178
[[ "$line" =~ $high_fix_pattern ]] && high_fix_found=true
175179
[[ "$line" =~ $license_pattern ]] && license_found=true

‎Makefile‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ test-race:
118118
# Test impacted Go unit tests first for faster feedback (target budget: ~30s)
119119
.PHONY: test-unit
120120
test-unit:
121-
@echo "Running impacted Go unit tests first (time budget: $(TEST_UNIT_MAX_SECONDS)s)..."; \
122-
$(MAKE) --no-print-directory test-impacted-go CI_COVERAGE_ENABLED=0 GO_IMPACTED_TEST_MAX_SECONDS=$(TEST_UNIT_MAX_SECONDS) GO_IMPACTED_TEST_FALLBACK_MODE=$(TEST_UNIT_IMPACTED_FALLBACK_MODE) GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE=$(GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE); \
123-
if [ "$(TEST_UNIT_RUN_FULL)" = "1" ]; then \
121+
@echo "Running impacted Go unit tests first (time budget: $(TEST_UNIT_MAX_SECONDS)s)..."
122+
@$(MAKE) --no-print-directory test-impacted-go CI_COVERAGE_ENABLED=0 GO_IMPACTED_TEST_MAX_SECONDS=$(TEST_UNIT_MAX_SECONDS) GO_IMPACTED_TEST_FALLBACK_MODE=$(TEST_UNIT_IMPACTED_FALLBACK_MODE) GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE=$(GO_IMPACTED_TEST_SAMPLE_PER_PACKAGE)
123+
@if [ "$(TEST_UNIT_RUN_FULL)" = "1" ]; then \
124124
echo "TEST_UNIT_RUN_FULL=1 set; running full Go unit test suite after impacted tests."; \
125125
$(MAKE) --no-print-directory test-unit-all; \
126126
fi
@@ -505,7 +505,14 @@ test-impacted-go:
505505
echo "No impacted timing data available; running up to $$SAMPLE_PER_PACKAGE sampled top-level tests per impacted package."; \
506506
printf '%s\n' "$$CHANGED_GO_PACKAGES" | while IFS= read -r pkg; do \
507507
[ -z "$$pkg" ] && continue; \
508-
TEST_PATTERN=$$(go test -list '^Test' "$$pkg" 2>/dev/null | head -n "$$SAMPLE_PER_PACKAGE" | paste -sd'|' -); \
508+
TEST_LIST=$$(go test -list '^Test' "$$pkg"); \
509+
TEST_LIST_STATUS=$$?; \
510+
if [ "$$TEST_LIST_STATUS" -ne 0 ]; then \
511+
printf '%s\n' "$$TEST_LIST" >&2; \
512+
echo "Failed to list top-level tests in $$pkg (go test -list exit $$TEST_LIST_STATUS); not treating it as a package without tests." >&2; \
513+
exit 1; \
514+
fi; \
515+
TEST_PATTERN=$$(printf '%s\n' "$$TEST_LIST" | awk '/^Test[^[:space:]]*$$/' | head -n "$$SAMPLE_PER_PACKAGE" | paste -sd'|' -); \
509516
if [ -z "$$TEST_PATTERN" ]; then \
510517
echo "No top-level tests discovered in $$pkg; skipping sampled run for this package."; \
511518
continue; \

‎actions/setup/js/daily_squid_image_scan.test.cjs‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ fi
295295
"ghcr.io/github/gh-aw-node-other:v1:1:1: error: [Critical] CVE-2026-7777: package@1",
296296
`Running grype on ${vendored}`,
297297
...["Low", "Negligible", "Unknown"].map(severity => `${vendored}:1:1: info: [${severity}] CVE-2026-8888: package@1`),
298-
...vendoredFindings.map(finding => `${vendored}:1:1: ${finding}`),
299298
...Array(10000).fill(`${vendored}:1:1: info: [Low] CVE-2026-9999: package@1`),
300299
`syft scanned ${vendored}`,
300+
...vendoredFindings.map(finding => `${vendored}:1:1: ${finding}`),
301301
];
302302
const fixture = join(directory, "compile-output.txt");
303303
const log = `${lines.join("\n")}\n`;
@@ -313,6 +313,32 @@ fi
313313
}
314314
});
315315

316+
it("gates a late unterminated vendored Critical after earlier non-critical findings", () => {
317+
const directory = mkdtempSync(join(tmpdir(), "image-late-gate-"));
318+
try {
319+
const vendored = "ghcr.io/github/gh-aw-node@sha256:committed";
320+
const lines = [
321+
`${vendored}:1:1: warning: [High] CVE-2026-1111: openssl@1`,
322+
`${vendored}:1:1: warning: [Medium] CVE-2026-2222: zlib@1 (fix: 2)`,
323+
"ghcr.io/github/gh-aw-node-other:v1:1:1: error: [Critical] CVE-2026-7777: package@1",
324+
...Array(20000).fill(`${vendored}:1:1: info: [Low] CVE-2026-9999: package@1 progress`),
325+
`${vendored}:1:1: error: [Critical] CVE-2026-4444: openssl@1`,
326+
];
327+
const fixture = join(directory, "compile-output.txt");
328+
const log = lines.join("\n");
329+
expect(Buffer.byteLength(log)).toBeGreaterThan(500000);
330+
writeFileSync(fixture, log);
331+
const result = spawnSync("bash", ["--noprofile", "--norc", "-e", "-o", "pipefail", "-c", gate.replaceAll(scanLog, fixture)], { encoding: "utf8", timeout: 10000 });
332+
expect(result.error).toBeUndefined();
333+
expect(result.signal).toBeNull();
334+
expect(result.status, result.stdout + result.stderr).toBe(1);
335+
expect(result.stdout.match(/::error::/g)).toHaveLength(1);
336+
expect(result.stdout).toContain("Critical vulnerabilities");
337+
} finally {
338+
rmSync(directory, { recursive: true, force: true });
339+
}
340+
});
341+
316342
it("documents paginated native reads and runs fixed indexes before the shell-disabled agent", () => {
317343
expect(source).toContain("Use native file inspection");
318344
expect(source).toContain("use `view_range` to read successive ranges from each\noriginal log through its end");

0 commit comments

Comments
 (0)