Clear a company's by-hand reason when a board is attached to it

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-29 19:27:55 +02:00
1 parent 940151bdc5
commit 2c3bce99e3
3 files changed
+14 -4

No files matched your search

+4 -3
View File
@@ -46,8 +46,9 @@ def set_board(store: Store, key: str, board: str, *, name: str = "",
a company between openings is still one to follow. `check=False` skips the a company between openings is still one to follow. `check=False` skips the
fetch, for the seed, whose boards were read once when it was written. fetch, for the seed, whose boards were read once when it was written.
The row's `ats` and `ats_slug` become the board's host and slug, and its The row's `ats` and `ats_slug` become the board's host and slug, its
`careers_url` the board's page where it was empty or the old board's. `careers_url` the board's page where it was empty or the old board's, and
its `hand_reason` empty, since a company that is read is not read by hand.
`fields` (domain, country, city, ...) fill only columns that are empty, so `fields` (domain, country, city, ...) fill only columns that are empty, so
nothing a person or the seed wrote is overwritten. Row and subscription nothing a person or the seed wrote is overwritten. Row and subscription
change in one transaction (`Store.set_company_board`), and replacing a change in one transaction (`Store.set_company_board`), and replacing a
@@ -82,7 +83,7 @@ def set_board(store: Store, key: str, board: str, *, name: str = "",
writes["careers_url"] = careers_url(board) writes["careers_url"] = careers_url(board)
else: else:
writes.setdefault("careers_url", careers_url(board)) writes.setdefault("careers_url", careers_url(board))
writes.update(ats=host, ats_slug=slug) writes.update(ats=host, ats_slug=slug, hand_reason="")
before = store.company_subscription(key) before = store.company_subscription(key)
_company, sub, closed = store.set_company_board(key, board, host=host, name=name, _company, sub, closed = store.set_company_board(key, board, host=host, name=name,
fields=writes) fields=writes)
-1
View File
@@ -10,7 +10,6 @@ This is roledesk's own API, over the same store. Every refusal is
from __future__ import annotations from __future__ import annotations
from typing import Annotated, Any, Literal from typing import Annotated, Any, Literal
from urllib.parse import urlsplit
from fastapi import APIRouter, HTTPException, Query, Response from fastapi import APIRouter, HTTPException, Query, Response
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
+10
View File
@@ -83,6 +83,16 @@ def test_set_board_attaches_a_board_to_a_row_without_one(store: Store, boards: B
"ashby", "acme", "acme.example", "met them", "https://acme.example/careers") "ashby", "acme", "acme.example", "met them", "https://acme.example/careers")
def test_set_board_clears_the_reason_a_company_was_read_by_hand(
store: Store, boards: Boards) -> None:
store.add_company("Acme", careers_url="https://acme.example/careers", hand_reason="unread")
sources.set_board(store, "acme", "ashby:acme")
acme = store.company("acme")
assert acme is not None
# The link a person set stays; the reason goes with the board's arrival.
assert (acme.hand_reason, acme.careers_url) == ("", "https://acme.example/careers")
def test_set_board_replaces_a_board_and_closes_its_open_roles( def test_set_board_replaces_a_board_and_closes_its_open_roles(
store: Store, boards: Boards) -> None: store: Store, boards: Boards) -> None:
old, _, _ = sources.set_board(store, "acme", "greenhouse:acme", name="Acme") old, _, _ = sources.set_board(store, "acme", "greenhouse:acme", name="Acme")