Skip to content

fix: separate window-blur from screenshot in integrity monitor - #143

Merged
barunaniket merged 3 commits into
mainfrom
feat/screenshot-flag
Aug 23, 2026
Merged

fix: separate window-blur from screenshot in integrity monitor#143
barunaniket merged 3 commits into
mainfrom
feat/screenshot-flag

Conversation

@vaibhavtulsian

Copy link
Copy Markdown
Collaborator

Problem
useIntegrityMonitor records a "screenshot" flag on any window.blur while the tab stays visible (

useIntegrityMonitor.ts:134–138
), lumping it together with actual PrintScreen key presses. This means:

Alt-tabbing to another app
Clicking the address bar
Focusing undocked DevTools
Moving to a second monitor
…all count as "screen capture" and eat into the 5-flag cap that drops a solver's score to base points. Legitimate multitasking gets penalized, and the "screenshot" bucket conflates real captures with generic focus loss.

Fix
Split "screenshot" into two distinct event types:
"screenshot" — only fires on PrintScreen keyup (actual screen capture)
"window-blur" — fires on window focus loss while tab is visible
Exclude window-blur from the flag total used for scoring — it's still recorded in the per-category breakdown for server-side review, but doesn't count toward the 5-flag cap
Update user-facing messages to honestly label each signal ("You left the window" vs "Screen capture detected")
Update the API route to accept the new event type without incrementing the penalty counter
Affected area
Arena solve workspace (/cp-arena/solve/) — ranked solves only (practice is unaffected).

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-chef-pesuecc-chapter Ready Ready Preview Aug 23, 2026 12:01pm

@barunaniket barunaniket left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @vaibhavtulsian, thanks for opening this PR!

A few issues were identified during review:

Missing Feature Code: The PR contains no code changes for the screenshot flag / issue points mentioned in the commit message.
Dependency Downgrade: drizzle-kit was downgraded from ^0.31.10 to ^0.18.1, which causes breaking incompatibilities with our current Drizzle ORM setup and introduces ~8,500 lines of lockfile churn.
Typecheck Exclusion: "drizzle.config.ts" should not be excluded from tsconfig.json.
Please revert the dependency changes in package.json, package-lock.json, and tsconfig.json, and ensure your actual implementation commits are included in the branch before requesting review again.

@barunaniket
barunaniket merged commit 31d4e2d into main Aug 23, 2026
3 checks passed
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.

2 participants