feat(evidence): project skill evidence from confirmed assessments

This commit is contained in:
shira committed 2026-10-09 11:25:19 +03:00
1 parent 4761508f13
commit c2a8d17195
94 files changed
+10077 -151

No files matched your search

+22 -1
View File
@@ -262,7 +262,7 @@ The signal notice (`assessment-signal-notice`) lists the signals collected durin
Access:
- The candidate comes only from the session; no operation takes a candidate identifier. An employer account answers 403 `forbidden`. An attempt of another candidate answers 404 `not_found`, the same as an unknown identifier, so attempt identifiers cannot be probed.
- No operation offers an employer answers, qualification evidence, attempt history, or anti-cheat signals. Employers will see only the current category through a separate projection.
- No operation offers an employer answers, attempt history, or anti-cheat signals. Employers see the current category on the anonymous card and the permitted skill evidence of that card ([Skill evidence](#skill-evidence)), never a result.
Modes and versions:
@@ -697,6 +697,27 @@ Open questions for the product owner and the lawyer:
No new problem code is added. `TestPrivacyOperationsFollowTheConventions`, `TestPublicationAndSearchStatusAreNotConsents`, `TestAnonymousCardReachesNoProfileOrContactSchema`, `TestGeneratedPrivacyDTOsCarryNoServerOwnedFields`, `TestPrivacySchemaValidationPrecedesImplementation`, and `TestPrivacyAccessBeforeImplementation` pin the generated server and the bundle, and `frontend/src/shared/api/privacy-contract.test.ts` pins the generated Zod rules, the absence of a consent, a time, a contact, or a salary in the request and card types, and the absence of settings in the organization, invitation, need, profile, and consent files.
### Skill evidence
The tag `evidence` describes the facts that confirmed assessments leave about a candidate's skills (FR06 in the PRD). It has two read operations; the logic behind them is implemented (see [architecture](../docs/en/ARCHITECTURE.md#skill-evidence)).
| Method and path | operationId | Protection | Success | Specific errors |
| --- | --- | --- | --- | --- |
| `GET /api/v1/me/evidence` | `ListMyEvidence` | session | 200 `EvidenceFactList`, `Cache-Control: no-store` | 400, 401, 403 `forbidden` |
| `GET /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}/evidence` | `GetOrganizationCandidateEvidence` | session | 200 `OrganizationEvidence`, `Cache-Control: no-store` | 400, 401, 403, 404 `not_found`, 429 |
Each operation also declares the problem response `default`. No new problem code is added.
- One event is one fact. `EvidenceFact` is a source event; `skills` are the tags of that event (a non-empty set), so a second tag never makes a second fact. `source` names the event and the immutable result (`event_id` and `result_id`, equal for an assessment because a result is keyed by its attempt; the candidate opens it at `GetMyAssessmentResult`).
- A claim is not a measurement. `kind` is `claim` (trust 0) or `measurement` (trust 1 to 3). `EvidenceTrustLevel` is an integer from 0 to 3; an online assessment without a reliable confirmation of the identity is trust 1, and repetition never raises it. Only measurements from assessments are produced today.
- What a fact says is `result`: the grade that was passed, the `basis` (`synthetic_demo`), and the `calibration_status` (`uncalibrated`), so the candidate never reads a demonstration category as a validated measurement. The organization projection and the preview carry both labels as well. A fact has no score, answer, item, failed attempt, or anti-cheat datum, and a failed attempt, a result without a reviewed category source, and a `demo_express` run produce no fact.
- `ListMyEvidence` lists only the caller's facts, newest event first, hidden facts included (`visibility` `hidden`), with the shared `limit` (1 to 100, default 20) and an opaque `cursor` bound to the candidate. A malformed or foreign cursor and a limit out of range answer 400; an employer account answers 403.
- `GetOrganizationCandidateEvidence` is a section of the anonymous card. It answers only while `GetOrganizationCandidateCard` would answer for the same handle and the card shows at least one category; every other case (unknown handle, handle of another organization, closed or revoked publication, hidden organization, minimum cohort, card without categories) is the same 404, so the answer reveals nothing the card does not. For each category of the card it returns one `OrganizationEvidenceFact`: the earliest visible assessment that passed exactly the confirmed grade, with only `skill`, `grade`, `trust`, `observed_year` (the year, UTC), and `basis` and `calibration_status` (`synthetic_demo`, `uncalibrated`; the same for every candidate, so they add no fingerprint and say the fact is a demonstration). A lower grade, a retake, the other tags, the source, the basis, the month, and every identifier stay with the candidate; at most nine facts, ordered by skill, and a hidden fact is absent. No key joins the answer to a person, but it is not unlinkable: with the other values of the card, the skill, grade, trust, and year can narrow a small pool, and the minimum cohort does not cover the year. The read consumes the card-view quota and appears in the access history with the field `categories`.
- The preview. `CardPreview.evidence` is the same section computed for the candidate (`OrganizationEvidence`, or null exactly when `card` is null), so the candidate sees what an organization would read with the `categories` field. It applies no organization or cohort, so an organization can receive less.
- Closed schemas and the privacy walk. Every evidence object has `additionalProperties: false` and requires all its properties. `TestNoOrganizationOperationReachesRawAssessmentData` (Go) and `test_evidence_is_closed_and_no_organization_operation_reaches_raw_assessment_data` (Python) walk every organization operation and `ListMyEvidence` through all references and fail on an assessment, signal, or review schema or on a raw answer, score, or failure property.
Open questions: whether the C2 consent text needs a new version now that publishing `categories` also sends one supporting assessment fact (skill, grade, trust level, year) to an organization - a decision for the owner and the lawyer, and the consent texts are not changed here; whether the evidence needs its own card field instead of the `categories` field; whether the year is the right precision for an employer; an operation for the candidate to hide or show a fact (the stored visibility exists, no operation changes it); and when claims of the profile and facts from other sources join the list.
### Generator checks
`testdata/openapi-3.2.0.yml` contains test operations that use the components above: pagination, Idempotency-Key, If-Match, ETag, and problem responses. ogen does not resolve external references, so the fixture keeps copies of the api/core components; `scripts/test_contract_copies.py` (part of `make -C api check`) checks that they, the fixture responses, and the ML `Problem` copy match api/core.