feat(platform): add the notification inbox and deterministic match search

This commit is contained in:
shira committed 2026-10-09 13:14:46 +03:00
1 parent 5edff21d2d
commit 0b11021b16
169 files changed
+17083 -443

No files matched your search

+375 -2
View File
@@ -27,6 +27,8 @@ tags:
description: 'Visibility of the current candidate: the publication of the anonymous card (a setting that refers to the C2 consent of the ledger and never replaces it), the search status that is not a consent, the organizations that the candidate hides the profile from, the preview of the card, and the history of the settings and of the accesses. Everything is closed by default, and no change makes a candidate more visible than they chose. No schema here reaches a contact, a name, or the lowest salary.'
- name: evidence
description: 'Skill evidence derived from confirmed assessment results: one fact per source event with its skills, trust level, attribution, date, and visibility. The candidate reads their own facts; an organization reads only the permitted projection of a currently visible card. Raw answers, failures, and anti-cheat data are never part of it.'
- name: notification
description: 'The in-platform inbox of the current account: references to delivered events with a read state, in the candidate cabinet and in the cabinet of one organization. The inbox is the source of the delivery state inside the platform and never depends on email. It stores no text: the content of every item is resolved from the current source for the recipient on each read, and an item whose source is gone or no longer visible stays in the list without content.'
- name: consent
description: 'The consent ledger of the current account: the independent consents C1-C5 with their text versions, sources, states, and revocations. The ledger is append-only and returns only the caller''s own records.'
- name: support
@@ -1647,9 +1649,11 @@ paths:
The body selects either a Need's `requirements_version` snapshot or the current organization-visible bank with explicit filters. A need reference uses `Need.requirements_version`, not the general `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An empty bank filter searches all otherwise eligible specializations, returning each specialization separately.
A search reveals card content, so it is charged like card reads. The whole visible bank is ranked, but each group returns at most the versioned per-group limit and no total is returned. In the order `main`, `near`, `unconfirmed`, each newly revealed candidate is counted as a distinct card view of the organization (a candidate it already viewed inside the window costs nothing again, so repeating the search or opening the card afterwards does not charge twice) and appears in the candidate's access history with the fields actually returned. When the allowance ends, the entries already counted are returned and `truncated` is true; the flag is also true when a group exceeded its limit, and it carries no count. No new error is returned for an exhausted allowance.
Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a stable internal tie-breaker that is never returned. Their category and strength remain null, and they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or profile identifier.
The card context is limited to safe public fields: recognized stack tags, coarse experience, accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names `cohort_below_30`.
The card context is limited to safe public fields: recognized stack tags, coarse experience, accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names `cohort_below_30`. When the comparable real cohort of a category reaches the minimum, the percentile is still not computed (the organization-safe projection carries no theta), T stays the neutral 0.5, the percentile stays null, and `unknown_flags` names `percentile_not_computed`; the search does not fail.
A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an unknown organization or account without active membership answers 404 not_found. The response is `Cache-Control: no-store`.
security:
@@ -1689,6 +1693,8 @@ paths:
$ref: '#/components/examples/MLUnavailable'
cohort_below_30:
$ref: '#/components/examples/CohortBelow30'
truncated:
$ref: '#/components/examples/Truncated'
'400':
$ref: '#/components/responses/ValidationFailed'
'401':
@@ -2556,6 +2562,174 @@ paths:
$ref: '#/components/responses/TooManyRequests'
default:
$ref: '#/components/responses/Problem'
/api/v1/me/notifications:
get:
operationId: ListMyNotifications
summary: List the inbox of the current candidate.
description: |-
Requires the session cookie of a candidate account with a confirmed email. The recipient comes from the session, never from a request parameter, so the response holds only the caller's own items. Returns a page, newest delivery first with the identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
The inbox is the in-platform delivery state of a notification. An item exists as soon as the event reached the platform, whether or not any email was sent, and an email that failed or was never sent does not block it. The inbox stores a reference to the event, not its text: the `content` of every item is resolved from the current source for this recipient on this read. When the source is gone or the recipient may not see it now (for example the candidate hid the organization), the item stays in the list with `content` null, and no earlier text is shown. An event that is delivered twice is one item.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account answers 403 forbidden. A malformed `limit` or `cursor`, or a cursor of another account, answers 400 validation_failed.
security:
- sessionCookie: []
tags:
- notification
parameters:
- $ref: '#/components/parameters/PageLimit'
- $ref: '#/components/parameters/PageCursor'
responses:
'200':
description: A page of the inbox of the current candidate.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControlNoStore'
content:
application/json:
schema:
$ref: '#/components/schemas/NotificationList'
examples:
page:
$ref: '#/components/examples/NotificationListPage'
'400':
$ref: '#/components/responses/ValidationFailed'
'401':
$ref: '#/components/responses/Unauthenticated'
'403':
$ref: '#/components/responses/Forbidden'
default:
$ref: '#/components/responses/Problem'
/api/v1/me/notifications/{notification_id}/read:
post:
operationId: MarkMyNotificationRead
summary: Mark an item of the inbox of the current candidate as read.
description: |-
Requires the session cookie of a candidate account with a confirmed email, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The recipient comes from the session. The request has no body.
The command is idempotent by its effect: the first mark stores the read time and every repeat returns that first time, so it needs no Idempotency-Key. It never reads the source and returns no content, so marking an item whose content is no longer available still works. It changes no other item.
The general rate limit can answer 429 with Retry-After before any check.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed; an employer account answers 403 forbidden; an item of another account and an unknown identifier both answer 404 not_found, so identifiers cannot be enumerated. A `notification_id` that is not a UUID answers 400 validation_failed with the path pointer.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- notification
parameters:
- $ref: '#/components/parameters/NotificationId'
responses:
'200':
description: The read state of the item, newly set or repeated.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControlNoStore'
content:
application/json:
schema:
$ref: '#/components/schemas/NotificationReadReceipt'
examples:
read:
$ref: '#/components/examples/NotificationReadReceipt'
'400':
$ref: '#/components/responses/ValidationFailed'
'401':
$ref: '#/components/responses/Unauthenticated'
'403':
$ref: '#/components/responses/CsrfCheckFailedOrForbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/TooManyRequests'
default:
$ref: '#/components/responses/Problem'
/api/v1/organizations/{org_id}/notifications:
get:
operationId: ListOrganizationNotifications
summary: List the inbox of the current employer in one organization.
description: |-
Requires the session cookie of an employer account with a confirmed email and an active membership in `org_id`, whatever its role. The recipient comes from the session and the organization from the path and the membership that the server holds, never from the request. Returns only the items addressed to the caller in this organization, newest delivery first with the identifier as the tie-breaker, with cursor pagination. An item of the same account in another organization, and an item of another member, are never listed. The response is `Cache-Control: no-store`.
Items follow the rules of ListMyNotifications: the inbox stores a reference to the event, an email never blocks an item, and the `content` of every item is resolved from the current source for this recipient on this read. An employer sees content only while the membership is active.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden, and an employer account with an unconfirmed email answers 403 email_not_verified; an account without an active membership in the organization and an unknown organization both answer 404 not_found, so organizations cannot be enumerated. A malformed `org_id`, `limit`, or `cursor`, or a cursor of another account or organization, answers 400 validation_failed.
security:
- sessionCookie: []
tags:
- notification
parameters:
- $ref: '#/components/parameters/OrganizationId'
- $ref: '#/components/parameters/PageLimit'
- $ref: '#/components/parameters/PageCursor'
responses:
'200':
description: A page of the inbox of the current employer in the organization.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControlNoStore'
content:
application/json:
schema:
$ref: '#/components/schemas/NotificationList'
examples:
page:
$ref: '#/components/examples/NotificationListPage'
'400':
$ref: '#/components/responses/ValidationFailed'
'401':
$ref: '#/components/responses/Unauthenticated'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Problem'
/api/v1/organizations/{org_id}/notifications/{notification_id}/read:
post:
operationId: MarkOrganizationNotificationRead
summary: Mark an item of the inbox of the current employer in one organization as read.
description: |-
Requires the session cookie of an employer account with a confirmed email and an active membership in `org_id`, whatever its role, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The recipient comes from the session and the organization from the path and the server-side membership. The request has no body.
The command is idempotent by its effect and returns no content, like MarkMyNotificationRead. The item must belong to the caller in this organization.
The general rate limit can answer 429 with Retry-After before any check.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed; a candidate account answers 403 forbidden, and an employer account with an unconfirmed email answers 403 email_not_verified; an account without an active membership in the organization, an unknown organization, an item of another account, an item of another organization, and an unknown identifier all answer 404 not_found. A malformed `org_id` or `notification_id` answers 400 validation_failed with the path pointer.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- notification
parameters:
- $ref: '#/components/parameters/OrganizationId'
- $ref: '#/components/parameters/NotificationId'
responses:
'200':
description: The read state of the item, newly set or repeated.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControlNoStore'
content:
application/json:
schema:
$ref: '#/components/schemas/NotificationReadReceipt'
examples:
read:
$ref: '#/components/examples/NotificationReadReceipt'
'400':
$ref: '#/components/responses/ValidationFailed'
'401':
$ref: '#/components/responses/Unauthenticated'
'403':
$ref: '#/components/responses/CsrfCheckFailedOrForbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/TooManyRequests'
default:
$ref: '#/components/responses/Problem'
/api/v1/me/consents:
get:
operationId: ListMyConsents
@@ -9719,6 +9893,110 @@ components:
description: Permitted facts, one for each supported category.
items:
$ref: '#/components/schemas/OrganizationEvidenceFact'
NotificationKind:
type: string
description: |-
Which event put the notification into the inbox. The inbox stores a reference to the event, never its text.
- invitation_delivered: an invitation reached the candidate's inbox. This is the in-platform delivery state of the invitation: it does not depend on any email, and a failed or missing email never blocks it. The invitation operations are planned; no invitation produces a notification yet.
- synthetic: a synthetic notice that exercises the inbox path (the event, the read-time visibility check, the list, and the read state). It has no product meaning, needs no action, and is never produced by a user action.
Adding a value is a contract change; a client shows an unknown kind with the generic text of an item without content.
enum:
- invitation_delivered
- synthetic
NotificationContent:
type: object
description: The text of a notification as the current source shows it to the recipient now. It is computed on every read and never stored, so a hiding, a revoked membership, or a withdrawn source removes it from the next read. It holds no contact, no score, and no result of an assessment.
additionalProperties: false
required:
- title
- summary
- link_path
properties:
title:
type: string
minLength: 1
maxLength: 120
description: Short heading in Russian.
summary:
type: string
minLength: 1
maxLength: 500
description: One or two sentences in Russian. Plain text, never markup.
link_path:
type:
- string
- 'null'
maxLength: 256
pattern: ^/[A-Za-z0-9/_-]{0,255}$
description: Same-origin absolute path of the screen that the notification opens, or null when there is none. It has no origin, query, fragment, or escape; a client opens it only as a path of its own router.
examples:
- /candidate/invitations
Notification:
type: object
description: One item of the inbox of the current account. Its identity, kind, organization, delivery time, and read state are stored; its content is resolved from the current source on every read.
additionalProperties: false
required:
- id
- kind
- organization_id
- delivered_at
- read_at
- content
properties:
id:
type: string
format: uuid
description: Identifier of the item. It equals the identifier of the event that produced it, so a repeated delivery of the same event is the same item.
kind:
$ref: '#/components/schemas/NotificationKind'
organization_id:
type: string
format: uuid
description: 'The organization context of the item: the organization that sent it to a candidate, or the organization whose cabinet holds it for an employer. The identifier is not a right to read the organization.'
delivered_at:
$ref: '#/components/schemas/Timestamp'
read_at:
description: When the recipient first marked the item read, or null while it is unread. A repeated mark keeps the first time.
oneOf:
- $ref: '#/components/schemas/Timestamp'
- type: 'null'
content:
description: The current content, or null when the source is gone or the recipient may not see it now. A client then shows a generic line such as "The content is no longer available" and never an old copy. The item stays in the list and can be marked read.
oneOf:
- $ref: '#/components/schemas/NotificationContent'
- type: 'null'
NotificationList:
type: object
description: One page of the inbox, newest delivery first.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Items of the page.
items:
$ref: '#/components/schemas/Notification'
page:
$ref: '#/components/schemas/PageInfo'
NotificationReadReceipt:
type: object
description: The read state of one item after a mark. It carries no content, so marking never reads the source.
additionalProperties: false
required:
- id
- read_at
properties:
id:
type: string
format: uuid
description: Identifier of the marked item.
read_at:
$ref: '#/components/schemas/Timestamp'
HealthResponse:
type: object
additionalProperties: false
@@ -10717,7 +10995,7 @@ components:
- domain
MatchUnknownReason:
type: string
description: Bounded explanation for an unknown component, not a hiding reason.
description: Bounded explanation for an unknown component, not a hiding reason. `cohort_below_30` is reported only while the comparable real cohort of the category is smaller than the versioned minimum; once the cohort reaches the minimum but the percentile is still not computed, the reason is `percentile_not_computed`. In both cases T is the neutral 0.5.
enum:
- ml_unavailable
- cohort_below_30
@@ -10726,6 +11004,7 @@ components:
- need_field_unconfirmed
- no_freshness_history
- no_response_history
- percentile_not_computed
MatchUnknownFlag:
type: object
description: A safe, bounded explanation for one unavailable component.
@@ -10875,11 +11154,15 @@ components:
required:
- source
- groups
- truncated
properties:
source:
$ref: '#/components/schemas/MatchSearchSource'
groups:
$ref: '#/components/schemas/MatchSearchGroups'
truncated:
type: boolean
description: 'True when the groups are not the whole ranked result: a group exceeded the versioned per-group limit, or the organization''s card-view allowance ended while the entries were being revealed. The entries returned are in rank order and already counted as card views. It carries no total, so it does not reveal how many candidates match.'
CardSelfAssessment:
type: object
description: Candidate-declared specialization and optional grade. This is never an assessment result.
@@ -11022,6 +11305,15 @@ components:
type: string
format: uuid
example: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
NotificationId:
name: notification_id
in: path
required: true
description: Identifier of an item of the inbox of the current account in the cabinet that the path names. An item of another account, an item of another organization context, and an unknown identifier all answer 404 not_found, so identifiers cannot be enumerated.
schema:
type: string
format: uuid
example: 01928f7a-8b9c-7d0e-9f1a-2b3c4d5e6f70
CandidateHandle:
name: candidate_handle
in: path
@@ -14347,6 +14639,7 @@ components:
unknown_flags:
- component: assessment
reason: no_confirmation_for_specialization
truncated: false
Empty:
summary: A valid search with no eligible visible candidates.
value:
@@ -14364,6 +14657,7 @@ components:
main: []
near: []
unconfirmed: []
truncated: false
MLUnavailable:
summary: Semantic similarity uses the documented neutral value while ML is unavailable.
description: Synthetic example; 0.5 is the FR09 neutral value, not an inference.
@@ -14413,6 +14707,7 @@ components:
reason: ml_unavailable
near: []
unconfirmed: []
truncated: false
CohortBelow30:
summary: A small comparison cohort has no published percentile.
description: Synthetic example; the exact cohort size is not disclosed.
@@ -14462,6 +14757,57 @@ components:
reason: cohort_below_30
near: []
unconfirmed: []
truncated: false
Truncated:
summary: The group limit or the card-view allowance cut the output.
description: Synthetic example. The entries returned are in rank order and already counted as card views; the flag carries no total.
value:
source:
kind: bank
filters:
specialization: backend
confirmed_grade: null
confirmed_category: null
confirmation_status: null
declared_grade: null
stack: null
conditions: null
groups:
main:
- candidate_handle: cv1_EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
specialization: backend
confirmation_status: confirmed
declared_grade: null
category:
specialization: backend
grade: junior
strength: standard
public_context:
stack: null
experience_band: null
work_formats: null
salary_compatibility: null
evidence_summary:
- code: confirmed_category
state: supports
components:
fit: 0.5
coverage: 0.5
domain: 0.5
semantics: 0.5
percentile: null
competition: 0
freshness: 0.5
responsiveness: 0.5
rank_score: 0.45125
unknown_flags:
- component: semantics
reason: ml_unavailable
- component: percentile
reason: cohort_below_30
near: []
unconfirmed: []
truncated: true
OrganizationAnonymousCandidateCard:
summary: An anonymous card currently visible to one organization
description: The alias is scoped to the reading organization; no contact values are included.
@@ -15719,6 +16065,33 @@ components:
granted_at: '2026-10-06T15:00:00Z'
revoked_at: '2026-10-07T10:00:00Z'
revocation_reason: participation_cancelled
NotificationListPage:
summary: An unread notice and a read one whose source is no longer visible
value:
items:
- id: 01928f7a-8b9c-7d0e-9f1a-2b3c4d5e6f70
kind: synthetic
organization_id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
delivered_at: '2026-10-09T08:30:00Z'
read_at: null
content:
title: Тестовое уведомление
summary: Организация «Север» отправила проверочное уведомление платформы. Оно создано для проверки доставки и не требует действий.
link_path: null
- id: 01928f7a-8b9c-7d0e-9f1a-2b3c4d5e6f6f
kind: synthetic
organization_id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
delivered_at: '2026-10-08T17:05:00Z'
read_at: '2026-10-08T17:10:00Z'
content: null
page:
has_more: false
next_cursor: null
NotificationReadReceipt:
summary: The first read time of an item
value:
id: 01928f7a-8b9c-7d0e-9f1a-2b3c4d5e6f70
read_at: '2026-10-09T08:45:00Z'
ConsentRecordListPage:
summary: The whole consent history of a candidate on one page
description: C1 was accepted at registration and again for a newer text version, so the first record is superseded; the version c1-2026-10-05 is an illustration, since the migration publishes only c1-2026-10-01 so far. C2 was granted and revoked. C4 was given in the acceptance of one invitation with the email only; the organization name is the one the consent text showed.