eops-368-fix(commands): drop nine commands with no v2 route - #19
Closed
mykhaylob-de wants to merge 1 commit into
Closed
eops-368-fix(commands): drop nine commands with no v2 route#19mykhaylob-de wants to merge 1 commit into
mykhaylob-de wants to merge 1 commit into
Conversation
mykhaylob-de
force-pushed
the
eops-368-fix-stale-commands
branch
2 times, most recently
from
August 31, 2026 19:27
9613d96 to
4ba7293
Compare
mykhaylob-de
marked this pull request as ready for review
August 31, 2026 19:49
make_resource_app() registers create and update by default. Several resources
are read-only in public API v2, so the factory produced nine commands that were
advertised in --help but could only ever return 404 or 405: companies,
budgets, depreciation-books and paper-checks create/update, plus inbox get.
None of them ever worked. There is no bespoke handler for any at any point in
the history; they existed only because the factory registers those verbs unless
told otherwise.
Pass has_create=False / has_update=False for the four resources v2 exposes as
list and detail only. Paper checks additionally drop has_number: the detail
route is keyed by primary key and the schema carries neither internal_id nor
number, so get-id could never resolve and get-number only duplicated get.
Add has_get so inbox can drop its detail command. v2 has no bare /inbox/{id}/,
and both candidate routes require a mandatory type discriminator the generic get
cannot supply, so the command is removed rather than repointed.
Cover it with a test asserting the resulting command surface: the nine stay
unregistered, read-only resources keep exactly list and get, and a writable
resource still has create and update.
Also rename the client's _MAX_RETRIES to _MAX_ATTEMPTS, which is what it counts,
and fold the near-identical retry-after cases into parametrized tests.
mykhaylob-de
force-pushed
the
eops-368-fix-stale-commands
branch
from
September 1, 2026 15:56
54562a0 to
271ddcc
Compare
5 tasks
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
make_resource_app()registerscreateandupdateby default. Several resources are read-only in public API v2, so the factory produced nine commands that shipped in--helpbut could only ever return 404 or 405:companies create/update,budgets create/update,depreciation-books create/update,paper-checks create/update, andinbox get.None of these ever worked — there is no bespoke handler for any of them at any point in the history. They existed only because the factory registers those verbs unless told otherwise.
Checked against the v2 OpenAPI schema: across the 35 factory-built resources, 175 command/route pairs are valid and exactly these nine are not.
Changes
has_create=False, has_update=Falseforcompanies,budgets,depreciation-booksandpaper-checks, which v2 exposes as list and detail only.has_numberfrompaper-checks. Its detail route is keyed by primary key, andPublicPaperCheckSchemaOutcarries neitherinternal_idnornumber, soget-idcould never resolve andget-numberonly duplicatedget.has_getflag soinboxcan drop its detail command. v2 has no bare/inbox/{id}/, and the two candidate routes (/inbox/transactions/{id}/,/inbox/records/{id}/) each require a mandatory type discriminator that the genericgetcannot supply, so the command is removed rather than repointed. Reinstating it needs the command-factory work in EOPS-372.tests/test_stale_commands.py: the nine operations stay unregistered, the four read-only resources keep exactlylistandget, and a writable resource still hascreateandupdate._MAX_RETRIESto_MAX_ATTEMPTS = len(_RETRY_DELAYS) + 1(the old name said 3 while the client makes 4 requests), and merge the two overlapping retry test classes intests/test_client.pyinto one — the duplicated 409-without-Retry-After scenarios become a single test and both unreadable-Retry-Afterparametrizations now share one value list.Verification
Command surface,
origin/main→ this branch (20 commands become 9):companiescreate,updatebudgetscreate,updatedepreciation-bookscreate,updatepaper-checksget-number,get-id,create,updateinboxgetuv sync --locked --dev+uv run pytest→ 171 passed, 125 skipped (169 before the retry-test consolidation, which nets +2 from the shared parametrization).--lockedsucceeds, so no dependency or lockfile changes are needed.uv run ruff check src/ tests/→ All checks passed!;ruff format --check→ 22 files already formatted.dualentry companies create --file company.jsonon the built entry point → usage error, exit 2, offering onlylistandget.companiesregistration) makes the suite fail with 3 failures, e.g.'dualentry companies create' has no v2 route and must not be registered. Reverted immediately; the branch carries no such change.Not covered: the 125 skips are the
X_API_KEY-gated live-API suite, which was not run — nothing here confirms behaviour against a running backend. The test asserts the command surface, so it catches these nine being re-added; it does not catch a newly added resource registering a verb v2 lacks. Generating the command tree from the schema is the durable fix for that, and would also subsume EOPS-372.Test plan
uv run pytest) — 171 passed, 125 skippeduv run ruff check .)dualentry <command>— removed commands exit 2;--helpfor the five affected groups lists only the operations v2 exposes