feat(visibility): add the candidate publication, hiding and search status contract

This commit is contained in:
shira committed 2026-10-07 00:15:52 +03:00
1 parent 4436f626a3
commit 0529601021
87 files changed
+21456 -83

No files matched your search

+227
View File
@@ -4056,3 +4056,230 @@ ProfileStaleVersion:
code: version_conflict
detail: The resource changed after it was read. Read it again before retrying.
trace_id: 9a0b1c2d-3e4f-4a5b-9c7d-8e9f0a1b2c34
PrivacyPublishedWithoutFields:
summary: A publication without any field
value:
type: urn:lincodex:problem:validation_failed
title: Request validation failed
status: 400
code: validation_failed
detail: One or more request fields are invalid.
trace_id: 3b4c5d6e-7f80-4a91-8b2c-3d4e5f6a7b8c
errors:
- in: body
pointer: /fields
code: invalid
message: A published profile needs at least one field, and a closed one none.
NewCandidatePrivacySettings:
summary: A new candidate with the profile closed
description: Nothing was ever published, announced, or hidden. Every version is 0.
value:
publication:
state: closed
closed_reason: never_published
fields: []
consent_id: null
published_at: null
version: 0
search_status:
value: not_looking
lapsed: false
confirmed_at: null
lapses_at: null
version: 0
hidden_organizations_total: 0
PublishedCandidatePrivacySettings:
summary: A published profile with a confirmed search status
value:
publication:
state: published
closed_reason: null
fields:
- categories
- stack
consent_id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e60
published_at: "2026-10-06T09:10:00Z"
version: 1
search_status:
value: looking
lapsed: false
confirmed_at: "2026-10-06T09:12:00Z"
lapses_at: "2026-11-05T09:12:00Z"
version: 1
hidden_organizations_total: 1
PublicationUpdatePublish:
summary: Publish the confirmed categories and the stack
value:
expected_version: 0
state: published
fields:
- categories
- stack
PublicationUpdateClose:
summary: Close the publication
value:
expected_version: 1
state: closed
fields: []
PublishedPublication:
summary: The publication after the first publish
value:
state: published
closed_reason: null
fields:
- categories
- stack
consent_id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e60
published_at: "2026-10-06T09:10:00Z"
version: 1
SearchStatusUpdateLooking:
summary: Set or confirm the status looking
value:
expected_version: 0
value: looking
LookingSearchStatus:
summary: A confirmed status that lapses after the policy interval
value:
value: looking
lapsed: false
confirmed_at: "2026-10-06T09:12:00Z"
lapses_at: "2026-11-05T09:12:00Z"
version: 1
LapsedSearchStatus:
summary: A status that was not confirmed in time
description: The candidate set looking and did not confirm it again, so it holds as not_looking. Nothing else changed; the publication and the hidden organizations are as they were.
value:
value: not_looking
lapsed: true
confirmed_at: "2026-10-06T09:12:00Z"
lapses_at: "2026-11-05T09:12:00Z"
version: 1
HiddenOrganizationRecord:
summary: An organization that the candidate hides the profile from
value:
organization:
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
name: ООО Пример Платежи
hidden_at: "2026-10-06T09:20:00Z"
HiddenOrganizationListPage:
summary: One hidden organization
value:
items:
- organization:
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
name: ООО Пример Платежи
hidden_at: "2026-10-06T09:20:00Z"
page:
has_more: false
next_cursor: null
PublishedCardPreview:
summary: The card of a published profile with two fields
description: The fields that are not published are null. The card carries no name and no contact.
value:
state: published
fields:
- categories
- stack
card:
categories:
- specialization: backend
grade: middle
stack:
- PostgreSQL
- Kafka
experience_months: null
soft_skills: null
location: null
relocation: null
generated_at: "2026-10-06T09:30:00Z"
ClosedCardPreview:
summary: The preview of a closed profile
value:
state: closed
fields: []
card: null
generated_at: "2026-10-06T09:30:00Z"
PrivacyEventListPage:
summary: A publication, a hiding, and a confirmed status
value:
items:
- id: 01928f7a-b1c2-7d3e-8f4a-5b6c7d8e9f01
kind: organization_hidden
occurred_at: "2026-10-06T09:20:00Z"
fields: null
consent_id: null
organization:
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
name: ООО Пример Платежи
- id: 01928f7a-b1c2-7d3e-8f4a-5b6c7d8e9e02
kind: search_status_confirmed
occurred_at: "2026-10-06T09:12:00Z"
fields: null
consent_id: null
organization: null
- id: 01928f7a-b1c2-7d3e-8f4a-5b6c7d8e9e01
kind: publication_opened
occurred_at: "2026-10-06T09:10:00Z"
fields:
- categories
- stack
consent_id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e60
organization: null
page:
has_more: false
next_cursor: null
CardAccessListPage:
summary: An anonymous view and a contact read
value:
items:
- id: 01928f7a-c1d2-7e3f-8a4b-5c6d7e8f9a02
kind: contact_read
occurred_at: "2026-10-07T08:00:00Z"
organization:
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
name: ООО Пример Платежи
- id: 01928f7a-c1d2-7e3f-8a4b-5c6d7e8f9a01
kind: card_viewed
occurred_at: "2026-10-06T12:00:00Z"
organization: null
page:
has_more: false
next_cursor: null
PrivacyStaleVersion:
summary: The change carried a stale expected_version
description: The setting changed, for example in another tab, after the client read it. Nothing was changed; the client reads the settings again and reapplies its edit.
value:
type: urn:lincodex:problem:version_conflict
title: Resource version conflict
status: 412
code: version_conflict
detail: The resource changed after it was read. Read it again before retrying.
trace_id: 4c5d6e7f-8091-4ba2-9c3d-4e5f6a7b8c9d
PublicationConsentRequiredConflict:
summary: Publishing without an active C2 consent
value:
type: urn:lincodex:problem:state_conflict
title: Resource state conflict
status: 409
code: state_conflict
detail: The resource is in a state that does not allow this operation.
trace_id: 5d6e7f80-91a2-4cb3-8d4e-5f6a7b8c9d0e
errors:
- in: body
pointer: /state
code: consent_required
message: Publishing needs an active C2 consent of the account.
HiddenOrganizationLimitReached:
summary: The candidate hides the maximum number of organizations
value:
type: urn:lincodex:problem:state_conflict
title: Resource state conflict
status: 409
code: state_conflict
detail: The resource is in a state that does not allow this operation.
trace_id: 6e7f8091-a2b3-4dc4-9e5f-6a7b8c9d0e1f
errors:
- in: path
pointer: /org_id
code: limit_reached
message: The candidate already hides the maximum number of organizations.
+16
View File
@@ -129,3 +129,19 @@ MyInvitationId:
type: string
format: uuid
example: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e6f
HiddenOrganizationId:
name: org_id
in: path
required: true
description: >-
Identifier of the organization that the current candidate hides or stops
hiding the profile from. It names the target of a candidate's own
setting and grants the candidate nothing about the organization. Hiding
answers the same 404 not_found for an organization that does not exist
and for one that the candidate cannot see, so organizations cannot be
enumerated; lifting the hiding answers 204 for any well-formed
identifier.
schema:
type: string
format: uuid
example: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
+52
View File
@@ -624,3 +624,55 @@ ProfileVersionConflict:
examples:
version_conflict:
$ref: ./examples.yml#/ProfileStaleVersion
PrivacyValidationFailed:
description: >-
The body does not match the contract or breaks a visibility rule: an
unknown field, a repeated or unknown card field, a published state with
no field, a closed state with a field, a search status other than
looking and not_looking, or a missing or invalid expected_version; code
validation_failed with body pointers. Nothing was changed. The problem
never repeats a submitted value.
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
published_without_fields:
$ref: ./examples.yml#/PrivacyPublishedWithoutFields
PrivacyVersionConflict:
description: >-
`expected_version` is not the current version of the setting; code
version_conflict. Nothing was changed; read the settings again before
retrying.
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
version_conflict:
$ref: ./examples.yml#/PrivacyStaleVersion
PublicationConsentRequired:
description: >-
The profile cannot be published because the account has no active,
unrevoked C2 consent; code state_conflict. Nothing was changed. The
candidate gives C2 in the consent settings first. `errors` holds the entry
`{in: body, pointer: /state, code: consent_required}`.
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
state_conflict:
$ref: ./examples.yml#/PublicationConsentRequiredConflict
HiddenOrganizationLimit:
description: >-
The candidate already hides the maximum number of organizations (1000);
code state_conflict with the entry `{in: path, pointer: /org_id, code:
limit_reached}` in `errors`. Nothing was changed.
content:
application/problem+json:
schema:
$ref: ./schemas.yml#/Problem
examples:
limit_reached:
$ref: ./examples.yml#/HiddenOrganizationLimitReached
+465 -2
View File
@@ -4874,6 +4874,469 @@ MyOrganizationList:
$ref: '#/MyOrganization'
page:
$ref: '#/PageInfo'
PublicationVersion:
type: integer
format: int64
minimum: 0
description: Version of the publication setting of the candidate. A candidate who has never published has version 0 and the profile is closed; every change that alters the setting advances it by one. The client sends the version it read as `expected_version`. It is independent of the versions of the profile and of the search status, so a change of one never makes another stale.
examples:
- 2
SearchStatusVersion:
type: integer
format: int64
minimum: 0
description: Version of the search status of the candidate. A candidate who never set the status has version 0 and the status `not_looking`; every confirmation or change advances it by one. The client sends the version it read as `expected_version`.
examples:
- 3
CardField:
type: string
description: 'A group of values of the anonymous candidate card that the candidate chooses to publish. The set is closed and has no value for the full name, a contact, or the lowest salary: the card never carries them, so no choice and no later contract change in this list can publish them by accident. Contacts leave only through the contact grant of an accepted invitation (C4), and the lowest salary never leaves.
- categories: the categories confirmed by assessment results (specialization and confirmed grade). A self-assessed grade is not a category and is never published.
- stack: the technology tags of the profile.
- experience: the total months of work experience, without employers, periods, or descriptions.
- soft_skills: the soft skills of the profile.
- location: the city or region of the profile.
- relocation: whether the candidate is ready to relocate.
Only values that the candidate confirmed ever reach the card: an unconfirmed suggestion (status `extracted`) and an unknown value never do, whatever the field set says.
Adding a value is a contract change that lets a candidate publish more, and it is also a migration (the function `candidate_card_fields_are_canonical` and the CHECK constraints of the publication and event tables list the codes). A client treats an unknown value as a reason to ask for an update, and the server never adds a new value to a published set on its own.'
enum:
- categories
- stack
- experience
- soft_skills
- location
- relocation
CardFieldSet:
type: array
minItems: 0
maxItems: 6
uniqueItems: true
description: Distinct card fields. The server stores them in ascending order of the codes and answers them in that order, whatever order the client sent, so equal sets are equal arrays.
items:
$ref: '#/CardField'
PublicationState:
type: string
description: 'Whether the candidate card can be read by organizations at all. It is computed from the stored publication and the consent ledger: a profile is closed unless the candidate published it and the C2 consent that backs the publication is still unrevoked.
- closed: no organization reads the card. This is the state of every new profile and of a profile whose publication was closed or whose C2 was revoked.
- published: organizations may read exactly the fields in `fields`, except for the organizations the candidate hid.'
enum:
- closed
- published
PublicationClosedReason:
type: string
description: 'Why a closed profile is closed, shown only to the candidate.
- never_published: the candidate has never published the profile.
- closed_by_candidate: the candidate closed the publication.
- consent_revoked: the C2 consent that backed the publication was revoked. A later C2 grant never reopens the publication; the candidate publishes again explicitly and the new publication refers to the new consent record.'
enum:
- never_published
- closed_by_candidate
- consent_revoked
Publication:
type: object
description: 'Publication setting of the candidate card. It is separate from the consent: the C2 consent in the ledger proves that the candidate accepted the publication text, and this setting records whether and which fields are published. `state` is `published` only while the referenced C2 record is unrevoked, whatever the stored setting says, so a revocation closes the card at once. The state, the fields, and the times belong to the history that the C2 consent record does not carry.'
additionalProperties: false
required:
- state
- closed_reason
- fields
- consent_id
- published_at
- version
properties:
state:
$ref: '#/PublicationState'
closed_reason:
description: Why the profile is closed, or null while it is published.
oneOf:
- $ref: '#/PublicationClosedReason'
- type: 'null'
fields:
description: Card fields that organizations may read. Empty exactly when `state` is `closed`.
allOf:
- $ref: '#/CardFieldSet'
consent_id:
description: Identifier of the C2 record of the consent ledger that backs the current or the last publication, the `id` of a `ConsentRecord` of this account, or null when the profile was never published.
oneOf:
- type: string
format: uuid
- type: 'null'
published_at:
description: Moment of the latest change that published or republished the card, or null while the profile was never published. It stays after a closing, as the time of the last publication.
oneOf:
- $ref: '#/Timestamp'
- type: 'null'
version:
$ref: '#/PublicationVersion'
PublicationUpdate:
type: object
description: 'The complete new publication setting. `published` needs a non-empty set of fields and an active C2 consent of the account; `closed` needs an empty set and never fails for a missing consent. The body names no consent: the server binds the publication to the account''s current unrevoked C2 record, and a client can neither supply nor forge one.'
additionalProperties: false
required:
- expected_version
- state
- fields
properties:
expected_version:
$ref: '#/PublicationVersion'
state:
$ref: '#/PublicationState'
fields:
$ref: '#/CardFieldSet'
SearchStatusValue:
type: string
description: 'Whether the candidate says they are searching for work. The status is a statement, never a consent: it publishes nothing, hides nothing, and grants nothing, and no value of it changes the C2 consent, the publication, or the hidden organizations.
- looking: the candidate is searching ("Ищу"). It holds only while it is confirmed in time; see `SearchStatus.lapsed`.
- not_looking: the candidate is not announcing a search. It is the state of every new account and the state to which a lapsed status falls.'
enum:
- looking
- not_looking
SearchStatus:
type: object
description: 'Search status of the candidate as it holds now. The status `looking` stores the moment of its confirmation and lapses when the confirmation interval of the product policy passes without a new confirmation. A lapse only ever narrows: the status falls to `not_looking`, which is the non-public state, and a lapse never changes the publication or the hidden organizations. It needs no stored change, so no process can make a candidate more visible by expiry, and a lapsed candidate confirms again explicitly.'
additionalProperties: false
required:
- value
- lapsed
- confirmed_at
- lapses_at
- version
properties:
value:
description: 'The status that holds now: `looking` only while the confirmation has not lapsed.'
allOf:
- $ref: '#/SearchStatusValue'
lapsed:
type: boolean
description: True when the candidate set `looking`, did not confirm it again, and the interval ended, so `value` is `not_looking`. False otherwise, including a status the candidate cleared.
confirmed_at:
description: Moment of the latest confirmation of `looking`, or null when the candidate never set it or cleared it.
oneOf:
- $ref: '#/Timestamp'
- type: 'null'
lapses_at:
description: Moment at which the confirmed status lapses, fixed when it was confirmed from the `search_status` section of the product policy version in force then, or null when `confirmed_at` is null. A later policy change does not move it; it stays in the past for a lapsed status.
oneOf:
- $ref: '#/Timestamp'
- type: 'null'
version:
$ref: '#/SearchStatusVersion'
SearchStatusUpdate:
type: object
description: 'The complete new search status. `looking` is also the confirmation of a status that still holds or has lapsed: it sets the confirmation time to now. The body carries no time, interval, or policy version; the server takes them from the effective product policy.'
additionalProperties: false
required:
- expected_version
- value
properties:
expected_version:
$ref: '#/SearchStatusVersion'
value:
$ref: '#/SearchStatusValue'
PrivacyOrganization:
type: object
description: Organization as the candidate who hid it reads it. The name is the current name of the organization. The candidate must already have been able to see the organization to hide it, so the reference tells them nothing that they could not read before.
additionalProperties: false
required:
- id
- name
properties:
id:
type: string
format: uuid
description: Identifier of the organization.
name:
type: string
minLength: 1
maxLength: 200
description: Current name of the organization. Plain text; clients show it as text, never as HTML.
HiddenOrganization:
type: object
description: 'One organization that the candidate hides the profile from. The record belongs to the candidate: no organization reads it, learns that it was hidden, or can tell a hidden candidate from one who is not published.'
additionalProperties: false
required:
- organization
- hidden_at
properties:
organization:
$ref: '#/PrivacyOrganization'
hidden_at:
$ref: '#/Timestamp'
HiddenOrganizationList:
type: object
description: One page of the organizations that the candidate hides the profile from, newest first with the organization identifier as the tie-breaker.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Hidden organizations of the page.
items:
$ref: '#/HiddenOrganization'
page:
$ref: '#/PageInfo'
PrivacySettings:
type: object
description: 'The visibility settings of the current candidate in one read: the publication, the search status, and the number of hidden organizations. The three are independent: each has its own version and its own operation, and a change of one leaves the others as they were. A new account reads a closed profile, `not_looking`, and no hidden organization.'
additionalProperties: false
required:
- publication
- search_status
- hidden_organizations_total
properties:
publication:
$ref: '#/Publication'
search_status:
$ref: '#/SearchStatus'
hidden_organizations_total:
type: integer
minimum: 0
maximum: 1000
description: Number of organizations that the candidate hides the profile from. The list is read with `ListMyHiddenOrganizations`.
CardCategory:
type: object
description: A category confirmed by assessment results, as the card shows it.
additionalProperties: false
required:
- specialization
- grade
properties:
specialization:
$ref: '#/SpecializationCode'
grade:
$ref: '#/GradeCode'
AnonymousCardContent:
type: object
description: The anonymous candidate card as an organization reads it. Only values that the candidate confirmed reach it; an unconfirmed suggestion and an unknown value never do. A free text value (a stack tag, a soft skill, the location) that looks like a contact (an email address, a phone number, a URL or domain, a Telegram link, an @handle) is dropped by the builder (TASK-089) and never published. It carries no name, contact, resume text, employer, salary figure, account or profile identifier, and no schema of the private profile or of a contact disclosure is reachable from it; a contact reaches an organization only through the contact grant of an accepted invitation. Each property is null when its field is not published or the candidate has no value for it, so the card does not tell the two apart. The set of properties is closed, and an organization-visible card must never gain a property that identifies the candidate. The search ranking and the full card of an organization's search
result are defined by the search contract (TASK-185), which reuses this content.
additionalProperties: false
required:
- categories
- stack
- experience_months
- soft_skills
- location
- relocation
properties:
categories:
type:
- array
- 'null'
maxItems: 9
description: Categories confirmed by assessment results, or null.
items:
$ref: '#/CardCategory'
stack:
type:
- array
- 'null'
maxItems: 30
description: Technology tags of the candidate, or null.
items:
$ref: '#/StackTag'
experience_months:
type:
- integer
- 'null'
minimum: 0
maximum: 1200
description: Total months of work experience, summed by the server without the employers, periods, or descriptions, or null.
soft_skills:
type:
- array
- 'null'
maxItems: 10
description: Soft skills of the candidate, or null.
items:
type: string
minLength: 1
maxLength: 50
pattern: ^\S(?:.*\S)?$
description: Plain text; clients show it as text, never as HTML.
location:
type:
- string
- 'null'
minLength: 1
maxLength: 100
pattern: ^\S(?:.*\S)?$
description: City or region as free text, never a street address, or null. Plain text; clients show it as text, never as HTML.
relocation:
type:
- boolean
- 'null'
description: Whether the candidate is ready to relocate, or null.
CardPreview:
type: object
description: 'What an organization that the candidate does not hide the profile from would read now, computed from the current profile, the current publication, and the consent ledger. It is a read for the candidate: it creates no view and no history record, and it never reaches an organization. `card` is null while the profile is closed.'
additionalProperties: false
required:
- state
- fields
- card
- generated_at
properties:
state:
$ref: '#/PublicationState'
fields:
$ref: '#/CardFieldSet'
card:
oneOf:
- $ref: '#/AnonymousCardContent'
- type: 'null'
generated_at:
$ref: '#/Timestamp'
PrivacyEventKind:
type: string
description: 'Kind of a change of the visibility settings that the history records.
- publication_opened: the candidate published a closed profile.
- publication_changed: the candidate changed the published fields of a published profile, or published it again under a new C2 record.
- publication_closed: the candidate closed the publication. A revocation of C2 closes the card by the ledger and is read from the consent history, not recorded here.
- search_status_confirmed: the candidate set or confirmed `looking`.
- search_status_cleared: the candidate set `not_looking`. A lapse is not an event: it is computed.
- organization_hidden: the candidate hid the profile from an organization.
- organization_unhidden: the candidate lifted the hiding for an organization.'
enum:
- publication_opened
- publication_changed
- publication_closed
- search_status_confirmed
- search_status_cleared
- organization_hidden
- organization_unhidden
PrivacyEvent:
type: object
description: One recorded change of the visibility settings of the current candidate, as evidence of what was published, hidden, or announced and when. The history is append-only and returns only the caller's own records. A publication event carries the published fields and the C2 record behind them; an organization event names the organization; the other properties are null.
additionalProperties: false
required:
- id
- kind
- occurred_at
- fields
- consent_id
- organization
properties:
id:
type: string
format: uuid
description: Identifier of the event.
kind:
$ref: '#/PrivacyEventKind'
occurred_at:
$ref: '#/Timestamp'
fields:
description: Published fields after the change for `publication_opened` and `publication_changed`, an empty set for `publication_closed`, and null for every other kind.
oneOf:
- $ref: '#/CardFieldSet'
- type: 'null'
consent_id:
description: C2 record that backs the publication, for `publication_opened` and `publication_changed`, or null.
oneOf:
- type: string
format: uuid
- type: 'null'
organization:
description: Organization of `organization_hidden` and `organization_unhidden` with its current name, resolved when the history is read (the event stores only the identifier), or null.
oneOf:
- $ref: '#/PrivacyOrganization'
- type: 'null'
PrivacyEventList:
type: object
description: One page of the settings history of the current candidate, newest first.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Events of the page.
items:
$ref: '#/PrivacyEvent'
page:
$ref: '#/PageInfo'
CardAccessKind:
type: string
description: 'How an organization reached the candidate.
- card_viewed: an organization read the anonymous card in a search result.
- contact_read: an organization read the contacts through the contact grant of an accepted invitation.'
enum:
- card_viewed
- contact_read
CardAccess:
type: object
description: One access of an organization to the card or the contacts of the current candidate. `organization` is null for a view by an organization that has no invitation relation with the candidate, so the history shows that the card was viewed without naming a company that the candidate cannot otherwise see; whether the candidate should learn the name is an open product question. The record carries no query, ranking, or search filter of the organization.
additionalProperties: false
required:
- id
- kind
- occurred_at
- organization
properties:
id:
type: string
format: uuid
description: Identifier of the access record.
kind:
$ref: '#/CardAccessKind'
occurred_at:
$ref: '#/Timestamp'
organization:
oneOf:
- $ref: '#/PrivacyOrganization'
- type: 'null'
CardAccessList:
type: object
description: One page of the accesses to the card of the current candidate, newest first.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Accesses of the page.
items:
$ref: '#/CardAccess'
page:
$ref: '#/PageInfo'
Problem:
type: object
description: Problem details (RFC 9457) returned with the application/problem+json media type for every error response. `code` is the stable, machine-readable reason; clients branch on it rather than on `title`, `detail`, or the HTTP status alone. The body never contains internal error text, stack traces, SQL, file paths, credentials, contact data, or echoed request values.
@@ -4920,7 +5383,7 @@ Problem:
errors:
type: array
maxItems: 100
description: Field-level reasons for validation_failed. Other codes omit it.
description: Field-level reasons. validation_failed always carries them; state_conflict may carry one as a disambiguator when one code covers several conflicts (for example consent_required and limit_reached). Other codes omit it. A problem writer must not strip errors from a non-validation response.
items:
$ref: '#/ProblemFieldError'
ProblemCode:
@@ -5010,7 +5473,7 @@ ProblemFieldError:
minLength: 1
maxLength: 64
pattern: ^[a-z][a-z0-9_]*$
description: Stable field reason. Current values are `required` (missing value) and `invalid` (malformed value or a value outside the schema). Clients must tolerate new values.
description: Stable field reason. Current values are `required` (missing value) and `invalid` (malformed value or a value outside the schema), and, on a state_conflict, `consent_required` (the operation needs a consent that is not active) and `limit_reached` (a per-account bound is reached). Clients must tolerate new values.
message:
type: string
minLength: 1
@@ -0,0 +1,574 @@
schemas:
PublicationVersion:
type: integer
format: int64
minimum: 0
description: >-
Version of the publication setting of the candidate. A candidate who
has never published has version 0 and the profile is closed; every
change that alters the setting advances it by one. The client sends
the version it read as `expected_version`. It is independent of the
versions of the profile and of the search status, so a change of one
never makes another stale.
examples:
- 2
SearchStatusVersion:
type: integer
format: int64
minimum: 0
description: >-
Version of the search status of the candidate. A candidate who never
set the status has version 0 and the status `not_looking`; every
confirmation or change advances it by one. The client sends the
version it read as `expected_version`.
examples:
- 3
CardField:
type: string
description: |-
A group of values of the anonymous candidate card that the candidate chooses to publish. The set is closed and has no value for the full name, a contact, or the lowest salary: the card never carries them, so no choice and no later contract change in this list can publish them by accident. Contacts leave only through the contact grant of an accepted invitation (C4), and the lowest salary never leaves.
- categories: the categories confirmed by assessment results (specialization and confirmed grade). A self-assessed grade is not a category and is never published.
- stack: the technology tags of the profile.
- experience: the total months of work experience, without employers, periods, or descriptions.
- soft_skills: the soft skills of the profile.
- location: the city or region of the profile.
- relocation: whether the candidate is ready to relocate.
Only values that the candidate confirmed ever reach the card: an unconfirmed suggestion (status `extracted`) and an unknown value never do, whatever the field set says.
Adding a value is a contract change that lets a candidate publish more, and it is also a migration (the function `candidate_card_fields_are_canonical` and the CHECK constraints of the publication and event tables list the codes). A client treats an unknown value as a reason to ask for an update, and the server never adds a new value to a published set on its own.
enum:
- categories
- stack
- experience
- soft_skills
- location
- relocation
CardFieldSet:
type: array
minItems: 0
maxItems: 6
uniqueItems: true
description: >-
Distinct card fields. The server stores them in ascending order of
the codes and answers them in that order, whatever order the client
sent, so equal sets are equal arrays.
items:
$ref: "#/schemas/CardField"
PublicationState:
type: string
description: |-
Whether the candidate card can be read by organizations at all. It is computed from the stored publication and the consent ledger: a profile is closed unless the candidate published it and the C2 consent that backs the publication is still unrevoked.
- closed: no organization reads the card. This is the state of every new profile and of a profile whose publication was closed or whose C2 was revoked.
- published: organizations may read exactly the fields in `fields`, except for the organizations the candidate hid.
enum:
- closed
- published
PublicationClosedReason:
type: string
description: |-
Why a closed profile is closed, shown only to the candidate.
- never_published: the candidate has never published the profile.
- closed_by_candidate: the candidate closed the publication.
- consent_revoked: the C2 consent that backed the publication was revoked. A later C2 grant never reopens the publication; the candidate publishes again explicitly and the new publication refers to the new consent record.
enum:
- never_published
- closed_by_candidate
- consent_revoked
Publication:
type: object
description: >-
Publication setting of the candidate card. It is separate from the
consent: the C2 consent in the ledger proves that the candidate
accepted the publication text, and this setting records whether and
which fields are published. `state` is `published` only while the
referenced C2 record is unrevoked, whatever the stored setting says,
so a revocation closes the card at once. The state, the fields, and
the times belong to the history that the C2 consent record does not
carry.
additionalProperties: false
required:
- state
- closed_reason
- fields
- consent_id
- published_at
- version
properties:
state:
$ref: "#/schemas/PublicationState"
closed_reason:
description: Why the profile is closed, or null while it is published.
oneOf:
- $ref: "#/schemas/PublicationClosedReason"
- type: "null"
fields:
description: >-
Card fields that organizations may read. Empty exactly when `state`
is `closed`.
allOf:
- $ref: "#/schemas/CardFieldSet"
consent_id:
description: >-
Identifier of the C2 record of the consent ledger that backs the
current or the last publication, the `id` of a `ConsentRecord` of
this account, or null when the profile was never published.
oneOf:
- type: string
format: uuid
- type: "null"
published_at:
description: >-
Moment of the latest change that published or republished the
card, or null while the profile was never published. It stays
after a closing, as the time of the last publication.
oneOf:
- $ref: "./common_schemas.yml#/schemas/Timestamp"
- type: "null"
version:
$ref: "#/schemas/PublicationVersion"
PublicationUpdate:
type: object
description: >-
The complete new publication setting. `published` needs a non-empty
set of fields and an active C2 consent of the account; `closed` needs
an empty set and never fails for a missing consent. The body names no
consent: the server binds the publication to the account's current
unrevoked C2 record, and a client can neither supply nor forge one.
additionalProperties: false
required:
- expected_version
- state
- fields
properties:
expected_version:
$ref: "#/schemas/PublicationVersion"
state:
$ref: "#/schemas/PublicationState"
fields:
$ref: "#/schemas/CardFieldSet"
SearchStatusValue:
type: string
description: |-
Whether the candidate says they are searching for work. The status is a statement, never a consent: it publishes nothing, hides nothing, and grants nothing, and no value of it changes the C2 consent, the publication, or the hidden organizations.
- looking: the candidate is searching ("Ищу"). It holds only while it is confirmed in time; see `SearchStatus.lapsed`.
- not_looking: the candidate is not announcing a search. It is the state of every new account and the state to which a lapsed status falls.
enum:
- looking
- not_looking
SearchStatus:
type: object
description: >-
Search status of the candidate as it holds now. The status `looking`
stores the moment of its confirmation and lapses when the
confirmation interval of the product policy passes without a new
confirmation. A lapse only ever narrows: the status falls to
`not_looking`, which is the non-public state, and a lapse never
changes the publication or the hidden organizations. It needs no
stored change, so no process can make a candidate more visible by
expiry, and a lapsed candidate confirms again explicitly.
additionalProperties: false
required:
- value
- lapsed
- confirmed_at
- lapses_at
- version
properties:
value:
description: >-
The status that holds now: `looking` only while the confirmation
has not lapsed.
allOf:
- $ref: "#/schemas/SearchStatusValue"
lapsed:
type: boolean
description: >-
True when the candidate set `looking`, did not confirm it again,
and the interval ended, so `value` is `not_looking`. False
otherwise, including a status the candidate cleared.
confirmed_at:
description: >-
Moment of the latest confirmation of `looking`, or null when the
candidate never set it or cleared it.
oneOf:
- $ref: "./common_schemas.yml#/schemas/Timestamp"
- type: "null"
lapses_at:
description: >-
Moment at which the confirmed status lapses, fixed when it was
confirmed from the `search_status` section of the product policy
version in force then, or null when `confirmed_at` is null. A
later policy change does not move it; it stays in the past for a
lapsed status.
oneOf:
- $ref: "./common_schemas.yml#/schemas/Timestamp"
- type: "null"
version:
$ref: "#/schemas/SearchStatusVersion"
SearchStatusUpdate:
type: object
description: >-
The complete new search status. `looking` is also the confirmation of
a status that still holds or has lapsed: it sets the confirmation time
to now. The body carries no time, interval, or policy version; the
server takes them from the effective product policy.
additionalProperties: false
required:
- expected_version
- value
properties:
expected_version:
$ref: "#/schemas/SearchStatusVersion"
value:
$ref: "#/schemas/SearchStatusValue"
PrivacyOrganization:
type: object
description: >-
Organization as the candidate who hid it reads it. The name is the
current name of the organization. The candidate must already have been
able to see the organization to hide it, so the reference tells them
nothing that they could not read before.
additionalProperties: false
required:
- id
- name
properties:
id:
type: string
format: uuid
description: Identifier of the organization.
name:
type: string
minLength: 1
maxLength: 200
description: >-
Current name of the organization. Plain text; clients show it as
text, never as HTML.
HiddenOrganization:
type: object
description: >-
One organization that the candidate hides the profile from. The record
belongs to the candidate: no organization reads it, learns that it was
hidden, or can tell a hidden candidate from one who is not published.
additionalProperties: false
required:
- organization
- hidden_at
properties:
organization:
$ref: "#/schemas/PrivacyOrganization"
hidden_at:
$ref: "./common_schemas.yml#/schemas/Timestamp"
HiddenOrganizationList:
type: object
description: >-
One page of the organizations that the candidate hides the profile
from, newest first with the organization identifier as the
tie-breaker.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Hidden organizations of the page.
items:
$ref: "#/schemas/HiddenOrganization"
page:
$ref: "./common_schemas.yml#/schemas/PageInfo"
PrivacySettings:
type: object
description: >-
The visibility settings of the current candidate in one read: the
publication, the search status, and the number of hidden
organizations. The three are independent: each has its own version and
its own operation, and a change of one leaves the others as they were.
A new account reads a closed profile, `not_looking`, and no hidden
organization.
additionalProperties: false
required:
- publication
- search_status
- hidden_organizations_total
properties:
publication:
$ref: "#/schemas/Publication"
search_status:
$ref: "#/schemas/SearchStatus"
hidden_organizations_total:
type: integer
minimum: 0
maximum: 1000
description: >-
Number of organizations that the candidate hides the profile from.
The list is read with `ListMyHiddenOrganizations`.
CardCategory:
type: object
description: A category confirmed by assessment results, as the card shows it.
additionalProperties: false
required:
- specialization
- grade
properties:
specialization:
$ref: "./catalog_schemas.yml#/schemas/SpecializationCode"
grade:
$ref: "./catalog_schemas.yml#/schemas/GradeCode"
AnonymousCardContent:
type: object
description: >-
The anonymous candidate card as an organization reads it. Only values
that the candidate confirmed reach it; an unconfirmed suggestion and an
unknown value never do. A free text value (a stack tag, a soft skill, the
location) that looks like a contact (an email address, a phone number, a
URL or domain, a Telegram link, an @handle) is dropped by the builder
(TASK-089) and never published. It carries
no name, contact, resume text, employer, salary figure, account or
profile identifier, and no schema of the private profile or of a
contact disclosure is reachable from it; a contact reaches an
organization only through the contact grant of an accepted
invitation. Each property is null when its field is not published or
the candidate has no value for it, so the card does not tell the two
apart. The set of properties is closed, and an organization-visible
card must never gain a property that identifies the candidate. The
search ranking and the full card of an organization's search result
are defined by the search contract (TASK-185), which reuses this
content.
additionalProperties: false
required:
- categories
- stack
- experience_months
- soft_skills
- location
- relocation
properties:
categories:
type:
- array
- "null"
maxItems: 9
description: Categories confirmed by assessment results, or null.
items:
$ref: "#/schemas/CardCategory"
stack:
type:
- array
- "null"
maxItems: 30
description: Technology tags of the candidate, or null.
items:
$ref: "./questionnaire_schemas.yml#/schemas/StackTag"
experience_months:
type:
- integer
- "null"
minimum: 0
maximum: 1200
description: >-
Total months of work experience, summed by the server without the
employers, periods, or descriptions, or null.
soft_skills:
type:
- array
- "null"
maxItems: 10
description: Soft skills of the candidate, or null.
items:
type: string
minLength: 1
maxLength: 50
pattern: '^\S(?:.*\S)?$'
description: Plain text; clients show it as text, never as HTML.
location:
type:
- string
- "null"
minLength: 1
maxLength: 100
pattern: '^\S(?:.*\S)?$'
description: >-
City or region as free text, never a street address, or null.
Plain text; clients show it as text, never as HTML.
relocation:
type:
- boolean
- "null"
description: Whether the candidate is ready to relocate, or null.
CardPreview:
type: object
description: >-
What an organization that the candidate does not hide the profile from
would read now, computed from the current profile, the current
publication, and the consent ledger. It is a read for the candidate: it
creates no view and no history record, and it never reaches an
organization. `card` is null while the profile is closed.
additionalProperties: false
required:
- state
- fields
- card
- generated_at
properties:
state:
$ref: "#/schemas/PublicationState"
fields:
$ref: "#/schemas/CardFieldSet"
card:
oneOf:
- $ref: "#/schemas/AnonymousCardContent"
- type: "null"
generated_at:
$ref: "./common_schemas.yml#/schemas/Timestamp"
PrivacyEventKind:
type: string
description: |-
Kind of a change of the visibility settings that the history records.
- publication_opened: the candidate published a closed profile.
- publication_changed: the candidate changed the published fields of a published profile, or published it again under a new C2 record.
- publication_closed: the candidate closed the publication. A revocation of C2 closes the card by the ledger and is read from the consent history, not recorded here.
- search_status_confirmed: the candidate set or confirmed `looking`.
- search_status_cleared: the candidate set `not_looking`. A lapse is not an event: it is computed.
- organization_hidden: the candidate hid the profile from an organization.
- organization_unhidden: the candidate lifted the hiding for an organization.
enum:
- publication_opened
- publication_changed
- publication_closed
- search_status_confirmed
- search_status_cleared
- organization_hidden
- organization_unhidden
PrivacyEvent:
type: object
description: >-
One recorded change of the visibility settings of the current
candidate, as evidence of what was published, hidden, or announced and
when. The history is append-only and returns only the caller's own
records. A publication event carries the published fields and the C2
record behind them; an organization event names the organization; the
other properties are null.
additionalProperties: false
required:
- id
- kind
- occurred_at
- fields
- consent_id
- organization
properties:
id:
type: string
format: uuid
description: Identifier of the event.
kind:
$ref: "#/schemas/PrivacyEventKind"
occurred_at:
$ref: "./common_schemas.yml#/schemas/Timestamp"
fields:
description: >-
Published fields after the change for `publication_opened` and
`publication_changed`, an empty set for `publication_closed`, and
null for every other kind.
oneOf:
- $ref: "#/schemas/CardFieldSet"
- type: "null"
consent_id:
description: >-
C2 record that backs the publication, for `publication_opened` and
`publication_changed`, or null.
oneOf:
- type: string
format: uuid
- type: "null"
organization:
description: >-
Organization of `organization_hidden` and `organization_unhidden`
with its current name, resolved when the history is read (the event
stores only the identifier), or null.
oneOf:
- $ref: "#/schemas/PrivacyOrganization"
- type: "null"
PrivacyEventList:
type: object
description: >-
One page of the settings history of the current candidate, newest
first.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Events of the page.
items:
$ref: "#/schemas/PrivacyEvent"
page:
$ref: "./common_schemas.yml#/schemas/PageInfo"
CardAccessKind:
type: string
description: |-
How an organization reached the candidate.
- card_viewed: an organization read the anonymous card in a search result.
- contact_read: an organization read the contacts through the contact grant of an accepted invitation.
enum:
- card_viewed
- contact_read
CardAccess:
type: object
description: >-
One access of an organization to the card or the contacts of the
current candidate. `organization` is null for a view by an
organization that has no invitation relation with the candidate, so the
history shows that the card was viewed without naming a company that
the candidate cannot otherwise see; whether the candidate should learn
the name is an open product question. The record carries no query,
ranking, or search filter of the organization.
additionalProperties: false
required:
- id
- kind
- occurred_at
- organization
properties:
id:
type: string
format: uuid
description: Identifier of the access record.
kind:
$ref: "#/schemas/CardAccessKind"
occurred_at:
$ref: "./common_schemas.yml#/schemas/Timestamp"
organization:
oneOf:
- $ref: "#/schemas/PrivacyOrganization"
- type: "null"
CardAccessList:
type: object
description: >-
One page of the accesses to the card of the current candidate, newest
first.
additionalProperties: false
required:
- items
- page
properties:
items:
type: array
maxItems: 100
description: Accesses of the page.
items:
$ref: "#/schemas/CardAccess"
page:
$ref: "./common_schemas.yml#/schemas/PageInfo"
@@ -61,7 +61,7 @@ schemas:
type: array
maxItems: 100
description: >-
Field-level reasons for validation_failed. Other codes omit it.
Field-level reasons. validation_failed always carries them; state_conflict may carry one as a disambiguator when one code covers several conflicts (for example consent_required and limit_reached). Other codes omit it. A problem writer must not strip errors from a non-validation response.
items:
$ref: "#/schemas/ProblemFieldError"
ProblemCode:
@@ -138,8 +138,10 @@ schemas:
pattern: "^[a-z][a-z0-9_]*$"
description: >-
Stable field reason. Current values are `required` (missing value)
and `invalid` (malformed value or a value outside the schema).
Clients must tolerate new values.
and `invalid` (malformed value or a value outside the schema), and,
on a state_conflict, `consent_required` (the operation needs a
consent that is not active) and `limit_reached` (a per-account
bound is reached). Clients must tolerate new values.
message:
type: string
minLength: 1