feat(assessment): record capture hints and keep one window per attempt

This commit is contained in:
shira committed 2026-10-11 13:16:52 +03:00
1 parent c975a0d506
commit bb917bf62e
108 files changed
+6649 -139

No files matched your search

+28
View File
@@ -68,6 +68,34 @@ AssessmentAttemptId:
type: string
format: uuid
example: 01928f7a-3c4d-7e5f-8a9b-0c1d2e3f4a5b
AttemptClient:
name: X-Attempt-Client
in: header
required: false
description: |-
Random identifier that one open page of the assessment attempt generates when it loads and keeps until it closes, 16 to 64 characters of `A-Za-z0-9_-`. It names the page that holds the single active work session of the attempt (see HoldMyAssessmentWorkSession). The server keeps only a one-way keyed digest bound to the attempt, never the value.
A request that omits the header counts as one anonymous client. It is refused with 409 `state_conflict` while another page holds the work session, and it is accepted while nobody does, so a client that predates the header keeps working until a page holds the session.
schema:
type: string
minLength: 16
maxLength: 64
pattern: "^[A-Za-z0-9_-]+$"
example: 7mK2pQx9Rt4vWc1Zb8NfYd3Ha6Js0LeG
AttemptClientRequired:
name: X-Attempt-Client
in: header
required: true
description: >-
The page identifier described at AttemptClient. It is required here
because the operation exists to hold or release the work session of one
page.
schema:
type: string
minLength: 16
maxLength: 64
pattern: "^[A-Za-z0-9_-]+$"
example: 7mK2pQx9Rt4vWc1Zb8NfYd3Ha6Js0LeG
OrganizationId:
name: org_id
in: path
+37
View File
@@ -736,6 +736,22 @@ AssessmentAttemptCommon:
$ref: '#/AssessmentPractice'
watermark:
$ref: '#/AssessmentWatermark'
AssessmentWorkSession:
type: object
description: The work session of a real attempt that the calling page holds. It is a one-page-at-a-time rule for the attempt, not a score or a signal, and it changes no result.
additionalProperties: false
required:
- held_until
- renew_after_seconds
properties:
held_until:
$ref: '#/Timestamp'
renew_after_seconds:
type: integer
format: int32
minimum: 1
maximum: 3600
description: How often the page repeats the hold. It is well below the hold time, so a page whose timer is slowed down in the background still renews before its hold expires.
AssessmentWatermark:
type: object
description: 'Visible mark of a real attempt. The client shows `code` with the current time as a faint tile over the task screen, so that a screenshot or a photo of the screen can be traced back to the attempt by an operator. The code is a keyed pseudonym derived on the server: it carries no name, contact, or identifier of the account, and it cannot be computed without the server secret. The task text of such an attempt also carries an invisible mark and interchangeable wordings chosen by the same secret; they change neither the meaning of a task nor its reference answer, and the client keeps the invisible characters out of the accessibility tree. Training runs (`demo_express`) carry no watermark. It is evidence for a manual review and an appeal, never an automatic decision.'
@@ -1744,6 +1760,7 @@ AssessmentSignalEvent:
- $ref: '#/AssessmentFocusLossSignal'
- $ref: '#/AssessmentClipboardSignal'
- $ref: '#/AssessmentFullscreenExitSignal'
- $ref: '#/AssessmentCaptureSignal'
discriminator:
propertyName: kind
mapping:
@@ -1752,6 +1769,8 @@ AssessmentSignalEvent:
paste: '#/AssessmentClipboardSignal'
cut: '#/AssessmentClipboardSignal'
fullscreen_exit: '#/AssessmentFullscreenExitSignal'
screenshot_key: '#/AssessmentCaptureSignal'
devtools_open: '#/AssessmentCaptureSignal'
AssessmentFocusLossSignal:
type: object
additionalProperties: false
@@ -1816,6 +1835,24 @@ AssessmentFullscreenExitSignal:
$ref: '#/AssessmentItemId'
occurred_at:
$ref: '#/Timestamp'
AssessmentCaptureSignal:
type: object
description: 'A hint that the screen may be captured or inspected. `screenshot_key` is a key or key combination that the browser saw and that usually takes a screenshot (PrintScreen, Cmd+Shift+3, 4, or 5 on macOS, Win+Shift+S); `devtools_open` is the result of a heuristic that guesses that the developer tools are open (a docked panel changes the window size, or the console reads an object). Both are weak: a browser does not see every screenshot, an operating system can take one without a key the page sees, a phone photo is invisible to the page, and the heuristic gives false positives. They lead to attention in a manual review at most, never to a score change, and they carry no measurement.'
additionalProperties: false
required:
- kind
- item_instance_id
- occurred_at
properties:
kind:
type: string
enum:
- screenshot_key
- devtools_open
item_instance_id:
$ref: '#/AssessmentItemId'
occurred_at:
$ref: '#/Timestamp'
AssessmentSignalBatch:
type: object
description: A bounded batch of client event metadata. The raw request body is limited to 32 KiB before decoding and the batch contains at most 50 events.
@@ -815,6 +815,28 @@ schemas:
$ref: "#/schemas/AssessmentPractice"
watermark:
$ref: "#/schemas/AssessmentWatermark"
AssessmentWorkSession:
type: object
description: >-
The work session of a real attempt that the calling page holds. It is a
one-page-at-a-time rule for the attempt, not a score or a signal, and it
changes no result.
additionalProperties: false
required:
- held_until
- renew_after_seconds
properties:
held_until:
$ref: "./common_schemas.yml#/schemas/Timestamp"
renew_after_seconds:
type: integer
format: int32
minimum: 1
maximum: 3600
description: >-
How often the page repeats the hold. It is well below the hold time,
so a page whose timer is slowed down in the background still renews
before its hold expires.
AssessmentWatermark:
type: object
description: >-
@@ -8,6 +8,7 @@ schemas:
- $ref: "#/schemas/AssessmentFocusLossSignal"
- $ref: "#/schemas/AssessmentClipboardSignal"
- $ref: "#/schemas/AssessmentFullscreenExitSignal"
- $ref: "#/schemas/AssessmentCaptureSignal"
discriminator:
propertyName: kind
mapping:
@@ -16,6 +17,8 @@ schemas:
paste: "#/schemas/AssessmentClipboardSignal"
cut: "#/schemas/AssessmentClipboardSignal"
fullscreen_exit: "#/schemas/AssessmentFullscreenExitSignal"
screenshot_key: "#/schemas/AssessmentCaptureSignal"
devtools_open: "#/schemas/AssessmentCaptureSignal"
AssessmentFocusLossSignal:
type: object
additionalProperties: false
@@ -88,6 +91,34 @@ schemas:
$ref: "#/schemas/AssessmentItemId"
occurred_at:
$ref: "#/schemas/Timestamp"
AssessmentCaptureSignal:
type: object
description: >-
A hint that the screen may be captured or inspected. `screenshot_key`
is a key or key combination that the browser saw and that usually takes
a screenshot (PrintScreen, Cmd+Shift+3, 4, or 5 on macOS, Win+Shift+S);
`devtools_open` is the result of a heuristic that guesses that the
developer tools are open (a docked panel changes the window size, or the
console reads an object). Both are weak: a browser does not see every
screenshot, an operating system can take one without a key the page
sees, a phone photo is invisible to the page, and the heuristic gives
false positives. They lead to attention in a manual review at most,
never to a score change, and they carry no measurement.
additionalProperties: false
required:
- kind
- item_instance_id
- occurred_at
properties:
kind:
type: string
enum:
- screenshot_key
- devtools_open
item_instance_id:
$ref: "#/schemas/AssessmentItemId"
occurred_at:
$ref: "#/schemas/Timestamp"
AssessmentSignalBatch:
type: object
description: >-