Skip to content

Send export runs only on a boat that can sail - #281

Merged
dmccoystephenson merged 2 commits into
mainfrom
feature/export-needs-a-seaworthy-boat
Nov 15, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feature/export-needs-a-seaworthy-boat

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • src/business/export.py: an export run is now sent only on a boat that can sail. canSail uses the same test as Take the Helm (Docks.readyToSail): seaworthy and not at sea. No crew is required, because the player sails the run. exportBoat picks the seaworthy boat with the biggest hold, and exportCapacity and canExport follow from it. The hold calculation that used to be duplicated is now holdFor.
  • Markets are gated on the tier of the boat the run actually sails on (runnerTier), not on business.currentTier, the fleet's best hull. A laid-up Fishing Fleet no longer keeps Thornhaven open for a run that goes out on a Trawler.
  • runExport returns a new boat_too_damaged reason when a hull big enough for the market exists but is only damaged. Docks._exportRefusal turns that into "The crossing to X needs a Y, and yours is too damaged to sail. Repair her under Manage Fleet first." instead of "You'd need a Y".
  • Side effect: Gilbert's export hints (Shop._dailyBudgetDialogue, _leftoverAdvice) go through canExport/availableMarkets, so he no longer points the player at the other villages while the only crossing-capable boat is laid up.
  • README Exporting to Other Villages: one sentence now says the run sails on the biggest hold that can put to sea, and a damaged boat stays in port.

Closes #279

Test plan

  • python3 -m compileall -q src
  • Full suite under dummy SDL drivers (in-process pytest.main): 1130 passed (was 1121 on main; 9 new tests), matched by CI on the head SHA
  • Stash check: with the src/ changes stashed, 6 of the new tests fail (damaged-only boat, at-sea boat, damaged Fleet + sound Trawler, the refusal wording, the hidden menu option, the status line naming the sound boat). All pass with the fix. A direct test of the new helpers was added after the stash check. The other 2 new tests are guards that pass either way: just under the damage threshold still exports, and a damaged Rowboat still gets the small-boat refusal.
  • black --check passes on the changed test files and on docks.py. src/business/export.py already fails black --check on main (one missing blank line after EXPORT_MARKETS). That is left out of scope.

Deferred issues

No protected path is modified by this PR.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

dmccoystephenson and others added 2 commits November 14, 2026 19:15
Export picked the biggest hold in the fleet and gated markets on the
fleet's best hull, both ignoring hull damage, so a boat the docks call
"too damaged to sail" still made the crossing - and a laid-up Fishing
Fleet kept Thornhaven open for a run that went out on a Trawler.

The run now sails on the seaworthy (and not at-sea) boat with the
biggest hold, the same hull test Take the Helm uses; that boat sets the
capacity and the reachable markets. A refusal for a big-enough hull
that is only damaged points at the repair instead of a bigger boat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (head f7147df, CI run 43667203843 green: test 1130 passed, docker pass):

  • Scope: PASS. All 5 files are needed for Export runs sail on a boat the docks call too damaged to sail #279: export logic, the docks refusal, the tests for each, and the README export paragraph. No formatting churn. src/business/export.py's existing black --check failure (a missing blank line after EXPORT_MARKETS) was left untouched.
  • Tests-new: PASS. When this rubric was first scored, holdFor, canSail and runnerTier were only exercised indirectly through exportBoat/exportCapacity. That was scored FAIL, and test_holdFor_canSail_and_runnerTier_report_on_the_boat_itself was added in f7147df to test them directly. The boat_too_damaged reason and its refusal text are each tested.
  • Tests-fix: PASS. With src/business/export.py and src/location/docks.py stashed, 6 of the new tests failed. With the fix restored, they passed. The 2 guards (just under UNSEAWORTHY_DAMAGE still exports; a damaged Rowboat still gets the small-boat refusal) pass both ways by design.
  • Sibling structure: PASS. The new tests follow the # prepare / # call / # check layout and reuse createExporter/createExportingDocks. No new files.
  • Sibling renames: PASS. Nothing was renamed. exportCapacity/exportBoat now share holdFor, where the hold calculation used to be duplicated.
  • Docs: PASS. README Exporting to Other Villages now says the run sails on the biggest hold that can put to sea, and a damaged boat stays in port. No schema, PLANNING or version change applies.
  • Issue resolution: PASS. Each behaviour named in Export runs sail on a boat the docks call too damaged to sail #279 is changed: the damaged boat no longer exports, the market gate follows the sailing boat, and the refusal points at the repair.
  • CI: PASS. Both jobs are green on the head SHA.
  • Schema-sync: PASS (n/a). No persisted field was added. atSea/damage are read, not written.
  • Money-format: PASS (n/a). No new money display.
  • Deterministic-tests: PASS. No new test reaches random. runExport is only reached on refusal paths, before fishValue rolls.
  • Headless-pygame: PASS (n/a). No pygame path.
  • camelCase: PASS. holdFor, canSail, runnerTier, _hullRefusal.

Judgment notes, not blocking:

  • src/business/export.py runnerTier: this relies on the biggest hold also being the highest tier. That holds for the current catalogue: a hauling Trawler's 375 is less than a Fishing Fleet's 600. A future catalogue where a hauling hull outcarries the next tier up would make the market gate follow the hauler.
  • src/business/export.py _hullRefusal: a big-enough boat that is only at sea, not damaged, would still get the small-boat refusal. That can't currently happen through the UI, because voyages run synchronously from Take the Helm.
  • src/location/shop.py: Gilbert's "Why can't you buy my whole catch?" question is gated on canExport, so it is hidden while the only crossing-capable boat is laid up. This is consistent with his export advice being withdrawn at the same time.

Summary: ready to merge. CI is green, the stash check confirmed FAIL→PASS, and no do-not-auto-merge path is touched.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 12d7875 into main Nov 15, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/export-needs-a-seaworthy-boat branch November 15, 2026 02:23
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.

Export runs sail on a boat the docks call too damaged to sail

1 participant