Loading…
Reference in a new issue
No description provided.
Delete branch "fix/522-524-small-correctness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two small, independent correctness fixes, one commit each.
#522 —
QuestBoardApiErroraccepted anything as its response__init__readgetattr(response, "status_code", 0), so a caller passing a string where the response belongs gotstatus_code == 0and an empty detail — whichuser_message_forrenders as "Could not reach Quest Board right now. Please try again shortly." The bot announcing an outage because the bot got its own arguments wrong, three layers from the mistake.VotingClosedErrorwas raised that way during the #373 rebase and was caught only because a test happened to cover that path. A missingstatus_codeis now aTypeError. The message names the type that was actually raised, so a subclass does not report its parent's name — with a test for that, since a guard written on the base class is the obvious place to get it wrong.#524 — the proposal count did not match the proposal page
count_bot_proposalswas the one bot-proposal surface without thedeleted_at IS NULLpredicate thatlist_bot_proposalsdirectly above it, andattention_service's "Needs you" query, both carry. Every soft-deleted proposal widened the gap.Worth noting it is not only the cosmetic disagreement the issue describes: this count is the
X-Total-Countthe proposals page paginates on, so a large enough gap offered a page of suggestions that came back empty.The regression test went into
test_lore_soft_delete.py, whose header says there is deliberately a test per surface rather than one test for the flag — the count was the surface it was missing.One thing found alongside
LoreEntry.deleted_at's comment told the reader "every read filters on it; seelive_lore_entriesin lore_service for the one helper they all go through." No such helper exists, or ever has. A reader trusting that comment would conclude the filtering was centralised, when in fact every query carries its own predicate — which is precisely how this one went missing for four releases. Comment corrected to say what the code actually does. (Squarely the shape of thing #442/#444 are about.)Deliberately not changed
campaigns.py:3454, the approve-a-proposal lookup, also omits the filter, so a stale browser tab could approve an already-trashed proposal and resurrect it. That is a write path with different consequences, not a count, so it wants its own issue rather than a quiet ride along here.delete(LoreEntry)statements that clear stale proposals omit it on purpose — hard-deleting a trashed proposal is the intended outcome there.Tests
442 passed3430 passed, 13 skippedruff check/ruff format --checkclean under CI's pinned 0.4.4Both new tests were confirmed to fail against the pre-fix source.
Closes #522
Closes #524
🤖 Generated with Claude Code