Simplify pass + code-review fixes on today's changes - #374
Merged
Conversation
Removed dice.Fixed (unused speculative scaffolding), collapsed shipgen's structureData aliases []string to a scalar, and merged golden/README-freshness test pairs to share one subprocess run each. Also fixed two worldgen -format json bugs found by review: nil TradeCodes rendering as null instead of [], and a mid-loop Fatalf silently dropping already-buffered stdout records. Made shipgen's core-cost test assertion non-tautological by pinning Fuel.Cost independently instead of reading it back off the struct under test. Co-Authored-By: Claude
There was a problem hiding this comment.
Pull request overview
This PR continues the repo’s ongoing cleanup/reproducibility work by removing unused dice scaffolding, simplifying a shipgen lookup table, tightening one shipgen regression test, and reducing CLI golden-test overhead while fixing a couple of worldgen JSON/IO edge behaviors.
Changes:
- Remove unused
dice.Fixedand its tests. - Simplify
shipgenstructure alias handling (slice → single alias) and updateStructureByNameaccordingly. - Improve CLI stability/perf: worldgen JSON
tradeCodesnow renders[]instead ofnullfor no-code worlds; golden/README tests share a single subprocess run via subtests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/shipgen/shipgen.go | Collapses structure alias data to a single optional alias string. |
| internal/shipgen/generate.go | Updates StructureByName to match against the single alias field. |
| internal/shipgen/design_test.go | Makes the Murphy core-cost assertion non-tautological by pinning fuel cost independently. |
| internal/dice/dice.go | Removes the unused Fixed roller constructor. |
| internal/dice/dice_test.go | Removes tests specific to the deleted Fixed helper. |
| cmd/worldgen/main.go | JSON output now uses [] for empty trade codes and flushes buffered stdout before fatal exit on encode error. |
| cmd/worldgen/golden_test.go | Merges golden + README freshness checks into subtests sharing one run. |
| cmd/shipgen/golden_test.go | Merges golden + README freshness checks into subtests sharing one run. |
| cmd/sectorgen/golden_test.go | Merges golden + README freshness checks into subtests sharing one run (with README prefix comparison). |
| cmd/chargen/golden_test.go | Merges golden + README freshness checks into subtests sharing one run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dice.Fixed(unused speculative scaffolding — flagged by all three cleanup review angles as having zero real callers) and its tests.shipgen.structureData'saliases []stringfield to a scalaralias string, since only one row ever used it.cmd/{worldgen,chargen,sectorgen,shipgen}/golden_test.gointo a single test witht.Runsubtests, so each pair shares one subprocess spawn instead of two.cmd/worldgen/main.go:-format jsonnow coerces a nilTradeCodesslice to[]before encoding (was renderingnullfor a world matching no trade code).cmd/worldgen/main.go: flush the buffered stdout writer before a mid-loopcli.Fatalf, so an encode error no longer silently discards already-generated records.internal/shipgen/design_test.go:TestDesignMurphy's core-cost assertion now pins Fuel.Cost independently (matchingTestFuelMurphy's own formula) instead of reading it back off the struct under test, so it can actually catch a fuel-cost regression.Test plan
task check(golangci-lint + full test suite) green