diff --git a/app/models.py b/app/models.py index 89752b1..b1f4667 100644 --- a/app/models.py +++ b/app/models.py @@ -666,63 +666,6 @@ HAND_REASONS: tuple[str, ...] = get_args(HandReason) # -------------------------------------------------------------- posting dates -#: Hosts whose date is a creation or first-publication timestamp, for a -#: reader that does not declare `READS` yet (see `trusted_posted`); a reader -#: that declares it says so with `fields.posted="trusted"`. Checked against -#: live boards on 2026-09-29: -#: -#: - `greenhouse`: `plugins.readers.greenhouse.parse` already prefers -#: `first_published` over `updated_at`. A live board (adyen) showed a job -#: with `first_published` five months before `updated_at`, proving the -#: first stays fixed while the second moves on an edit — the resettable -#: field decisions.md used to warn against is `updated_at`, which this -#: reads only when `first_published` is missing (rare: 0 of 208 on that -#: board). The large real gaps this migration measured for Greenhouse -#: roles (average 143 days between this date and `first_seen`) are further -#: evidence it holds still rather than tracking every edit. -#: - `lever` (`createdAt`), `ashby` (`publishedAt`), `personio` (`createdAt`): -#: named and shaped as creation dates, with no "last edited" field in the -#: feed at all to reset from, and the same large real gaps as Greenhouse's. -#: - `smartrecruiters` (`releasedDate`), `recruitee` (`published_at`, falling -#: back to `created_at`): `releasedDate` reads the same way; a live -#: Recruitee board (bunq) showed `published_at` and `created_at` minutes -#: apart while `updated_at` had moved days later on an edited posting, -#: confirming the field this migration reads is not the one that moves. -#: - `workable` (`published`): named as a publish date, not an edit one, but -#: only one live board had postings to check (huggingface, 8 roles) and -#: none showed a second, "last touched" field to compare against, so this -#: is trusted on the name and shape alone. -#: - `jobindex`: the RSS `pubDate` a saved search returns. The live -#: database's 158 Jobindex-found roles have a `published_at`/`first_seen` -#: gap of 0.4 to 31 days (median 12), which reads as real, spread-out -#: posting ages rather than a date that jumps to "now" on every re-crawl. -#: - `adzuna`: `created`, an aggregator's own record-creation stamp — named -#: as creation, not modification, like the rest. No live check: this -#: deployment carries no Adzuna key (`plugins.search`'s own docstring: -#: "not yet run live") and no Adzuna subscription exists to fetch. -#: -#: - `teamtailor`: the feed's `pubDate`, and `platsbanken`: `publication_date`, -#: both named as publication. Read on live feeds on 2026-09-29, where the -#: dates were spread over weeks, not checked against stored roles. -#: -#: - `workday`: the role's `startDate`, which matched the listing's "Posted N -#: Days Ago" on twelve tenants; `successfactors`: the role page's -#: `datePosted`; `oracle`: `ExternalPostedStartDate`; `phenom`: the role -#: page's JSON-LD `datePosted`, which is earlier than the listing's date -#: where the two differ; `bamboohr`: `datePosted`; `jobylon`: the role -#: page's JSON-LD date; `rippling`: `createdOn`. Read on live boards on -#: 2026-09-29 by the builders of those modules, not checked against stored -#: roles. The other hosts added that day (Eightfold, Jibe, Gem, Deel, HiBob, -#: HR Manager) state a date nobody checked, and Pinpoint states none. -#: -#: A host not listed here, or a role whose stored `published_at` fails the -#: sanity check in `posted_at`, keeps `first_seen` as its posted date. -_UNDECLARED_TRUSTED: frozenset[str] = frozenset({ - "greenhouse", "lever", "ashby", "workable", "smartrecruiters", "recruitee", - "personio", "teamtailor", "jobindex", "adzuna", "platsbanken", - "workday", "successfactors", "oracle", "phenom", "bamboohr", "jobylon", "rippling", -}) - @lru_cache(maxsize=1) def _declared_posted() -> dict[str, str]: """`fields.posted` of every reader that declares `READS`, by name. Read @@ -740,13 +683,10 @@ def _declared_posted() -> dict[str, str]: def trusted_posted(host: str) -> bool: """Whether `host` states a date that is safe to read as when a role was - posted: its reader declares `fields.posted="trusted"`, or, for a reader - without `READS` (or a search provider not yet a reader), it is in - `_UNDECLARED_TRUSTED`.""" - declared = _declared_posted() - if host in declared: - return declared[host] == "trusted" - return host in _UNDECLARED_TRUSTED + posted: its reader declares `fields.posted="trusted"`. Which field each + host reads, and when it was checked, is in the reader module. A role + without a trusted date keeps `first_seen` as its posted date.""" + return _declared_posted().get(host) == "trusted" #: A `published_at` before this is a parsing slip or a placeholder, not a diff --git a/tests/test_storage.py b/tests/test_storage.py index 9d125a4..7c74865 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -539,15 +539,14 @@ def test_posted_at_trusts_only_a_known_host() -> None: def test_a_reader_that_declares_reads_decides_its_own_date_trust( monkeypatch: pytest.MonkeyPatch) -> None: - """`fields.posted` of a declared reader wins over the fallback set, either - way; a reader without `READS`, or a provider that is none, keeps it.""" + """`fields.posted` of the reader decides, either way; a host with no + reader is not trusted.""" import app.models as models monkeypatch.setattr(models, "_declared_posted", lambda: {"greenhouse": "listed", "gem": "trusted"}) assert not trusted_posted("greenhouse") assert trusted_posted("gem") - assert trusted_posted("jobindex") assert not trusted_posted("taleo")