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

@@ -1173,6 +1173,27 @@ type Handler interface {
//
// GET /api/v1/me/invitations
ListMyInvitations(ctx context.Context, params ListMyInvitationsParams) (ListMyInvitationsRes, error)
// ListMyNotifications implements ListMyNotifications operation.
//
// 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.
//
// GET /api/v1/me/notifications
ListMyNotifications(ctx context.Context, params ListMyNotificationsParams) (ListMyNotificationsRes, error)
// ListMyOrganizations implements ListMyOrganizations operation.
//
// Requires the session cookie of an employer account. The account comes from the session, never from a
@@ -1278,6 +1299,27 @@ type Handler interface {
//
// GET /api/v1/organizations/{org_id}/needs
ListOrganizationNeeds(ctx context.Context, params ListOrganizationNeedsParams) (ListOrganizationNeedsRes, error)
// ListOrganizationNotifications implements ListOrganizationNotifications operation.
//
// 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.
//
// GET /api/v1/organizations/{org_id}/notifications
ListOrganizationNotifications(ctx context.Context, params ListOrganizationNotificationsParams) (ListOrganizationNotificationsRes, error)
// Login implements Login operation.
//
// Public operation that starts a server session. The server verifies the password with Argon2id; for
@@ -1312,6 +1354,49 @@ type Handler interface {
//
// DELETE /api/v1/identity/sessions/current
Logout(ctx context.Context) (LogoutRes, error)
// MarkMyNotificationRead implements MarkMyNotificationRead operation.
//
// 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.
//
// POST /api/v1/me/notifications/{notification_id}/read
MarkMyNotificationRead(ctx context.Context, params MarkMyNotificationReadParams) (MarkMyNotificationReadRes, error)
// MarkOrganizationNotificationRead implements MarkOrganizationNotificationRead operation.
//
// 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.
//
// POST /api/v1/organizations/{org_id}/notifications/{notification_id}/read
MarkOrganizationNotificationRead(ctx context.Context, params MarkOrganizationNotificationReadParams) (MarkOrganizationNotificationReadRes, error)
// RaiseOrganizationInvitationSalary implements RaiseOrganizationInvitationSalary operation.
//
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
@@ -1585,6 +1670,15 @@ type Handler interface {
// 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
@@ -1600,7 +1694,10 @@ type Handler interface {
// 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`.
// `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