Close by age what an incomplete board read did not list and what a filtered read spares, so no role stays open for good, as ADR 1.3 has it
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
136047023e
commit
849adb197d
4 files changed
+62
-16
No files matched your search
+21
-14
@@ -37,7 +37,12 @@ not swept clears them.
|
||||
A read narrowed by the agents' fetch terms (`ats:narrowed:<target>`) lists
|
||||
the roles matching a word, which says nothing of the roles it did not list,
|
||||
so it closes by list nothing: a role of such a board closes once the board
|
||||
has not listed it for `STALE_DAYS`, the rule searches have.
|
||||
has not listed it for `STALE_DAYS`, the rule searches have. The same age
|
||||
rule is the floor under every board (ADR Fetch prep and score 1.3): an
|
||||
incomplete read (a ceiling, a page cap without a sweep) and a filtered read,
|
||||
which spares the roles acted on and the remote ones it could not ask for,
|
||||
close by age what no read has listed for `STALE_DAYS` (`_close_aged`), so no
|
||||
role stays open for good.
|
||||
|
||||
A search never closes by its list, even one stamped complete because it
|
||||
read as many results as its provider stated: a search is never a company's
|
||||
@@ -365,7 +370,10 @@ def close_boards(config: Config, store: Store, tally: Tally, *,
|
||||
incomplete += 1
|
||||
if not store.state.get(f"ats:sweep:{sub.target}"):
|
||||
partial.append(sub.target)
|
||||
continue
|
||||
# An incomplete read closes nothing by its list; what no
|
||||
# read has listed for STALE_DAYS still goes.
|
||||
read = _close_aged(store, source, sub.id, json.loads(
|
||||
store.state.get(f"{source}:ids:{sub.target}", "[]")), stale)
|
||||
shut = read
|
||||
closed += shut
|
||||
before = open_before.get(sub.id, 0)
|
||||
@@ -394,8 +402,9 @@ def _close_read(store: Store, source: str, sub: Any, stale: str) -> int | None:
|
||||
clears that record and closes what it did not list, all of it unfiltered
|
||||
(`Store.mark_closed`), filtered sparing the roles acted on
|
||||
(`_close_unlisted`). A filtered read that could not ask for remote roles
|
||||
(`remote_unasked`) spares the remote ones as well, and closes those by
|
||||
age instead."""
|
||||
(`remote_unasked`) spares the remote ones as well. What a filtered read
|
||||
spares closes by age (`_close_aged`), as on an incomplete read
|
||||
(`close_boards`)."""
|
||||
state, target = store.state, sub.target
|
||||
if not state.get(f"{source}:complete:{target}", ""):
|
||||
return None
|
||||
@@ -404,8 +413,7 @@ def _close_read(store: Store, source: str, sub: Any, stale: str) -> int | None:
|
||||
return _close_aged(store, source, sub.id, seen_ids, stale)
|
||||
is_filtered = bool(state.get(f"{source}:filtered:{target}", ""))
|
||||
spare_remote = is_filtered and bool(state.get(f"{source}:remote_unasked:{target}", ""))
|
||||
aged = (_close_aged(store, source, sub.id, seen_ids, stale, remote_only=True)
|
||||
if spare_remote else 0)
|
||||
aged = _close_aged(store, source, sub.id, seen_ids, stale) if is_filtered else 0
|
||||
if state.get(f"{source}:swept:{target}", ""):
|
||||
return aged + _close_swept(store, source, sub, seen_ids, is_filtered,
|
||||
spare_remote=spare_remote)
|
||||
@@ -484,20 +492,19 @@ def _close_unlisted(store: Store, source: str, seen_ids: list[str], subscription
|
||||
|
||||
|
||||
def _close_aged(store: Store, source: str, subscription_id: int, seen_ids: list[str],
|
||||
stale: str, *, remote_only: bool = False) -> int:
|
||||
stale: str) -> int:
|
||||
"""Close the open roles of one board that its read did not list and that
|
||||
no read has listed since `stale` (`roles.last_seen`, which `upsert_role`
|
||||
writes on every listing): the rule for what a read cannot speak for. A
|
||||
read narrowed by terms closes all such roles, as a search does; with
|
||||
`remote_only`, a filtered read that could not ask for remote closes only
|
||||
its remote roles so, sparing those acted on as its list does."""
|
||||
where = " AND remote = 'remote'" + _ACTED_ON if remote_only else ""
|
||||
writes on every listing): the rule for what a read cannot speak for, a
|
||||
read narrowed by terms, an incomplete one, or what a filtered read
|
||||
spares. A role acted on is not spared here: three weeks unlisted is the
|
||||
one evidence a filtered or incomplete read gives."""
|
||||
with store.transaction() as conn:
|
||||
return conn.execute(
|
||||
f"""UPDATE roles SET closed_at = ?
|
||||
"""UPDATE roles SET closed_at = ?
|
||||
WHERE source = ? AND subscription_id = ? AND closed_at IS NULL
|
||||
AND last_seen < ?
|
||||
AND source_id NOT IN (SELECT value FROM json_each(?)){where}""",
|
||||
AND source_id NOT IN (SELECT value FROM json_each(?))""",
|
||||
(store.now(), source, subscription_id, stale,
|
||||
json.dumps(list(seen_ids)))).rowcount
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ What was decided for roledesk and the reason for each. The target design is the
|
||||
|
||||
**A role whose text says remote while no field does is possibly remote, read in prep with no model** (ADR 1.1 and 1.5). A role outside the agent's locations whose remote is unstated could never "turn out to be remote": extract reads only the cut, and the cut needs the gate. 5,016 open roles were rejected that way, 805 of them saying "remote" in their text. A phrase table ("fully remote", "work from home", the Danish and Swedish words) less its denials ("no remote", "remote sensing") marks `remote_text`; the gate's remote member takes the mark as a match while `remote` is empty, and once extract has answered, prep composes `remote` from the model and the mark no longer counts. A false mark costs at most a cut slot.
|
||||
|
||||
**Age is the floor under every board's closing** (ADR Fetch prep and score 1.3). An incomplete read (a ceiling, a page cap without a sweep) closed nothing ever, and a filtered read spared the roles acted on from its list and from age alike, so such roles stayed open for good. Now what no read has listed for 21 days closes under an incomplete read, and what a filtered read spares closes by age too; a role acted on is spared from the list close, which is guesswork, not from three weeks of absence. The alternative was to strike the sentence from the ADR, which would have left "may stay open for good" in the design.
|
||||
|
||||
**Switching a board or search off closes its open roles.** Only a pull that reads a target closes its roles, so a target no longer read would keep them open for good. Switched back on, the next pull reopens what it still lists. A batch in flight when the switch happens reopens them, so the settle closes every switched-off target once more.
|
||||
|
||||
**A destructive switch asks first; a reopening one queues a pull.** Switching a board or search off, replacing a board and detaching one each close roles in a tap, so the page asks first when there are roles to lose, naming the count. Switching a target on, following or setting a board, setting All locations or All roles on and saving a search each queue `pull` at once instead of waiting up to six hours for the schedule. The pull is queued in the API route, not in the page's script, so a script calling the endpoint gets what a click gets; `claim_run`'s refusal is not an error, since the run in flight or the next one reads the change.
|
||||
|
||||
+1
-2
@@ -5,14 +5,13 @@ What is known and not yet fixed, checked against the code on 2026-10-06, after t
|
||||
## For the owner to decide
|
||||
|
||||
- **Advanced rules.** An Advanced row on the agent form can gate on any of twelve fields (seniority, pay, function, ...), while ADR 5.2 makes seniority and pay filters. Either allow them in the ADR in a sentence or take the rows off the form.
|
||||
- **Closing by age on boards.** ADR 1.3 closes a role no read has listed for 21 days. That holds for searches and for boards narrowed by terms; a board read that stays incomplete (a ceiling, the page cap without a sweep) closes nothing ever, and on a filtered board a role with any vote or an application never closes. Since closing is not valued, striking the rule from the ADR is the cheaper way to agree.
|
||||
- **Remote on hosts that take one country a request.** SmartRecruiters, SuccessFactors and Eightfold (14 boards, about 15,000 roles) are still asked for DK, SE alone when the agents want remote, since Europe there is the whole board. Reading them whole is the only way to their remote roles elsewhere.
|
||||
- **Remote listings across countries.** A job posted remote once per country is now one role per country (the fold keeps to one country), which lists a pan-European remote posting several times.
|
||||
- **A search cut at its page cap leaves no record.** In the last pull 4 of 26 searches stopped at a cap (Jobbank and freehire at 1,000 rows, two Jobindex searches at 200). Nothing on a page says so, and Jobbank's feed is not sorted by date, so new ads can lie past the cap.
|
||||
|
||||
## What the ADRs still do not say
|
||||
|
||||
`ADR Fetch prep and score` was brought up to the code on 2026-10-06; left for the owner's read: the Advanced rows above, and the by-age sentences of 1.3.
|
||||
`ADR Fetch prep and score` was brought up to the code on 2026-10-06; left for the owner's read as a whole.
|
||||
|
||||
`ADR Plugins` was rewritten on 2026-10-06 and names a target the code has not reached: a broken plugin left out instead of stopping the app; providers declaring their params with label, kind and choices, so form, CLI and API follow from the module; detail state kept for a search's roles as for a board's; a national provider declaring its implied country; page markers for hosts on a company's own domain; a contract test that names no reader.
|
||||
|
||||
|
||||
@@ -250,6 +250,44 @@ def test_an_incomplete_board_stores_what_it_read_and_closes_nothing(
|
||||
assert (result["boards"], result["incomplete"], result["closed"]) == (1, 1, 0)
|
||||
|
||||
|
||||
def _aged(store: Store, source_id: str) -> None:
|
||||
"""Make a role look unlisted for longer than `STALE_DAYS`."""
|
||||
old = (datetime.now(UTC) - timedelta(days=pull.STALE_DAYS + 1)).isoformat(timespec="seconds")
|
||||
with store.transaction() as conn:
|
||||
conn.execute("UPDATE roles SET last_seen = ? WHERE source_id = ?", (old, source_id))
|
||||
|
||||
|
||||
def test_an_incomplete_read_closes_what_no_read_has_listed_for_stale_days(
|
||||
acme: Store, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A board past its ceiling or page cap is never read complete; a role
|
||||
it has not listed for three weeks still closes (ADR 1.3)."""
|
||||
_answer(monkeypatch, ([_row("1"), _row("2"), _row("3")], True))
|
||||
_pull(acme)
|
||||
_aged(acme, "workable:acme:3")
|
||||
_answer(monkeypatch, ([_row("1")], False))
|
||||
result = _pull(acme)
|
||||
# 2 was listed two pulls ago and stays; 3 has been unlisted for 22 days.
|
||||
assert _open(acme) == {"workable:acme:1", "workable:acme:2"}
|
||||
assert (result["incomplete"], result["closed"]) == (1, 1)
|
||||
|
||||
|
||||
def test_a_filtered_read_closes_a_spared_role_once_it_is_stale(
|
||||
acme: Store, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A filtered read spares a role acted on from its list; after three
|
||||
weeks unlisted the role closes by age like any other."""
|
||||
_answer(monkeypatch, ([_row("1"), _row("2")], True))
|
||||
_pull(acme)
|
||||
uid = {r.source_id: r.uid for r in acme.roles()}
|
||||
agent = acme.save_agent("Hunt")
|
||||
acme.set_vote(agent.id, uid["workable:acme:2"], 1)
|
||||
_answer(monkeypatch, ([_row("1")], True), filtered=True)
|
||||
assert _pull(acme)["closed"] == 0
|
||||
assert _open(acme) == {"workable:acme:1", "workable:acme:2"}
|
||||
_aged(acme, "workable:acme:2")
|
||||
assert _pull(acme)["closed"] == 1
|
||||
assert _open(acme) == {"workable:acme:1"}
|
||||
|
||||
|
||||
def test_a_failing_board_keeps_its_roles_before_stale_days(
|
||||
acme: Store, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
_answer(monkeypatch, ([_row("1")], True))
|
||||
|
||||
Reference in new issue
Block a user