Converge export sorting onto the key-based ProjectSorter.sortBy API - #45
Converge export sorting onto the key-based ProjectSorter.sortBy API#45dmccoystephenson wants to merge 1 commit into
Conversation
…rtBy API Replaces the boolean-flag sortByScore path with the key-based sortBy API so comparator selection lives in one place, and widens export --sort to accept every sort key the list command supports. - Remove ProjectSorter.sortByScore(List, boolean); sortByIce/sortByRice now delegate to sortBy - Add ProjectSorter.DEFAULT_SORT_KEY, describeSortKey and describeSortDirection so sort-key vocabulary has a single owner - Change ProjectMarkdownWriter.writeMarkdown and MarkdownFormatter.formatHeader to take a sort key, and sort before opening the file so an unsupported key is rejected before the file is touched - Validate export --sort with ProjectSorter.isSupportedSortKey, matching the error message shape the list command uses - Migrate the sortByScore test coverage onto sortBy and document the wider export sort keys in the README Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Test Results87 tests +9 87 ✅ +9 1s ⏱️ ±0s Results for commit 765a653. ± Comparison against base commit 9dad1cf. This pull request removes 9 and adds 18 tests. Note that renamed tests count towards both. |
|
Self-review rubric (anchored on
Findings that call for a judgment rather than a mechanical fix:
This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
|
Merge held pending human review — a protected path matched, so this PR was not merged autonomously despite being otherwise merge-ready. The match is the "single file with more than 50 lines deleted" guard, and the file is a test file: Sixty-eight lines were deleted from Merge-readiness otherwise:
Confirming that the deletions above are the intended test migration is all that is needed to release the hold. This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
Summary
ProjectSorter.sortByScore(List, boolean)path has been removed, so comparator selection is no longer duplicated between it and the key-basedsortBy(List, String)API added for thelistcommand.sortByIceandsortByRicehave been kept as thin delegating wrappers ontosortBy, which preserves their existing test coverage while leaving a single comparator-selection site.ProjectSorter.DEFAULT_SORT_KEY,ProjectSorter.describeSortKey(e.g."ICE score","name") andProjectSorter.describeSortDirection("A to Z"/"highest to lowest") have been added and are consumed by both the export command and the markdown header.ProjectMarkdownWriter.writeMarkdownandMarkdownFormatter.formatHeadernow take a sort key rather than a boolean. As a side effect, every sort key is now available toexport --sort, not onlyiceandrice.projects.mdis truncated. Previously an invalid key could only have been surfaced after the header had already been written.export --sortis validated withProjectSorter.isSupportedSortKey, reusing the error-message shape thelistcommand uses (Invalid sort option. Use one of: name, impact, confidence, ease, reach, effort, ice, rice.).sortByScoretest coverage has been migrated ontosortByrather than deleted, and coverage has been added for the new description helpers, for a name-sorted export end to end, and for the unsupported-key-before-write behavior.export --sortvalues.Behavior notes
exportandexport --sort riceare unchanged for users; the emitted header text for those keys is byte-identical to before.exportstill always sorts (defaulting to ICE), which differs fromlist, where omitting--sortkeeps creation order. This difference has been documented in the README rather than changed, since altering it would change existing export behavior beyond the scope of this issue.Test plan
./gradlew compileJava— BUILD SUCCESSFUL./gradlew test— BUILD SUCCESSFUL, 87 tests, 0 failuresice,riceandnamekeys inMarkdownExportIntegrationTestScope
Eleven files were modified, one over the ten-file soft ceiling; five of the eleven are test files and the non-test net change is well under the LOC ceiling. The remaining open issues (#37, #36, #33, #32, #27, #21, #20, #8) were deferred because this cycle was scoped to a single coherent refactor of the export sorting path; none of them touch it.
Closes #43
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson