feat(assessment): record capture hints and keep one window per attempt
This commit is contained in:
1 parent
c975a0d506
commit
bb917bf62e
108 files changed
+6649
-139
No files matched your search
@@ -1199,6 +1199,40 @@ func (UnimplementedHandler) HideOrganization(ctx context.Context, params HideOrg
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// HoldMyAssessmentWorkSession implements HoldMyAssessmentWorkSession operation.
|
||||
//
|
||||
// Requires a candidate session, its CSRF token in X-CSRF-Token, an allowed Origin, and the
|
||||
// `X-Attempt-Client` header of the page. A real attempt (`root` or `corrective`) allows one open page
|
||||
// at a time. The page that works on the attempt calls this operation when the candidate starts or
|
||||
// resumes work and then repeats it every `renew_after_seconds`; each call holds the work session until
|
||||
// `held_until`.
|
||||
//
|
||||
// - If nobody holds the work session, the previous holder released it, or its hold expired, the page
|
||||
// becomes the holder and the answer is 200.
|
||||
// - If the same page holds it, the hold is renewed and the answer is 200.
|
||||
// - If another page holds it, the answer is 409 `state_conflict` and nothing changes: the second page
|
||||
// is refused until the first one releases the session (ReleaseMyAssessmentWorkSession) or stops
|
||||
// renewing and its hold expires. The client tells the candidate that the attempt is open in another
|
||||
// window and does not show the task.
|
||||
//
|
||||
// The same 409 answers a terminal or expired attempt and a `demo_express` attempt, which has no
|
||||
// protected work session. The hold is a one-page-at-a-time rule, not a lock on the candidate: a
|
||||
// candidate who closes a page, reloads, or opens the attempt on another device can continue when the
|
||||
// hold is released or has expired (at most two minutes after the last renewal). It is not a security
|
||||
// boundary: a client that never calls this operation is refused only while another page holds the
|
||||
// session. The server stores one-way keyed digests of the page identifier and of the User-Agent, bound
|
||||
// to the attempt; it never stores or returns either value. A change of the User-Agent digest during an
|
||||
// attempt is a weak server signal for a manual review, never an automatic decision.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the attempt (404 not_found for an unknown attempt or one of
|
||||
// another candidate), then the hold (409 state_conflict).
|
||||
//
|
||||
// PUT /api/v1/me/assessment-attempts/{attempt_id}/work-session
|
||||
func (UnimplementedHandler) HoldMyAssessmentWorkSession(ctx context.Context, params HoldMyAssessmentWorkSessionParams) (r HoldMyAssessmentWorkSessionRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyAssessmentResults implements ListMyAssessmentResults operation.
|
||||
//
|
||||
// Requires a candidate session. Returns only completed root and corrective results owned by this
|
||||
@@ -1719,6 +1753,24 @@ func (UnimplementedHandler) RegisterAccount(ctx context.Context, req *Registrati
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ReleaseMyAssessmentWorkSession implements ReleaseMyAssessmentWorkSession operation.
|
||||
//
|
||||
// Requires a candidate session, its CSRF token in X-CSRF-Token, an allowed Origin, and the
|
||||
// `X-Attempt-Client` header of the page. The page calls it when it closes, so that the candidate can
|
||||
// open the attempt in another window at once instead of waiting for the hold to expire. The request is
|
||||
// idempotent and reveals nothing: it answers 204 whether this page held the session, another page
|
||||
// holds it (which stays held), nobody held it, or the attempt is not held at all, and a repeat after a
|
||||
// lost response succeeds. A page that is killed without calling it loses the hold within two minutes.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden), the attempt (404 not_found for an unknown attempt or one of
|
||||
// another candidate), then the release (204).
|
||||
//
|
||||
// DELETE /api/v1/me/assessment-attempts/{attempt_id}/work-session
|
||||
func (UnimplementedHandler) ReleaseMyAssessmentWorkSession(ctx context.Context, params ReleaseMyAssessmentWorkSessionParams) (r ReleaseMyAssessmentWorkSessionRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// RequestMyAccountDeletion implements RequestMyAccountDeletion operation.
|
||||
//
|
||||
// Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The
|
||||
@@ -2121,6 +2173,12 @@ func (UnimplementedHandler) SetMySearchStatus(ctx context.Context, req *SearchSt
|
||||
// start a session or commit a due transition. A background transition may persist a due outcome
|
||||
// independently; after that, this command returns the stored terminal attempt without changing it.
|
||||
//
|
||||
// One page at a time. While another page holds the work session of this attempt
|
||||
// (HoldMyAssessmentWorkSession), a request from a different `X-Attempt-Client`, or from none, answers
|
||||
// 409 `state_conflict` and changes nothing; the client tells the candidate that the attempt is open in
|
||||
// another window. That refusal is not stored under the Idempotency-Key, because it lasts only until
|
||||
// the other page closes or stops renewing. A real attempt that nobody holds is not refused.
|
||||
//
|
||||
// The attempt must belong to the candidate of the session. An attempt of another candidate answers 404
|
||||
// not_found, the same as an unknown identifier. An employer account answers 403 forbidden; no
|
||||
// operation gives an employer answers, qualification evidence, or attempt history.
|
||||
@@ -2159,6 +2217,11 @@ func (UnimplementedHandler) StartMyAssessmentAttemptSession(ctx context.Context,
|
||||
// public examples are unlimited apart from the sandbox rate limit and never show hidden group results;
|
||||
// they are planned as a separate operation.
|
||||
//
|
||||
// One page at a time. While another page holds the work session of this attempt
|
||||
// (HoldMyAssessmentWorkSession), a request from a different `X-Attempt-Client`, or from none, answers
|
||||
// 409 `state_conflict` and stores nothing, so a second window cannot answer. That refusal is not
|
||||
// stored under the Idempotency-Key and is checked before the stored answer is replayed.
|
||||
//
|
||||
// Repeats and conflicts, per item:
|
||||
//
|
||||
// - A retry with the same Idempotency-Key and body within 24 hours replays the stored response.
|
||||
|
||||
Reference in new issue
Block a user