Files
lincodex/api/core/routes/support_cases.yml
T

123 lines
11 KiB
YAML

get:
operationId: ListMySupportCases
summary: List the support cases of the current account.
description: |-
Requires the session cookie of a candidate or an employer account. Returns a page of the cases that this account created, newest first by creation time with the identifier as the tie-breaker, with cursor pagination. Each item is a summary with the number, type, status, object reference, category, response target, and decision outcome; it has no description and no history, which GetMySupportCase returns with the full case. Cases of other accounts are never listed, including cases of other members of the same organization.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed `limit` or `cursor` answers 400 validation_failed. Filters by status and type are planned and add optional parameters.
security:
- sessionCookie: []
tags:
- support
parameters:
- $ref: ../components/parameters.yml#/PageLimit
- $ref: ../components/parameters.yml#/PageCursor
responses:
"200":
description: A page of the cases of the current account.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/SupportCaseList
examples:
last_page:
$ref: ../components/examples.yml#/SupportCaseListPage
"400":
$ref: ../components/responses.yml#/ValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
default:
$ref: ../components/responses.yml#/Problem
post:
operationId: CreateMySupportCase
summary: Open a support case, a complaint, an appeal, or a manual assessment request.
description: |-
Requires the session cookie, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The author is the account of the session; the body has no user, account, or organization field. A case is reachable from any screen, including a screen that denies access to an assessment: being refused an action never removes the path to a case about it.
The client sends only what the user states: `type`, a non-blank `description`, and the fields of the type. It never sets the status, the decision, the outcome, the priority, the response target, the rubric, the assignee, or the moderator: every variant has `additionalProperties: false`, so such fields answer 400. Attachments are not part of the MVP; they are planned as an optional field and change no existing one.
Types, accounts, and allowed references:
| Type | Accounts | Object reference | Other fields |
| --- | --- | --- | --- |
| `support` | candidate, employer | optional; `assessment_attempt` of the caller, an `organization` that the caller can see, an `invitation` addressed to the caller, or another `support_case` of the caller | optional `assessment_target` |
| `complaint` | candidate | required; an `organization` that the caller can see or an `invitation` addressed to the caller | required `complaint_reason`; `offer_content` and `salary_terms_violation` require an invitation |
| `grade_appeal` | candidate | required; `assessment_attempt` of the caller in a terminal state, so it has a result, or a `support_case` of the caller of type `manual_assessment` that is `resolved` with the outcome `assessed`, for a category that an expert assigned without an attempt | none |
| `anticheat_appeal` | candidate | required; `assessment_attempt` of the caller with an anti-cheat review decision | none |
| `manual_assessment` | candidate | optional; a prior `assessment_attempt` of the caller in the same specialization | required `assessment_target` |
An organization is visible to a candidate when it sent the candidate an invitation or when the organization contract (TASK-077) shows the candidate its profile, and to an employer account when the account has an active membership in it. Invitations are not in the contract yet, so until they are, every `invitation` reference answers 404 not_found; anti-cheat review decisions are not either, so until TASK-173 every anti-cheat appeal answers 409 state_conflict. The schema rejects an object type that the case type does not accept, for example an organization in a grade appeal.
Ownership of the reference: the server checks the object against the session account on every create. An unknown object and an object of someone else, such as another candidate's attempt, another account's case, or an invitation addressed to another person, both answer 404 not_found, so a reference never reveals whether a foreign object exists. An own case that a grade appeal cannot dispute, because it is not a manual assessment, is not resolved yet, or was resolved with another outcome, answers 409 state_conflict. An identifier that is not a UUID fails validation with the whole-body pointer, because the decoder does not record the path inside the selected variant. The case stores only the type and the identifier of the object.
Limits: an attempt and a resolved manual assessment each accept at most one grade appeal, and an attempt at most one anti-cheat appeal, in any status; a disagreement with the decision goes into a support case that references the appeal as `support_case`. A specialization accepts one open manual assessment, and an object accepts one open complaint; open means not `resolved` or `closed`. A second one answers 409 state_conflict. A grade appeal of an attempt that is still active also answers 409. Every create that passed authentication, validation, and the account scenario counts against a per-account limit from the product policy, including replays, 404, and 409, so the limit also bounds probing of references; over the limit the server answers 429 with Retry-After and creates nothing.
Description check: the schema pattern `\S` uses the ECMAScript white space set in both generated validators (ogen converts it for Go), so a description of spaces such as U+00A0 or U+3000 already fails validation with the pointer `/description`. ECMAScript white space omits U+0085 (NEL), which Go `unicode.IsSpace` includes, so the server also applies a domain check: a description whose every character is `unicode.IsSpace` or U+FEFF answers 400 validation_failed with the pointer `/description`. This check comes with the implementation; generated Zod accepts a description of NEL, and the server stays authoritative.
The new case gets a number and the status `submitted`. A grade appeal, an anti-cheat appeal, and a manual assessment are moved to `waiting_expert` by a `system` event in the same transaction, so the 201 already shows that status with both events; a support case and a complaint stay `submitted`. Each case gets a response target from the product policy version and the configured business calendar: 5 business days for a manual assessment and 10 for an appeal (PRD FR18 and C3), and a policy value for support and complaints. The target is an operational goal, not a deadline set by law. A manual assessment fixes the published rubric version of the category, or null when the category has none yet; the expert assesses with the same rubric as the automated assessment, and the request assigns no category by itself. Creating a case never grants, revokes, or changes a consent, a grade, or an attempt.
Replies: the case itself is the channel. Support replies and decisions appear in the public `history` and `decision`. The server may also notify the verified email address of the account that the case changed, with the case number and a link, never with the description, the reply, or assessment details. No request field names another address or contact, so the operation cannot send mail to an address that the user typed.
Idempotency: a retry with the same key and body within 24 hours replays the stored 201 with the same number and creates nothing, so a lost response never opens a second case. The replay is the snapshot stored at creation, following the repository convention; the client reads the current status and history with GetMySupportCase. 404 and 409 state_conflict are stored and replayed as well. A different body with the same key answers 422 idempotency_key_reused. 400, 403, and 429 are never stored.
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for an employer account with a type other than `support`), the per-account case limit (429), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with the pointer `/description` for a text of only Unicode spaces or `/object/type` for a complaint reason that requires an invitation), the object reference (404 not_found), then the state of the object and the limits (409 state_conflict). The general rate limit can answer 429 with Retry-After before any check.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- support
parameters:
- $ref: ../components/parameters.yml#/IdempotencyKey
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas.yml#/SupportCaseCreate
examples:
manual_assessment:
$ref: ../components/examples.yml#/SupportCaseCreateManualAssessment
own_grade_appeal:
$ref: ../components/examples.yml#/SupportCaseCreateGradeAppeal
appeal_of_manual_assessment:
$ref: ../components/examples.yml#/SupportCaseCreateCategoryAppeal
test_unavailable:
$ref: ../components/examples.yml#/SupportCaseCreateTestUnavailable
salary_terms_complaint:
$ref: ../components/examples.yml#/SupportCaseCreateComplaint
responses:
"201":
description: >-
The case was created, with the status `submitted` or, for an appeal
or a manual assessment, `waiting_expert`; or a retry with the same
Idempotency-Key replayed the stored creation response.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/SupportCase
examples:
manual_assessment:
$ref: ../components/examples.yml#/SupportCaseManualAssessmentCreated
"400":
$ref: ../components/responses.yml#/SupportCaseValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
"404":
$ref: ../components/responses.yml#/NotFound
"409":
$ref: ../components/responses.yml#/SupportCaseCreateConflict
"422":
$ref: ../components/responses.yml#/UnprocessableContent
"429":
$ref: ../components/responses.yml#/TooManyRequests
default:
$ref: ../components/responses.yml#/Problem