Plan seniority as a ladder with two tracks and a range filter; the ladder in models

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 12:58:12 +02:00
1 parent d858020068
commit ae978594b4
4 files changed
+111 -4

No files matched your search

+37 -1
View File
@@ -643,12 +643,48 @@ def remote_of(place: str) -> str:
return mode
return ""
#: A role's level, '' when nothing says. From `staff` up a level sits on one
#: of two tracks, individual contributor or people lead, and each rung pairs
#: the two as big tech firms do: Staff with Manager, Principal with Senior
#: Manager, Distinguished with Director. `lead` is a team lead (Team Lead,
#: Supervisor, Teamleiter); a "Tech Lead" or "Marketing Lead" is `staff`.
Seniority = Literal["", "intern", "junior", "mid", "senior", "staff", "lead", "manager",
"director", "exec"]
"principal", "senior_manager", "distinguished", "director", "exec"]
SENIORITIES: tuple[str, ...] = get_args(Seniority)
#: The levels a seniority filter may name: `SENIORITIES` without the unknown.
LEVELS: tuple[str, ...] = tuple(level for level in SENIORITIES if level)
#: The rungs of the ladder from the bottom, each named after its lowest
#: individual level; a range filter names two of them.
RUNGS: tuple[str, ...] = ("intern", "junior", "mid", "senior", "staff", "principal",
"distinguished", "exec")
#: The tracks a filter may keep: `ic` (individual contributor) or `people`.
TRACKS: tuple[str, ...] = ("ic", "people")
#: Each level's rung (an index into `RUNGS`) and track; the rungs below
#: `staff` have no track and pass either.
LADDER: dict[str, tuple[int, str]] = {
"intern": (0, ""), "junior": (1, ""), "mid": (2, ""), "senior": (3, ""),
"staff": (4, "ic"), "lead": (4, "people"), "manager": (4, "people"),
"principal": (5, "ic"), "senior_manager": (5, "people"),
"distinguished": (6, "ic"), "director": (6, "people"),
"exec": (7, "people"),
}
def levels_between(low: str = "", high: str = "", track: str = "") -> tuple[str, ...]:
"""The levels from rung `low` to rung `high` (names in `RUNGS`, '' for
the open end) on `track` (`TRACKS`, '' for both), in `LEVELS` order. A
level with no track passes any track. An unknown name is a ValueError."""
for name, value, allowed in (("low", low, RUNGS), ("high", high, RUNGS),
("track", track, TRACKS)):
if value and value not in allowed:
raise ValueError(f"{name} is one of {', '.join(allowed)}, not {value!r}")
bottom = RUNGS.index(low) if low else 0
top = RUNGS.index(high) if high else len(RUNGS) - 1
return tuple(level for level in LEVELS
if bottom <= LADDER[level][0] <= top
and (not track or LADDER[level][1] in ("", track)))
#: The kind of contract a posting states, as `app.prep` maps a host's word.
#: '' is "it does not say". `plugins/readers/_shared.py` keeps a copy for the
#: readers' own tests, since a plugin imports nothing from `app`.
+69
View File
@@ -0,0 +1,69 @@
# Plan: seniority as a ladder with two tracks, filtered by range
Planned 2026-09-30. It is folded into `decisions.md` and deleted when it lands.
## What the owner asked for
1. **Seniority is real seniority, not only management.** A Principal Solutions Engineer is very senior, and a Staff engineer is on a par with a manager. The filter must rank individual contributors and people leads on one ladder.
2. **A range instead of level buttons**, e.g. "at least Staff", while still allowing a search for manager roles only, as opposed to senior individual contributor roles.
The owner agreed on 2026-09-30 to the ladder below, including Principal one rung above Staff and "Marketing Lead"-style titles as individual contributors.
## Where it stands
`roles.seniority` is one of intern, junior, mid, senior, staff, lead, manager, director, exec. Read as a ladder, it puts a Principal below a Team Lead. Open roles on 2026-09-30:
| Level | Roles | What it holds |
|---|---|---|
| staff | 1,589 | 1,115 Staff, 224 Senior Staff, 495 Principal, 18 Senior Principal |
| lead | 1,398 | 206 team leads and supervisors, 72 tech leads, the rest "Lead X" and "X Lead" |
| manager | 1,109 | 258 Senior Managers, 360 Engineering Managers |
| director | 1,002 | 633 Director, 362 Head, 35 Associate Director |
| none | 11,046 | 49% of 22,314 |
`extract` has given a model level to 495 roles. No agent has a seniority gate.
## Design
**The ladder** is in `app/models.py` on main (step 0, done): `SENIORITIES`, `LEVELS`, `RUNGS`, `TRACKS`, `LADDER` and `levels_between(low, high, track)`.
| Rung (`RUNGS`) | Individual contributor (`ic`) | People lead (`people`) |
|---|---|---|
| intern, junior, mid, senior | the level itself, no track | |
| staff | `staff`: Staff, Tech Lead, Lead X, X Lead | `lead`: Team Lead, Supervisor, Teamleiter; `manager` |
| principal | `principal`: Principal, Senior Staff | `senior_manager`: Senior Manager, Associate Director, AVP |
| distinguished | `distinguished`: Senior Principal, Distinguished, Technical Fellow, SAP Chief Expert | `director`: Director, Head of, Leiter |
| exec | | `exec`: VP, C-level, Managing Director |
`lead` changes meaning, from any lead to a team lead. Rungs below `staff` have no track and pass either track filter. `roles.seniority` stays one column of words, so gates, `extract` and the host tables keep working on words. The range and the track become a list of words in `levels_between`, and the store's `seniority IN (...)` filter is unchanged.
**Titles** (`app/seniority.py`). Highest rung wins, as today. On the same rung, people wins over individual contributor, and an individual-contributor grade on a people title lifts it one rung only when the grade is above the title's own rung:
- "Staff Engineering Manager" is `manager`.
- "Principal Engineering Manager" is `senior_manager`.
- "Principal Product Manager" is `principal`, since a product manager is an individual contributor.
- "Senior Staff Engineer" is `principal`, and "Senior Principal" is `distinguished`.
- "Associate Director" and "Assistant Vice President" are `senior_manager`. "Senior Director" is `director`.
- "Fellow" alone is academic ("Research Fellow", "Postdoctoral Fellow"), so it stays unknown. "Technical Fellow" and "Engineering Fellow" are `distinguished`.
- "Lead Engineer", "Tech Lead", "Marketing Lead" and "Payroll Lead" are `staff`. "Team Lead", "Supervisor", "Shift Leader", "Teamleiter", "chef d'équipe" and "Assistant Store Manager" are `lead`.
**Mapping again.** `app/prep/stage.py` `VERSION` goes to 2, so the next prep maps every open role again with the new title rules. A migration clears `seniority_model` where it is `staff`, `lead`, `manager` or `director`, since those words split and `extract` reads a role again once its model level is empty. It then sets `roles.seniority` to the first of model, stated and title, as `Store.write_prep` does, so the feed never shows a word the filter does not know. Take the next free migration number when merging, since another session adds migrations too.
**Filter.** `GET /api/roles` and `/api/roles/facets` take `level_from`, `level_to` (names in `RUNGS`) and `track` (`ic` or `people`) instead of repeated `seniority`, plus `seniority_unknown` as today. `_feed_filters` turns them into `seniority=levels_between(...)`. A bad name is a 422 sentence. The facets keep counting per level word; the rail sums them per rung for the chosen track.
**Rail.** The Seniority block becomes:
- **From** and **to**, two native selects of the rungs with counts. The rung label follows the track: Staff / Manager, Principal / Senior Manager, Distinguished / Director with both, the side's own name with one.
- **Track:** a three-button group, Both, Individual, People, as the existing `.seg` group.
- **"and roles with no level"** shown once a bound or a track is set, as today.
The ladder reaches `roles.js` from the page (`pages.py` passes `RUNGS` and `LADDER` as JSON), so the words live in `models.py` only. An old address with `seniority=` is ignored.
## Work packages
| WP | Model | Builds | Owns | Needs |
|---|---|---|---|---|
| 0 Ladder | planner | `SENIORITIES`, `RUNGS`, `TRACKS`, `LADDER`, `levels_between` in `app/models.py`; the coverage test of `tests/test_seniority.py` marked xfail until A | done on main | |
| A Levels | Opus | Title rules for the new words and the split of `lead`, with the titles above as cases; host tables (Jobylon "lead" is `staff`, check Personio, SmartRecruiters, Recruitee); `extract`'s prompt describing the ladder and its tracks; prep `VERSION` 2; the migration; the xfail marker removed | `app/seniority.py`, `app/prep/hosts/*.py`, `app/prep/stage.py`, `app/jobs/extract.py`, `app/storage/schema.py`, `tests/test_seniority.py`, `tests/test_prep*.py`, `tests/test_extract.py`, `tests/test_storage.py`, `tests/test_ats_*.py` | 0 |
| B Range | Sonnet | `level_from`, `level_to`, `track` in `app/web/api.py`; the ladder in the page (`app/web/pages.py`, `app/templates/roles.html`); the rail's From, To and Track in `app/static/roles.js` and `app/static/app.css`; tests in `tests/test_web.py`; a screenshot at 390 px and at desktop width | those files | 0 |
A and B share no file and run in parallel. They merge in the order A, then B. The planner then runs `app prep` on the live database, checks the counts per rung, folds this plan into `decisions.md` and deletes it.
+3 -3
View File
@@ -256,15 +256,15 @@ def test_unknown_words_are_listed_per_field_and_host(store: Store) -> None:
def test_a_changed_table_maps_every_open_role_again_without_a_pull(store: Store) -> None:
store.upsert_role(item("1", seniority="Distinguished"))
store.upsert_role(item("2", seniority="Distinguished"))
store.upsert_role(item("1", seniority="Wizard"))
store.upsert_role(item("2", seniority="Wizard"))
with store.transaction() as conn:
conn.execute("UPDATE roles SET closed_at = '2026-09-21' WHERE source_id = 'acme:2'")
assert prep.run(store, tables=TABLES).remapped
assert not prep.run(store, tables=TABLES).remapped
assert store.state[prep.STATE] == prep.fingerprint(TABLES)
learned = TABLES | {"acme": TABLES["acme"] | {"seniority": {"distinguished": "staff"}}}
learned = TABLES | {"acme": TABLES["acme"] | {"seniority": {"wizard": "staff"}}}
done = prep.run(store, tables=learned)
assert (done.remapped, done.read) == (True, 1)
assert (row(store, "1")["seniority"], row(store, "2")["seniority"]) == ("staff", "")
+2
View File
@@ -221,6 +221,8 @@ def test_title(title: str, level: str) -> None:
assert from_title(title) == level
@pytest.mark.xfail(strict=True, reason="WP A of docs/plan-seniority.md adds the title rules "
"for principal, senior_manager and distinguished, and drops this marker")
def test_table_covers_every_level_and_at_least_eighty_titles() -> None:
assert len(TITLES) >= 80
assert {level for _, level in TITLES} == set(SENIORITIES)