Timesheets: model the entry destroy; retire five phantom coverage gaps (#581, #582)
π HELD β draft on purpose, do not merge
Spec-train order is enforced: #628 β ScheduleEntries triad (#546/#547) β #626 β #629 β recurrence absorption.
#626, #628 and #629 all touch spec/basecamp.smithy and the six generated trees, and all branched from the same base. Merging any two in parallel conflicts across every generated tree. Each needs a rebase and a full make generate and counts re-derived from behavior-model.json (never hand-incremented) after the one ahead of it lands.
This PR returns to ready when its turn arrives and it has been rebased.
Lane B2a of the v0.13.0 coverage work: #581 (gauge needle show/update/destroy) and #582 (recording timesheet read + entry create/delete). Six routes were carried as bc3_routes_not_modeled dispositions. One was a real gap. Five were not.
The one real gap: DELETE /timesheet_entries/:id
Now DestroyTimesheetEntry β 204, @idempotent, natural: true, retryOn: [429, 503], maxAttempts: 3 to match its timesheet siblings. Surfaces as timesheets.destroy(entryId) in all six SDKs.
Verified at the pinned provenance revision 2c0dafba13:
| evidence | |
|---|---|
| drawn | config/routes.rb:187 β resources :timesheet_entries, only: %i[ show update destroy ], controller: "timesheets/entries", flat, no bucket scope |
| renderable | Timesheets::EntriesController#destroy answers format.json { head :no_content }; the legitimate template-less escape hatch, not the GetRecording trap |
| 403 path | the same action answers head :forbidden when Current.person.can_archive_or_trash? is false β hence ForbiddenError in the error set, and an empty-body 403 test in every SDK that has one |
| documented | doc/api/sections/timesheets.md:688, "will return 204 No Content" |
| API-tested | test/api/timesheets/entries_controller_api_test.rb β "destroy entry via flat route" asserts :no_content + reload.deleted?, plus an assert_recognizes on the unscoped route |
TrashRecording did not already cover this: it trashes recoverably, #destroy deletes outright. Go keeps Trash and gains Destroy, each documented against the other.
The five that were not gaps
bc3 draws each of these actions twice, and the SDK already models the flat spelling of every one:
| bc3 route (ledger) | already modeled as |
|---|---|
GET /projects/:id/gauge/needles/:id | GetGaugeNeedle β GET /gauge_needles/{needleId} |
PUT /projects/:id/gauge/needles/:id | UpdateGaugeNeedle |
DELETE /projects/:id/gauge/needles/:id | DestroyGaugeNeedle |
GET /projects/:id/recordings/:id/timesheet | GetRecordingTimesheet |
POST /projects/:id/recordings/:id/timesheet/entries | CreateTimesheetEntry |
Both draws in each pair name the same controller action (routes.rb:186+:737 for needles; :266/:745 and :268/:747 for timesheets). Both controllers branch on @bucket being nil and fall back to authorize_recording, so the flat form is the written path, not an accident. bc3 documents both spellings, its API tests exercise both β "unscoped and scoped routes return identical data for needle" asserts it outright β and the flat needle GET/PUT plus both flat timesheet routes carry live example-markers.
They surfaced in the direction-2 ledger only because bucket_insensitive_key collapses a leading /buckets/:id and nothing else. A tracking_issue on them was a standing promise to ship five duplicate operations across six SDKs for no reachable capability, so they get a truthful disposition instead.
modeled_as, and why it is checked
"We already model that at the other spelling" is exactly the claim that produced ListForwards and RepositionTodolistGroup, so the new disposition is verified, not asserted. The gate requires the named operationId to exist in openapi.json, share the verb, sit at a different path (an identical one means the entry is stale), have bc3's own route table document that path, and have that path be this route with a leading scope removed.
That last rule is a suffix test over _-flattened segments, not a subset test. Subset was the first version and it let GetProjectTimesheet (/projects/:id/timesheet) discharge the recording timesheet route by dropping recordings/:id from the middle β a different endpoint, not a spelling. Flattening is what lets it survive bc3's renames: /gauge_needles/:id β [gauge, needles, :id] is a suffix of [projects, :id, gauge, needles, :id].
Six adversarial substitutions were run against the finished check; all six are rejected with distinct messages:
| substitution | rejected because |
|---|---|
NoSuchOperation | names no operation |
ListGaugeNeedles for needle show | collection cannot stand in for member |
GetTimesheetEntry for needle show | different resource |
GetProjectTimesheet for recording timesheet | interior segment dropped |
ListGauges for needle show | different noun |
CreateGaugeNeedle for entry create | different terminal |
Verification
make check green at this head β REAL exit code captured to a log and grepped back, REAL_EXIT=0, with PRE_SHA == POST_SHA == e75d69de1 and matching tree hashes, ending on a clean working tree.
All six runners dispatch the new conformance fixture and pass it: Go, Kotlin, Ruby, Python and Swift print PASS: Timesheet entry destroyβ¦; TypeScript's default reporter hides case names, so it was re-run with --reporter=verbose to confirm β β¦ Timesheet entry destroy uses /timesheet_entries/{entryId} path.
Nothing here is asserted without a red proof:
- The conformance fixture is not vacuous β mutating its expected path to a bucket-scoped spelling makes
conformance-goexit 2 withExpected request path "/999/buckets/456/timesheet_entries/999" β¦ got "/999/timesheet_entries/999". - The Go unit tests discriminate
DestroyfromTrashβ routingDestroythroughTrashRecordingWithResponsefails them withexpected method DELETE, got PUTandexpected path /12345/timesheet_entries/β¦ got /12345/recordings/β¦/status/trashed.json.
Execution, not cache: Swift produced real Test Suite output; Ruby went 1241 β 1243 runs, 29713 assertions, 0 failures, 0 errors, 0 skips; TS SDK 1285 passed across 80 files; Python 1050 passed. Kotlin's jvmTest reported UP-TO-DATE in the final pass, so it was re-run with --rerun-tasks β :basecamp-sdk:jvmTest and :generator:test both executed, BUILD SUCCESSFUL, exit 0.
make bc3-route-parity passes and now reports 15 dispositions (6 tracking_issue, 2 registry, 2 out_of_scope, 5 modeled_as). Both #581 and #582 tracking_issue entries are gone.
Counts were re-derived from behavior-model.json, not hand-edited: total 240β241, idempotent 78β79, union 201β202, DELETEs 23β24, and SPEC.md's retry-ceiling paragraph 198β199 / 190β191 / 201β202. SPEC.md, SECURITY.md, AGENTS.md and scripts/check-idempotency-parity updated to match.
Two smaller things worth calling out in review:
- The Smithy doc is deliberately one complete sentence on one line. Generators truncate method docs to the first line, so a two-line comment shipped
"Permanently delete a timesheet entry. Returns 403 when the caller may not"into the TS/Ruby/Kotlin service docs. DestroyTimesheetEntryneeded aRESOURCE_TYPE_OVERRIDESentry in the TS, Kotlin and Swift generators.Destroyis not a verb pattern, so resource-type inference falls through to a generic"resource"and would have filed this delete away from theget/create/updatesiblings that reporttimesheet_entry. Ruby and Python emit noresourceType, so they need nothing.
Notes
- Additive only. No existing operation, path or signature changes.
- Not train-blocked: #544 is an open issue with no PR, and no open PR touches
spec/oropenapi.json. Both halves of this are now false and it is superseded by the hold banner above. #544 shipped as #628, and #629 also touchesspec/. All three branched from the same base and must land in order (#628 β triad β #626 β #629), each with a rebase, a fullmake generate, and counts re-derived frombehavior-model.json. - Reporting, not closing: #581 is not a defect and needs a maintainer decision on whether to close it as already-covered β deliberately no closing keyword for it. #582 is genuinely closed by the new operation.
Separate finding β pre-existing, deliberately not fixed here
The same RESOURCE_TYPE_OVERRIDES gap already ships in the gauge service, inside #581's own resource family:
GetGaugeNeedle β resourceType: "gauge_needle"
UpdateGaugeNeedle β resourceType: "gauge_needle"
DestroyGaugeNeedle β resourceType: "resource" β inconsistent
ToggleGauge β resourceType: "resource" β inconsistent
ListGaugeNeedles β resourceType: "gauge_needle"
CreateGaugeNeedle β resourceType: "gauge_needle"
Destroy and Toggle are both absent from the verb-pattern list. The fix is two more override lines in each of the three generators. I left it out because it changes an observability string on already-shipped operations β that is a bug, and folding it into an enhancement PR would file it wrongly in the release notes. Happy to open it as a follow-up. Note also that nothing in make check catches this class; a lint asserting every operation in a service family agrees on resourceType would.
Also unfixed and unrelated: several per-SDK README service tables list stale method rosters β typescript/README.md:479 shows forRecording, forProject, report (missing get/create/update), go/README.md:460 shows MyEntries, ProjectEntries for methods actually named Report/ProjectReport/RecordingReport/Get/Create/Update/Trash. Adding only destroy would have made them half-true.