extract pup-owned helpers out of the generator-owned client.rs/util.rs#658
Merged
MintsInc merged 1 commit intoJul 20, 2026
Merged
Conversation
openapi-transformer's pup generator copies client.rs/util.rs byte-for-byte from a bundled snapshot on every regeneration, but only make_api!/ make_api_no_auth! and util::read_json_file are actually generator-relevant. Everything else was pup's own hand-written command logic that just happened to live in those files, so a routine feature PR (#654, event posting) got silently reverted the next time the client was regenerated (pup#651). Split both files along the generator/hand-written boundary, mirroring how main.rs/generated.rs already separate hand-written and generated code: - client.rs keeps only what make_api!/make_api_no_auth! need: BearerAuthMiddleware/UserAgentMiddleware, make_dd_config/make_dd_client, the two macros, UNSTABLE_OPS. - New raw_client.rs holds the rest: HttpError/HttpResponse, AuthType/ get_auth_type, the OAuth-exclusion table + apply_auth, parse_response_json, and every raw_* HTTP helper used by ~16 hand-written commands for endpoints not covered by the typed SDK. - util.rs keeps only read_json_file. New util_ext.rs holds time/duration parsing, the monitor-diff helpers, parse_compute_raw, and percent_encode. Pure move: identical function bodies/signatures, only import paths changed.
MintsInc
marked this pull request as ready for review
July 20, 2026 11:37
nogates
approved these changes
Jul 20, 2026
MintsInc
deleted the
ulysse.mavrocordatos/AAWF-1384/extract-common-owned-helpers
branch
July 20, 2026 11:39
rachelyangdog
added a commit
to rachelyangdog/pup
that referenced
this pull request
Jul 20, 2026
main moved raw_get/raw_post/raw_put from client.rs into a new raw_client module (DataDog#658). Update the catalog and session commands to call through raw_client so the branch builds against current main. Co-Authored-By: Claude Sonnet 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.
Context
openapi-transformer's pup generator treatsclient.rsandutil.rsas fully generator-owned files, copied byte-for-byte from a bundled snapshot on every regeneration. Tracing what generated command modules actually reference from them (onlymake_api!/make_api_no_auth!andutil::read_json_file) showed nearly everything else in both files was pup's own hand-written command logic that just happened to live there. That mismatch caused a real regression in pup#651: regenerating the client silently deleted an OAuth-exclusion table entry and aread_to_stringhelper, both added by #654 ("feat(events): add event posting") after the last snapshot sync.Changes
Split both files along the generator/hand-written boundary, mirroring how
main.rs/generated.rsalready separate hand-written and generated code:client.rsshrinks to exactly whatmake_api!/make_api_no_auth!need:BearerAuthMiddleware/UserAgentMiddleware,make_dd_config/make_dd_client, the two macros,UNSTABLE_OPS.src/raw_client.rsholds everything else:HttpError/HttpResponse,AuthType/get_auth_type, the OAuth-exclusion table +apply_auth,parse_response_json, and allraw_*HTTP helpers — the "raw/generic Datadog HTTP client" subsystem used by ~16 command files for endpoints not covered by the typed SDK.util.rsshrinks to justread_json_file. Newsrc/util_ext.rsholds everything else: time/duration parsing, the monitor-diff helpers,parse_compute_raw,percent_encode.openapi-transformerto fully own without future feature work (like feat(events): add event posting #654) getting silently reverted on the next regeneration.Tests
cargo build --all-targets,cargo test,cargo clippy --tests -- -D warnings,cargo fmt --checkall pass.cargo testshows 3 pre-existing failures (test_cases_timeline/test_dbm_samples_search_uses_documented_payload/test_monitors_diff_detects_changes/test_spans_metrics_list, one of which varies per run) — confirmed identical on unmodifiedmain(aPUP_MOCK_SERVERenv-var race across parallel test threads), unrelated to this change.