Skip to content

Remove dead variables in make_ptc_api_call - #6

Merged
pavel-te merged 1 commit into
OnTheGoSystems:mainfrom
SNO7E-G:remove-dead-code
Aug 5, 2026
Merged

Remove dead variables in make_ptc_api_call#6
pavel-te merged 1 commit into
OnTheGoSystems:mainfrom
SNO7E-G:remove-dead-code

Conversation

@SNO7E-G

@SNO7E-G SNO7E-G commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary. Delete two local variables that were assembled but never read.

Problem. auth_header and additional_curl_params were built as quoted strings (-H "…", -F "…") but nothing consumed them — each curl call inlines its own headers and form fields. The code reads as if auth flows through a variable when it doesn't.

Change. Remove the four auth_header / additional_curl_params assignments; keep every interleaved log line (Using API token…, No API token provided…, Including additional_translation_files…) and refresh the stale comment, so output is unchanged.

Risk. None — the variables had no readers; curl behaviour is byte-identical.

Verified. grep shows zero remaining references; test-runner (12) and test-error-shapes (22, exercises the upload/process path) green. Independent review confirmed truly dead, no log lines dropped.

auth_header and additional_curl_params were assembled as quoted strings but
never read — each curl invocation inlines its own -H/-F. Drop both, keeping the
debug/warning log lines they were interleaved with so output is unchanged.
@pavel-te
pavel-te merged commit 920f458 into OnTheGoSystems:main Aug 5, 2026
@pavel-te

pavel-te commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Merged — thank you, and sorry it sat here for two weeks.

I verified the claim independently rather than taking it on trust, and it holds exactly as described: git grep finds each variable only at its own assignment, never at a read. The three log lines are preserved, --version output is byte-identical, and the full suite (215 examples across six files) is green with this applied on top of the rate-limit work that landed in #11 — which touched the same function, so this was the one place a stale branch could have hurt. It merged clean.

Worth naming the part your summary undersold: auth_header was interpolating the API token into a string that nothing ever consumed. A dead variable holding a live secret is a little worse than dead weight — it is one set -x away from a token in a CI log. Removing it is a small security improvement, not only a tidy-up.

Also appreciated: keeping the interleaved logging while deleting the assignments, and rewriting the comment to say what the code now does instead of leaving it describing the removed variable. That is the part these cleanups usually get wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants