Keep a board's stated pay as salary_text, even when it does not normalise

Every ats parser now writes one human-readable pay line whether or not it
converts to yearly salary_min/salary_max/currency: hourly and daily rates,
Greenhouse's several pay zones, and a range with no currency all survive as
text instead of being dropped outright. Stored in roles.salary_text
(migration 12), replaced whole on every pull like title, so a board that
stops stating pay clears it rather than leaving a stale line. salary_state
is derived, not stored ('normalised', 'stated', or ''), and is what the
feed's new Pay filter and badge read; gates and scoring are unchanged, still
reading only the normalised columns.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet committed 2026-09-29 15:08:45 +02:00
1 parent 706b127bc0
commit fa4e1a657f
18 files changed
+528 -57

No files matched your search

+19 -1
View File
@@ -15,7 +15,7 @@ import re
import unicodedata
from typing import Annotated, Any, Literal, get_args
from pydantic import BeforeValidator, Field
from pydantic import BeforeValidator, Field, computed_field
from desk.models import JsonDict, Model, ModelTaskResult
@@ -337,6 +337,10 @@ class Role(Model):
salary_min: int | None = None
salary_max: int | None = None
currency: str = ""
#: The pay a board stated, as one human-readable line, whether or not it
#: could be normalised into `salary_min`/`salary_max`/`currency`
#: (`plugins.ats`'s per-host `_*_salary_text`; docs/decisions.md).
salary_text: str = ""
seniority: str = ""
function: str = ""
permit: Permit = ""
@@ -372,6 +376,20 @@ class Role(Model):
#: column: loaded from `role_tags` alongside the row, see `Store.role`.
tags: list[str] = []
@computed_field # type: ignore[prop-decorator]
@property
def salary_state(self) -> Literal["normalised", "stated", ""]:
"""Not a column: 'normalised' when `salary_min` or `salary_max` is
set, 'stated' when only `salary_text` is, '' otherwise. Gates and
scoring read `salary_min` alone and never this (docs/decisions.md);
it is what the feed's Pay filter and badge read instead
(`Store.PAY`, `static/roles.js`)."""
if self.salary_min is not None or self.salary_max is not None:
return "normalised"
if self.salary_text:
return "stated"
return ""
class ExtractResult(ModelTaskResult):
"""What one run of `extract` did. See app/jobs/extract.py."""