Prep stage: host words stored raw, mapped centrally in app/prep after every pull
upsert_role stores the host's own words (roles.*_host), the place texts unresolved when they change, and the company key unresolved on insert, and marks the role prep_due. app.prep maps seniority, employment, remote and country through the host tables in app/prep/hosts, resolves places and company aliases, lists unknown words in `unmapped`, remaps every open role when the tables' fingerprint changes, and runs rebuild_dupes, which moves out of the pull's settle. Migration 22 adds the columns and the table and fills the host words from raw. Cascade: pull, prep, embed, score, enrich, prep, embed, score, extract, score, summarise. `app prep [unmapped] [--remap]`, /api/prep/unmapped and a fold on the Sources page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a66aac95cf
commit
d04ceae7e0
31 files changed
+1468
-330
No files matched your search
+10
-8
@@ -24,6 +24,7 @@ from app.models import Application # noqa: E402
|
||||
from plugins import readers # noqa: E402
|
||||
from plugins.readers import _runner # noqa: E402
|
||||
from plugins.ats import ATSSource # noqa: E402
|
||||
from app import prep # noqa: E402
|
||||
from app.jobs import cascade, pull # noqa: E402
|
||||
from app.storage import Store # noqa: E402
|
||||
|
||||
@@ -142,7 +143,7 @@ def test_close_boards_closes_what_a_completed_board_no_longer_lists(
|
||||
result = pull.close_boards(FakeConfig(), store, FakeTally()) # type: ignore[arg-type]
|
||||
|
||||
assert result == {"boards": 1, "searches": 0, "failed": 1, "incomplete": 0,
|
||||
"roles": 1, "closed": 1, "copies": 0}
|
||||
"roles": 1, "closed": 1}
|
||||
assert {r.source_id for r in store.roles()} == {"greenhouse:acme:1", "greenhouse:other:9"}
|
||||
|
||||
|
||||
@@ -163,13 +164,14 @@ def test_close_boards_never_closes_a_board_stamped_by_an_earlier_run(
|
||||
result = pull.close_boards(FakeConfig(), store, FakeTally()) # type: ignore[arg-type]
|
||||
|
||||
assert result == {"boards": 0, "searches": 0, "failed": 1, "incomplete": 0,
|
||||
"roles": 0, "closed": 0, "copies": 0}
|
||||
"roles": 0, "closed": 0}
|
||||
assert {r.source_id for r in store.roles()} == {"greenhouse:acme:1"}
|
||||
|
||||
|
||||
def test_close_boards_rebuilds_the_copies_after_closing(store: Store) -> None:
|
||||
"""The settle's last step: a board's repeats of one job are one role,
|
||||
and when the kept one closes the next copy is kept in its place."""
|
||||
def test_the_prep_after_the_settle_rebuilds_the_copies(store: Store) -> None:
|
||||
"""The prep that follows the settle folds: a board's repeats of one job
|
||||
are one role, and when the kept one closes the next copy is kept in its
|
||||
place."""
|
||||
sub = store.add_subscription("ats", "greenhouse:acme", label="Acme",
|
||||
company="Acme", board="greenhouse")
|
||||
for job_id in ("1", "2", "3"):
|
||||
@@ -182,8 +184,8 @@ def test_close_boards_rebuilds_the_copies_after_closing(store: Store) -> None:
|
||||
class FakeTally:
|
||||
results = ({"roles": 3, "run": "run-1"},)
|
||||
|
||||
result = pull.close_boards(FakeConfig(), store, FakeTally()) # type: ignore[arg-type]
|
||||
assert result["copies"] == 2
|
||||
pull.close_boards(FakeConfig(), store, FakeTally()) # type: ignore[arg-type]
|
||||
assert prep.run(store).copies == 2
|
||||
[kept] = store.roles_page()
|
||||
assert kept.copies == 2
|
||||
|
||||
@@ -191,7 +193,7 @@ def test_close_boards_rebuilds_the_copies_after_closing(store: Store) -> None:
|
||||
store.state["ats:ids:greenhouse:acme"] = json.dumps(
|
||||
[f"greenhouse:acme:{n}" for n in "123" if f"greenhouse:acme:{n}" != gone])
|
||||
result = pull.close_boards(FakeConfig(), store, FakeTally()) # type: ignore[arg-type]
|
||||
assert (result["closed"], result["copies"]) == (1, 1)
|
||||
assert (result["closed"], prep.run(store).copies) == (1, 1)
|
||||
[after] = store.roles_page()
|
||||
assert after.uid != kept.uid and after.copies == 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user