Embed a role again when its text arrives, and keep the place its own page gave
A role listed before its page was read kept a title-only vector, and the listing's place replaced the page's on every later pull. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd89381caa
commit
31abad4c8e
5 files changed
+69
-6
No files matched your search
@@ -328,6 +328,30 @@ def test_detail_is_read_for_unread_roles_only(
|
||||
assert state["ats:complete:fake:acme"] == "1"
|
||||
|
||||
|
||||
def test_a_role_read_on_an_earlier_pull_keeps_the_place_its_page_gave(
|
||||
monkeypatch: pytest.MonkeyPatch, web: dict[str, Any]) -> None:
|
||||
"""The listing states a place on every pull, and a filled value replaces
|
||||
a filled column, so for a role already read it is withheld."""
|
||||
base = "https://jobs.fake.example/acme"
|
||||
web["answers"].update({f"{base}/list": b'["1", "2", "3"]', f"{base}/2": b"two in full",
|
||||
f"{base}/3": RuntimeError("down")})
|
||||
module = _fake_host(detail=lambda get, slug, row: {
|
||||
"description": get(f"{base}/{row['source_id']}").decode()})
|
||||
listing = module.parse
|
||||
module.parse = lambda body, slug: [row | {"location": "2 Locations", "remote": "hybrid"}
|
||||
for row in listing(body, slug)]
|
||||
state = {"ats:detailed:fake:acme": json.dumps(["fake:acme:1"]),
|
||||
"ats:detailfailed:fake:acme": json.dumps(["fake:acme:3"])}
|
||||
items, _state = _run(monkeypatch, module, state)
|
||||
|
||||
by_id = {i.source_id: (i.body, i.raw["place"], i.raw["remote"]) for i in items}
|
||||
assert by_id["fake:acme:1"] == ("", "", None)
|
||||
# Read now, and its page stated neither: the listing's stand.
|
||||
assert by_id["fake:acme:2"] == ("two in full", "2 Locations", "hybrid")
|
||||
# Never read: the listing's stand until its page is.
|
||||
assert by_id["fake:acme:3"] == ("", "2 Locations", "hybrid")
|
||||
|
||||
|
||||
def test_detail_reads_stop_at_the_cap_and_the_rest_wait(
|
||||
monkeypatch: pytest.MonkeyPatch, web: dict[str, Any]) -> None:
|
||||
base = "https://jobs.fake.example/acme"
|
||||
|
||||
@@ -549,6 +549,24 @@ def test_upsert_twice_keeps_first_seen_and_bumps_last_seen(
|
||||
("acme", "senior backend engineer", "berlin")
|
||||
|
||||
|
||||
def test_a_vector_made_without_the_text_goes_when_the_text_arrives(store: Store) -> None:
|
||||
listed = posting()
|
||||
listed.body = ""
|
||||
store.upsert_role(listed)
|
||||
store.put_vectors("m", [(listed.uid, np.ones(4, dtype=np.float32))])
|
||||
assert store.roles_to_embed("m", 10) == []
|
||||
|
||||
store.upsert_role(listed) # listed again, still without text
|
||||
assert store.roles_to_embed("m", 10) == []
|
||||
store.upsert_role(posting()) # the role's own page was read
|
||||
assert [r.uid for r in store.roles_to_embed("m", 10)] == [listed.uid]
|
||||
|
||||
store.put_vectors("m", [(listed.uid, np.ones(4, dtype=np.float32))])
|
||||
store.upsert_role(listed) # later pulls send no text
|
||||
store.upsert_role(posting()) # or the same text again
|
||||
assert store.roles_to_embed("m", 10) == []
|
||||
|
||||
|
||||
def test_upsert_unpacks_raw_and_keeps_filled_columns(store: Store) -> None:
|
||||
store.upsert_role(posting(place="Berlin", remote=True, salary_min="80000",
|
||||
salary_max=95000, currency="EUR", department="Eng"))
|
||||
|
||||
Reference in new issue
Block a user