Skip to content

test(certainty): settling an uncertain fax frees its number and trunk at once - #126

Merged
DMontgomery40 merged 4 commits into
mainfrom
fleet-20261029/faxbot-issue-86
Oct 30, 2026
Merged

DMontgomery40 merged 4 commits into
mainfrom
fleet-20261029/faxbot-issue-86

Conversation

@DMontgomery40

@DMontgomery40 DMontgomery40 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Settling an uncertain fax ends it at once: tests for #86

The fix for #86 is already on main. It landed in #93 (outbound_store.settle_uncertain_on, called from certainty_service.settle). When a person settles a fax as delivered or not delivered, its delivery ends as success or failed in the same transaction, and an operator_settled event goes into its history. The fax leaves capacity.HOLDING, so the next fax to the same number can go straight away. #100 ended once the faxes settled before #93, #111 made "can't tell" end the fax too, and #109 made the board's Needs you follow the settling list.

This PR adds no product code. It adds the tests the issue asks for, and fixes one README sentence:

  • test_certainty.py: the settle test's lane fixture now runs on a cloud provider (Phaxio) and on your own SIP trunk with one line. Before settling, the fax holds its number, and on the trunk the line is full. After settling as delivered, not delivered or can't tell, nothing holds the number and the trunk has a free line. The second fax to the same number gets no waiting sentence and the worker claims it. Nothing is sent again.
  • test_certainty_http.py: the person settles through POST /certainty/items/{id}/settle with send_again false. The test then reads the fax three ways: Sent's details (GET /admin/fax-jobs/{id}), faxbot status ID (GET /fax/{id}) and the board that faxbot status shows (GET /outbound/now). Before settling, the two fax reads show "Needs review" with its notice and the board lists the fax under Needs you. After settling, the two fax reads show what the person decided ("Failed" for not delivered, "Delivered" for delivered) with no review notice. The board no longer lists the fax under Needs you, nothing holds its number and no new fax was made.
  • README roadmap: the certainty line now says the number and trunk line stop being held.

One board read is shared by every viewer for outbound_now.AGGREGATE_SECONDS (2 seconds). That is by design, and the console polls every 5 seconds. The HTTP test therefore clears the cached board before its last read, as test_outbound_now.py does. This means faxbot status can still list a settled fax for up to 2 seconds after the settle.

Checks on this head (2b0cbd3, on top of main 7446857)

  • make test-local PYTEST_ARGS='tests/test_certainty.py tests/test_certainty_http.py tests/test_outbound_now.py' (SQLite): 75 passed, 61 skipped. The skips are the PostgreSQL variants of the shared database fixture: no PostgreSQL URL was set, and this PR has no schema change.
  • No Makefile or CI lint target exists. The change is tests only, so the console type check and build were not run.
  • secret-scan.sh origin/main: no suspicious added lines.
  • Each new assertion was shown to catch the behaviour it guards. I made one temporary source change at a time, ran only the settle tests with -k, then restored the file with git checkout:
    • (a) certainty_service.settle no longer calls settle_uncertain_on, which is how settling behaved before fix(certainty): settling an uncertain fax ends it and frees its number at once (#86) #93. 8 failed: all six SQLite lane cases (Phaxio and trunk, three outcomes) and both HTTP cases. Each failed on the delivery state still being reconciliation_required.
    • (b) The board's _open_item counts settled items as open. 2 failed: both HTTP cases, at the board assertion. This assertion checks that the board follows the item's state; it does not depend on the delivery being released.
    • (c) capacity.HOLDING also counts failed and success, so a settled fax keeps holding its number. 8 failed: all six lane cases and both HTTP cases, at the holds assertion.

Not checked

  • No live service was used: no fax provider, no SIP trunk, and no partner. Every fax and call record here is synthetic.
  • The PostgreSQL variants were not run locally. CI runs them.
  • Jev was unavailable, so I checked the wording by reading it.

Closes #86

🤖 Generated with Claude Code

DMontgomery40 and others added 3 commits October 29, 2026 23:28
Issue #86 was seen through `faxbot status`, which reads the outbound board
(GET /outbound/now), and `faxbot status ID`, which reads GET /fax/{id}; the
HTTP settle test checked only Sent's details (GET /admin/fax-jobs/{id}).

The test now checks all three before and after settling through
POST /certainty/items/{id}/settle: before, each shows "Needs review" and the
board lists the fax under needs_you; after, both fax reads show the settled
state with no review notice, and the board no longer lists it.

One board aggregate serves every viewer for outbound_now.AGGREGATE_SECONDS
(2 seconds), so the test drops the cached aggregate before its second board
read, as the next poll would see it; test_outbound_now.py does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DMontgomery40
DMontgomery40 marked this pull request as ready for review October 30, 2026 20:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T20:31:25.128253Z 9b2da71 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

DMontgomery40 added a commit that referenced this pull request Oct 30, 2026
@DMontgomery40
DMontgomery40 merged commit 0935370 into main Oct 30, 2026
6 checks passed
@DMontgomery40
DMontgomery40 deleted the fleet-20261029/faxbot-issue-86 branch October 30, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settling an uncertain fax as not delivered keeps it in Needs review and holding its number

1 participant