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

@@ -131,6 +131,14 @@ type Querier interface {
// Counts the families of a category that have at least one published
// version, however many versions each has.
CountPublishedAssessmentFamilies(ctx context.Context, category string) (int32, error)
// Reads that only the match search needs. The visibility of the candidates and
// their permitted evidence come from the card and evidence queries, which are
// the single copy of those barriers; this file adds no candidate-facing read.
// The number of candidates who hold each given category from a source that is
// not a synthetic demonstration, which is the size of the comparable real
// cohort that a percentile needs. It returns counts only, for the pairs the
// caller passes as "specialization/grade", and no row for a pair nobody holds.
CountRealComparableCategories(ctx context.Context, categories []string) ([]CountRealComparableCategoriesRow, error)
// New outcomes share the generic idempotency row and are counted for the
// attempt's rolling receipt window. Replays bypass this query in the usecase.
CountRecentAssessmentSignalOutcomes(ctx context.Context, arg CountRecentAssessmentSignalOutcomesParams) (CountRecentAssessmentSignalOutcomesRow, error)
@@ -304,6 +312,12 @@ type Querier interface {
// Read the existing row after a duplicate insert so the repository can reject
// an event ID whose immutable metadata changed on redelivery.
GetNotificationInboxEvent(ctx context.Context, arg GetNotificationInboxEventParams) (NotificationInboxEvent, error)
// Resolve the sender organization of a synthetic notice under the recipient's
// current standing, so the notice never outlives that standing. A candidate
// sees the name only while the organization is not hidden from them; an
// employer sees it only while they are an active member. No row means the
// content is no longer visible to this recipient.
GetNotificationOrganizationNameForRecipient(ctx context.Context, arg GetNotificationOrganizationNameForRecipientParams) (string, error)
// Reads only the historical result. It intentionally does not join the live
// organization or membership, whose profile and state may have since changed.
GetOrganizationCreationResult(ctx context.Context, scopeHash []byte) ([]byte, error)
@@ -615,6 +629,15 @@ type Querier interface {
// calibration (the same for every candidate) say that the fact is a synthetic
// demonstration.
ListOrganizationVisibleEvidence(ctx context.Context, arg ListOrganizationVisibleEvidenceParams) ([]ListOrganizationVisibleEvidenceRow, error)
// The same organization read for a whole candidate set, so a search reads the
// evidence of every listed candidate in one statement. The pairs come from the
// caller as two parallel arrays, one row per candidate and category of the card
// that was just projected. The statement repeats every barrier of the single
// read: the effective publication view, NOT EXISTS over the candidates that
// hide the organization, the categories field, and only visible measurements.
// The candidate identifier is returned for the caller to group by and never
// leaves the server; the other columns are the same allowlist.
ListOrganizationVisibleEvidenceBatch(ctx context.Context, arg ListOrganizationVisibleEvidenceBatchParams) ([]ListOrganizationVisibleEvidenceBatchRow, error)
// Lists the organizations where an account has an active membership,
// newest membership first. The page continues after the (membership
// creation time, organization ID) position of the last item of the
@@ -678,10 +701,19 @@ type Querier interface {
// canceled, or reclaimed after the lease expired. While the lock is held,
// other workers skip the row, so the handler never runs twice at once.
LockClaimedScheduledJob(ctx context.Context, arg LockClaimedScheduledJobParams) (int64, error)
LockCompanyQuotaOrganization(ctx context.Context, organizationID pgtype.UUID) (LockCompanyQuotaOrganizationRow, error)
// Writers lock the organization first, then invitation/card-view state, and
// finally usage rows. The organization lock serializes quota decisions for
// the tenant and makes the subsequent count and insert atomic.
LockCompanyQuotaOrganization(ctx context.Context, organizationID pgtype.UUID) (LockCompanyQuotaOrganizationRow, error)
// Takes the organization lock ahead of every share lock of a reader that will
// reserve usage later. FOR NO KEY UPDATE conflicts with itself and with FOR
// SHARE, so readers of one organization queue up instead of deadlocking on a
// share lock that each then tries to raise, but it does not conflict with the
// FOR KEY SHARE that a foreign key takes, such as the hidden-organization
// insert of a candidate, which holds the candidate's row and then needs this
// one. The reservation itself still takes FOR UPDATE inside the same
// transaction.
LockCompanyQuotaOrganizationFirst(ctx context.Context, organizationID pgtype.UUID) (pgtype.UUID, error)
// Lock the current C2 before locking the publication. C2 revocation updates
// this row before it locks the publication, so preserving this order avoids
// a lock inversion and makes the current consent stable through the read.
@@ -743,8 +775,11 @@ type Querier interface {
// gate stops admitting sends until the window resets or an operator raises
// the limit. The caller holds the row lock.
MarkMailQuotaExhausted(ctx context.Context, arg MarkMailQuotaExhaustedParams) (int64, error)
// Persist the first read time under exact recipient and organization scope.
// Repeated calls preserve the original read timestamp.
// Persist the first read time for the recipient, optionally under one exact
// organization context. A missing organization is the candidate cabinet,
// which spans the organizations that sent to it; the employer cabinet always
// names its organization. Repeated calls preserve the original read
// timestamp.
MarkNotificationInboxEventRead(ctx context.Context, arg MarkNotificationInboxEventReadParams) (NotificationInboxEvent, error)
// Marks the events that the broker acknowledged. The relay passes only IDs
// whose rows its own transaction locked, so the statement never waits and the