feat: add delete and delete_trace; drop preview language (1.4.0) - #7
Merged
Merged
Conversation
Final leg of the delete fan-out. Propagates the openapi v2.2 delete endpoints (scanii/openapi#46, superseded by #48), following the naming locked by scanii-java and the pattern shipped in dotnet, go, node, rust, php and python. - Scanii::Client#delete(id) — DELETE /v2.2/files/{id}; removes the processing result only, leaving the trace readable - Scanii::Client#delete_trace(id) — DELETE /v2.2/files/{id}/trace; removes the trace only, leaving the result readable - Both return true on 204, matching #delete_auth_token and Java's boolean, and raise Scanii::Error on 404 / Scanii::AuthError on 401,403 via raise_for_status Also drops the "v2.2 preview" designation from retrieve_trace and process_from_url (README, RDoc, TraceResult, test section comments). The spec only ever marked the trace GET as preview, and that marking has now been removed from the contract itself (scanii/openapi#49). Docs only — no behavior change. Historical CHANGELOG entries left intact. VERSION 1.3.1 -> 1.4.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…oder
Not part of the delete work — separated so it can be dropped independently.
url_encode fed every id-taking method through URI.encode_www_form_component,
which renders a space as "+". That is correct for a form body and wrong in a
path, where "+" is a literal plus: delete("a b") requested /files/a+b, so the
server would look up the id "a+b". URI.encode_uri_component gives %20.
Surfaced by a url-encoding assertion added for #delete. Affects retrieve,
retrieve_trace, delete, delete_trace, retrieve_auth_token and delete_auth_token
equally. Not reachable with server-generated ids, which are hex.
Co-Authored-By: Claude Opus 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.
Final leg of the delete fan-out — all 8 SDKs are at the split-delete surface after this.
Three commits, the last one separable.
1.
delete/delete_trace(4d34a5b)Propagates the openapi v2.2 delete endpoints (scanii/openapi#46, superseded by #48). The Aug 30 spec change split what was originally a cascading delete — the two resources are independent:
DELETE /v2.2/files/{id}— removes the processing result onlyDELETE /v2.2/files/{id}/trace— removes the trace onlyA customer deleting a result must not assume the findings went with it.
Scanii::Client#delete(id)→trueon 204Scanii::Client#delete_trace(id)→trueon 204Scanii::Erroron 404 (which is also what a repeated delete of the same id returns) andScanii::AuthErroron 401/403, via the existingraise_for_statustruematches the existing#delete_auth_tokenand Java'sboolean, so parity and local convention agreeVERSION1.3.1→1.4.0inlib/scanii/version.rbper CLAUDE.md §62. Drop the "v2.2 preview" language (same commit)
Docs only — no behavior change. The spec only ever marked the trace GET as preview;
process_from_urlwas a plain 2.2 feature, so labelling it preview was drift. The trace endpoint's marking has since been removed from the contract itself (scanii/openapi#49, merged).Removed from the
retrieve_trace/process_from_urlRDoc, theTraceResultclass doc, the README table, and the test section comments. Historical CHANGELOG entries left intact as a record of what shipped.3. Path-segment encoding fix (
e88a5dd) — separable, not part of the delete workKept as its own commit so it can be dropped without touching the rest.
url_encodefed every id-taking method throughURI.encode_www_form_component, which renders a space as+. That's right for a form body and wrong in a path, where+is a literal plus — sodelete("a b")requested/files/a+band the server would look up the ida+b.URI.encode_uri_componentgives%20.Surfaced by a url-encoding assertion I added for
#delete. Affectsretrieve,retrieve_trace,delete,delete_trace,retrieve_auth_tokenanddelete_auth_tokenequally. Not reachable with server-generated ids, which are hex — so this is latent, not a live bug.URI.encode_uri_componentneeds Ruby ≥ 3.1; the gemspec floor is 3.4.Tests
6 integration tests against scanii-cli hard-asserting the split (new surface → no self-skip): result deleted while trace survives; trace deleted while result survives; repeated delete raises; unknown id raises for both; empty id raises
ArgumentError.10 unit tests via WebMock for what integration can't isolate: HTTP verb, exact path, id url-encoding, and 404/403 error mapping. The 403 case (temporary auth tokens aren't privileged to delete) is covered deterministically.
Verification
All three CI gates locally on Ruby 4.0.3 against scanii-cli v1.12.0:
bundle exec rake test— 84 runs, 193 assertions, 0 failures, 0 errors, 1 skip (pre-existingtest_callback_deliveryself-skip)bundle exec rubocop— 18 files, no offensesgem build scanii-ruby.gemspec— buildsscanii-ruby-1.4.0Plus a consumer-install smoke test, since CI never installs the artifact the way a customer does (the scanii-go lesson): installed the built gem into a throwaway
GEM_HOMEand ran the split flow from there rather than the source tree —delete_trace→ tracenil, result intact;delete→Scanii::Error(404).