Repository navigation
Add Journal Sets - #64
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
FreeAgent's journal sets had no coverage. This adds all six operations and a
journal-setcommand group.journal-set listtakes--from-date,--to-date,--updated-sinceand--tag. Sets are listed by date,with the undated opening balances set first.
journal-set createneeds--dated-on,--descriptionand at least one--entry;--tagis optional.--entryis one entry as a JSON object with the API's entry fields (category,debit_value, negativefor a credit,
description,user,capital_asset_typeand so on), over several lines if wanted. It decodesstraight into the generated
JournalEntryPayload, so anything that isn't an entry object, including an unknownfield, is refused before sending (exit 64). The CLI adds no checks of its own: a missing category is FreeAgent's
422.
journal-set update <id>changes only the fields passed;--tag ""removes the tag. Passing--entryreplaces every entry: the CLI reads the set, then sends
_destroywith each existing entry's ID plus the newones in one PUT, so the new entries must balance on their own.
--dry-runshows that PUT.journal-set show <id>groups details, dates and IDs, with tables for entries and, on the opening balancesset, bank accounts and stock items.
journal-set opening-balancesshows the opening balances set. Its entries change throughupdatewith itsID.
journal-set delete <id>asks for confirmation, as other deletes do.FreeAgent's refusals pass straight through: an unbalanced set (422), an unknown category (400) and a locked
opening balances field (400) exit 4.
What The Sandbox Showed
Probed under the pinned
X-Api-Version: 2026-09-01, no header and2024-10-01; no shape differs between them.Every probe set was deleted, and the opening balances set's test entries were removed again.
/v2/journal_sets/:id/journal_entries/:id), not/v2/journal_entries/:id. The create response'sLocationis the web page, not the API URL. The update"response" example is really a request.
X-Total-Countand a fullLinkheader are sent. The date,updated_sinceandtagfilters work,tagignoring case, and an invalid date is a 400.sortis ignored.missing value defaults to 0.
901 without a
useris a 404, as is 601 without acapital_asset_type. A capital asset entry comes back ascategory
601-1.contactis only allowed on the opening balances set.category were changed alone with the whole record diffed: nothing else moved.
version, and an unknown ID or another set's entry is a 404 that changes nothing. One without either is added,
and
_destroyremoves one. An unbalancedresult is a 422 that changes nothing. Removing every entry and adding new ones in one PUT works, all or
nothing.
PUT /v2/journal_sets/:id, but its date and description arelocked (400).
Code
paths/journal_sets.yamladdslistJournalSets,createJournalSet,showJournalSet,updateJournalSet,deleteJournalSetandshowOpeningBalances. This takes the total from 117 to 123operations.
JournalSet,JournalEntry,OpeningBalance,JournalSetResponse,JournalSetListResponse,JournalSetCreatePayload,JournalSetUpdatePayloadandJournalEntryPayload, which carriesurland a_destroyboolean for updates, as documented.JournalEntryPayload+ExpressibleByArgumentdecodes--entryas the generated type, as other generatedtypes conform in
ExpressibleByArgument/.JournalEntryPayloadisadditionalProperties: false, so thegenerated decoder refuses an unknown field instead of dropping it. A bad entry gets ArgumentParser's generic
"invalid" message rather than a reason, the cost of having no custom parsing.
none.
Tests
lifecycle that creates a tagged set with a user entry, then updates its fields, removes one entry and changes
another, lists, shows and deletes it. The suite passes against the sandbox, and
changed-suitesselectsjournal_sets.--entryreads a multi-line JSON entry, and refuseskey=valuetext, a non-object, an unknown field and astring value;
updatereads the set only when--entryis given;createneeds at least one entry.--jsonlist and opening balances;JSON entry;
replace refused with nothing changed (exit 4);
🤖 Generated with Claude Code