skills: an archived firm skill has no approved version (the kill switch)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uwxqJYwbXKWMeNZfrFuXq
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0a265ebafb
commit
f5ebe67d0b
@@ -250,10 +250,13 @@ def _readable_version(db: DbSession, user: AppUser, skill_id: uuid.UUID,
|
||||
def get_version(db: DbSession, user: AppUser, skill_id: uuid.UUID, n: int) -> dict:
|
||||
"""Version `n`, if this person may read it. `approved_for_firm` tells the checking service
|
||||
whether this is the version the firm approved: an editor can read a proposal too, and a check
|
||||
run against one must not pass as the firm's own."""
|
||||
run against one must not pass as the firm's own. An archived skill has no approved version:
|
||||
archiving is the firm's kill switch, and the checking service reads this flag fresh on every
|
||||
real-contract order, so it stops there at once."""
|
||||
skill, version = _readable_version(db, user, skill_id, n)
|
||||
return {**version_out(version, _files(db, version.id)), "skill_name": skill.name,
|
||||
"approved_for_firm": (skill.scope == SkillScope.firm
|
||||
and skill.status == CatalogStatus.active
|
||||
and skill.current_version_id == version.id)}
|
||||
|
||||
|
||||
|
||||
@@ -330,6 +330,16 @@ def test_version_says_whether_it_is_the_firms_approved_one():
|
||||
assert out["approved_for_firm"] is False
|
||||
|
||||
|
||||
def test_an_archived_firm_skill_has_no_approved_version():
|
||||
"""Archiving is the firm's kill switch: the checking service reads `approved_for_firm` fresh on
|
||||
every real-contract order, so an archived skill stops serving real contracts at once."""
|
||||
approved = _full_version(1)
|
||||
firm = _skill("firm", current=approved.id)
|
||||
firm.status = "archived"
|
||||
out = skills.get_version(_ReadDb(firm, [approved]), OWNER, firm.id, 1)
|
||||
assert out["approved_for_firm"] is False
|
||||
|
||||
|
||||
def test_get_file_returns_the_bytes_of_a_readable_version():
|
||||
version = _full_version()
|
||||
skill = _skill("firm", current=version.id)
|
||||
|
||||
Reference in New Issue
Block a user