Date a role by posted_at, not just first_seen
recency and the newest feed both counted from first_seen, when the app itself first stored a role, so a newly added board's whole backlog scored as freshly posted for two weeks: 10,223 of 15,415 board roles were posted more than 30 days before they were first seen (average gap in days: Ashby 78, Greenhouse 143, Lever 226, Personio 333). Add roles.posted_at (migration 9): the earlier of first_seen and a trusted host's published_at, where TRUSTED_POSTED_HOSTS (app/models.py) records which of the ats and search hosts report a creation date rather than one that moves on an edit, checked against live boards and the live database. A future or pre-2015 date is not trusted either. upsert_role sets it on insert and keeps the earliest on update, so an edit on the board can only move it earlier, never later. recency, the feed's newest order, the "new since" days filter and _top_scope's tie-break now read posted_at; first_seen is unchanged and still what the UI shows as when the app found a role. The row's age in roles.js now shows the posted date instead. A partial index (posted_at DESC, uid) WHERE closed_at IS NULL serves the newest feed; sqlite3's bundled build has no STAT4, so its planner otherwise sorts every open role instead of using it, measured 30x slower on the live database, so Store.roles() forces it for that query shape. Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
This commit is contained in:
1 parent
0558ef19ed
commit
75eca1c914
8 files changed
+335
-33
No files matched your search
+8
-5
@@ -17,7 +17,7 @@ roles out of extract's reach for good.
|
||||
fit cos(role vector, intent vector), min-max scaled across
|
||||
the roles this agent scores in this run: the closest is 1,
|
||||
the farthest 0, a lone role 1
|
||||
recency 0.5 ** (days since first_seen / 14)
|
||||
recency 0.5 ** (days since posted_at / 14)
|
||||
affinity (the agent's affinity for the company + 1) / 3
|
||||
taste cos(role vector, liked direction), min-max scaled like fit,
|
||||
where the direction is mean(liked vectors) - mean(passed vectors)
|
||||
@@ -66,10 +66,13 @@ SEEDED = "agents:seeded"
|
||||
|
||||
# ------------------------------------------------------------------- terms
|
||||
|
||||
def recency(first_seen: str, now: datetime) -> float:
|
||||
"""1.0 for a role first seen now, halving every `HALF_LIFE_DAYS`."""
|
||||
def recency(posted_at: str, now: datetime) -> float:
|
||||
"""1.0 for a role posted now, halving every `HALF_LIFE_DAYS`. `posted_at`
|
||||
is `app.models.posted_at`: the earlier of when the app first saw the role
|
||||
and, for a trusted host, when the board says it was posted — so a
|
||||
months-old backlog a newly added board brings in does not start at 1.0."""
|
||||
try:
|
||||
seen = datetime.fromisoformat(first_seen)
|
||||
seen = datetime.fromisoformat(posted_at)
|
||||
except ValueError:
|
||||
return 0.0
|
||||
days = max((now - seen).total_seconds(), 0.0) / 86400
|
||||
@@ -164,7 +167,7 @@ def score_one(candidate: Candidate, gates: Sequence[Gate], weights: Weights,
|
||||
if failed := failed_gates(candidate, gates):
|
||||
return 0.0, ", ".join(failed)
|
||||
|
||||
terms = [(weights.recency, recency(candidate.first_seen, now)),
|
||||
terms = [(weights.recency, recency(candidate.posted_at, now)),
|
||||
(weights.affinity, affinity_term(candidate.affinity))]
|
||||
terms += [(g.weight, 1.0 if state == 1 else 0.0)
|
||||
for g, state in zip(gates, candidate.gates, strict=True) if g.mode == "prefer"]
|
||||
|
||||
Reference in new issue
Block a user