Skip to content

fix(review): correlate screenshot-table presence-mode evidence to the PR head SHA - #6467

Merged
JSONbored merged 1 commit into
mainfrom
fix/screenshot-table-gate-head-sha-correlation
Jul 16, 2026
Merged

fix(review): correlate screenshot-table presence-mode evidence to the PR head SHA#6467
JSONbored merged 1 commit into
mainfrom
fix/screenshot-table-gate-head-sha-correlation

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Fixes 1 confirmed adversarial-audit finding(s) in src/review/screenshot-table-gate.ts:

  • Screenshot-table gate's presence-mode check has no correlation to the PR's current head SHA, so a stale/superseded screenshot table satisfies a close-on-violation gate indefinitely (src/review/screenshot-table-gate.ts)

Each fix follows the audit's own verified failure scenario and root-cause analysis (2-independent-skeptic adversarial verification pass, both had to vote "confirmed").

Closes #6417

Test plan

  • Regression test(s) reproducing the audited failure scenario for each finding
  • Full local gate (npm run test:ci) green

… PR head SHA

The screenshot-table gate's PRESENCE-mode check (evaluateScreenshotTableGate)
was pure regex/string matching over the PR body with no tie to the PR's live
head SHA, unlike the bot-capture evidence path in the same function. A
before/after table pasted on an early push kept satisfying the gate forever,
even after later commits shipped a real visual regression the table never
pictured.

Presence-mode now fingerprints the exact before/after evidence (the
extracted image URLs) and correlates it to the head SHA it last satisfied
the gate at. A later push carrying the identical, unedited evidence
re-violates; genuinely new evidence (the contributor re-affirms after the
push) or a successful bot capture on the new head clears it again. The
checkpoint is persisted (mirrors visualCaptureSatisfiedSha's headSha-keyed
write) via a new markPullRequestScreenshotTablePresenceSatisfied call in the
maintenance planner, backed by a new pull_requests column/migration.

Mirrored the same change into the loopover-engine twin copy of this file to
keep engine-parity green, and added a regression test reproducing the
audited two-push scenario (table passes on push #1, then silently stays
stale through push #2 pre-fix).
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 16, 2026
@JSONbored
JSONbored merged commit 9bf58f6 into main Jul 16, 2026
15 checks passed
@JSONbored
JSONbored deleted the fix/screenshot-table-gate-head-sha-correlation branch July 16, 2026 09:32
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.59%. Comparing base (b09f262) to head (8c5230a).
⚠️ Report is 32 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/queue/processors.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6467      +/-   ##
==========================================
- Coverage   95.59%   95.59%   -0.01%     
==========================================
  Files         589      589              
  Lines       47025    47038      +13     
  Branches    14951    14955       +4     
==========================================
+ Hits        44952    44964      +12     
- Misses       1291     1292       +1     
  Partials      782      782              
Flag Coverage Δ
shard-1 44.24% <0.00%> (-0.02%) ⬇️
shard-2 36.64% <42.85%> (+<0.01%) ⬆️
shard-3 32.36% <0.00%> (-0.01%) ⬇️
shard-4 35.30% <42.85%> (+<0.01%) ⬆️
shard-5 31.01% <0.00%> (-0.01%) ⬇️
shard-6 45.44% <85.71%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...oopover-engine/src/review/screenshot-table-gate.ts 100.00% <100.00%> (ø)
src/db/repositories.ts 96.80% <100.00%> (+<0.01%) ⬆️
src/db/schema.ts 72.97% <ø> (ø)
src/types.ts 100.00% <ø> (ø)
src/queue/processors.ts 95.66% <66.66%> (-0.03%) ⬇️

glorydavid03023 pushed a commit to glorydavid03023/gittensory that referenced this pull request Jul 16, 2026
PR JSONbored#6454 (draft-pr-close-policy) and PR JSONbored#6467
(screenshot-table-gate-head-sha-correlation) both grabbed migration
number 0156, merging 23 minutes apart without seeing each other's
number. db:migrations:check now fails on main for every PR. Renumber
the later-merged one (JSONbored#6467) to the next free number.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

1 participant