Title levels on the ladder: principal, senior manager, distinguished, lead split (WP A)
from_title matches a title twice, for the highest people level and the highest individual grade. A people level wins on its own rung; a grade above that rung lifts it one rung (Principal Engineering Manager is a senior manager). Senior Staff is principal, Senior Principal, Distinguished and Technical Fellow are distinguished; Associate Director, AVP and Senior Manager are senior managers. lead is now a team lead only (Team Lead, Shift Lead, Supervisor, Teamleiter); Tech Lead, Lead X and X Lead(er) are staff. A slash names two levels, so Senior/Staff is staff. - Jobylon "lead" maps to staff; Recruitee maps student_college, manager, senior_manager and executive. - extract's prompt describes the ladder and its two tracks; enum from LEVELS. - prep VERSION 2, so the next prep maps every open role again. - Migration 25 clears seniority_model where it is staff, lead, manager or director, so extract reads those roles again, and sets roles.seniority to the first filled of model, stated and title. - The coverage test of tests/test_seniority.py passes; its xfail is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae978594b4
commit
322db49773
16 files changed
+328
-137
No files matched your search
+44
-9
@@ -70,7 +70,7 @@ def test_schema_creates_on_an_empty_file(tmp_path: Path) -> None:
|
||||
"application_events", "agents", "scores", "state"} <= tables
|
||||
assert "idx_roles_cluster" in indexes
|
||||
assert store.migrations_applied == []
|
||||
assert LATEST == 24
|
||||
assert LATEST == 25
|
||||
# A second open finds it current and applies nothing.
|
||||
assert Store(path).migrations_applied == []
|
||||
|
||||
@@ -187,7 +187,7 @@ def test_a_v14_file_gains_the_watchlist_columns_and_leaves_companies_unrated(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
|
||||
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
|
||||
acme = migrated.company("acme")
|
||||
assert acme is not None
|
||||
assert (acme.ats, acme.careers_url) == ("teamtailor", "https://a.example")
|
||||
@@ -392,7 +392,7 @@ def test_v14_makes_each_intent_the_agents_one_prompt_with_its_vector(tmp_path: P
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
|
||||
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
|
||||
assert migrated.agent(backend.id).prompts == [ # type: ignore[union-attr]
|
||||
Prompt(name="Backend", text="python backend")]
|
||||
assert migrated.agent(blank.id).prompts == [] # type: ignore[union-attr]
|
||||
@@ -416,7 +416,7 @@ def test_v16_gives_a_company_no_reason_and_keeps_its_row(tmp_path: Path) -> None
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24]
|
||||
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
|
||||
acme = migrated.company("acme")
|
||||
assert acme is not None
|
||||
assert (acme.careers_url, acme.notes, acme.hand_reason) == (
|
||||
@@ -445,7 +445,7 @@ def test_v17_folds_every_place_and_levels_the_titles_extract_has_not_read(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24]
|
||||
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24, 25]
|
||||
with sqlite3.connect(path) as conn:
|
||||
rows = {uid: (fold, level) for uid, fold, level in conn.execute(
|
||||
"SELECT uid, place_fold, seniority FROM roles")}
|
||||
@@ -681,13 +681,14 @@ def test_v19_gives_every_role_its_places_and_splits_its_level(tmp_path: Path) ->
|
||||
_undo_v19(conn)
|
||||
# A role whose own page was read is pulled with an empty place in raw.
|
||||
conn.execute("UPDATE roles SET raw = '{}' WHERE uid = ?", (detailed.uid,))
|
||||
conn.execute("UPDATE roles SET extracted_at = '2026-09-23', seniority = 'staff' "
|
||||
# A level 25 does not clear, so the split is what is checked here.
|
||||
conn.execute("UPDATE roles SET extracted_at = '2026-09-23', seniority = 'mid' "
|
||||
"WHERE uid = ?", (extracted.uid,))
|
||||
conn.execute("PRAGMA user_version = 18")
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24]
|
||||
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24, 25]
|
||||
assert [p.name for p in migrated.role_places(joined.uid)] == ["Copenhagen", "Malmö"]
|
||||
assert [p.name for p in migrated.role_places(detailed.uid)] == ["Aarhus"]
|
||||
assert migrated.role_places(stated.uid) == []
|
||||
@@ -699,10 +700,44 @@ def test_v19_gives_every_role_its_places_and_splits_its_level(tmp_path: Path) ->
|
||||
joined.uid: ["senior", "", "", "senior", ""],
|
||||
detailed.uid: ["senior", "", "", "senior", ""],
|
||||
stated.uid: ["lead", "", "lead", "senior", ""],
|
||||
extracted.uid: ["staff", "staff", "", "senior", ""],
|
||||
extracted.uid: ["mid", "mid", "", "senior", ""],
|
||||
}
|
||||
|
||||
|
||||
def test_v25_clears_the_model_levels_the_ladder_splits_and_sets_the_level(
|
||||
tmp_path: Path) -> None:
|
||||
path = tmp_path / "v24.db"
|
||||
store = Store(path)
|
||||
# (model, stated, title) before 25, and what 25 leaves: the model level
|
||||
# of the four split words is emptied, and the level is the first filled.
|
||||
cases = {
|
||||
"staff": (("staff", "", "senior"), ("", "", "senior", "senior")),
|
||||
"lead": (("lead", "mid", "senior"), ("", "mid", "senior", "mid")),
|
||||
"manager": (("manager", "", ""), ("", "", "", "")),
|
||||
"director": (("director", "", "director"), ("", "", "director", "director")),
|
||||
"senior": (("senior", "junior", "lead"), ("senior", "junior", "lead", "senior")),
|
||||
"exec": (("exec", "", ""), ("exec", "", "", "exec")),
|
||||
"none": (("", "", "lead"), ("", "", "lead", "lead")),
|
||||
}
|
||||
for sid in cases:
|
||||
upsert(store, posting(sid))
|
||||
with sqlite3.connect(path) as conn:
|
||||
for sid, ((model, stated, title), _) in cases.items():
|
||||
conn.execute("UPDATE roles SET seniority_model = ?, seniority_stated = ?, "
|
||||
"seniority_title = ?, seniority = 'stale', extracted_at = '2026-09-23' "
|
||||
"WHERE source_id = ?", (model, stated, title, sid))
|
||||
conn.execute("PRAGMA user_version = 24")
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [25]
|
||||
with sqlite3.connect(path) as conn:
|
||||
found = {sid: rest for sid, *rest in conn.execute(
|
||||
"SELECT source_id, seniority_model, seniority_stated, seniority_title, seniority "
|
||||
"FROM roles")}
|
||||
assert found == {sid: list(after) for sid, (_, after) in cases.items()}
|
||||
|
||||
|
||||
def test_upsert_unpacks_raw_and_keeps_filled_columns(store: Store) -> None:
|
||||
upsert(store, posting(place="Berlin", remote=True, salary_min="80000",
|
||||
salary_max=95000, currency="EUR", department="Eng"))
|
||||
@@ -1028,7 +1063,7 @@ def test_roles_filter_by_place_tokens_on_whole_words(store: Store) -> None:
|
||||
|
||||
def test_roles_filter_by_seniority_and_keep_the_unknown_unless_told(store: Store) -> None:
|
||||
for sid, title in (("senior", "Senior Engineer"), ("junior", "Junior Engineer"),
|
||||
("lead", "Tech Lead"), ("none", "Engineer")):
|
||||
("lead", "Team Lead"), ("none", "Engineer")):
|
||||
item = posting(sid)
|
||||
item.title = title
|
||||
upsert(store, item)
|
||||
|
||||
Reference in new issue
Block a user