Wave 2: redacted HTTP debug tracing, --fields recipe, and roadmap status update#76
Merged
Conversation
Completes the wave-2 slice of the roadmap (#65): - Subtask 7 (redacted debug mode): the centralized HTTP layer now traces every request at DEBUG on a 'py_moodle.http' logger, surfaced by the existing --debug flag, as 'HTTP <METHOD> <redacted-url> -> <status>' (plus retry attempts and final failure). Only the method, the redacted URL, and the status are ever logged -- never params, bodies, or headers. Unit tests cover the trace, secret redaction, and DEBUG-only opt-in. - docs/recipes.md: add a '--fields' recipe (the deferred wave-1 doc item). - docs/roadmap-plan.md: add a dated progress-update section mapping which subtasks have actually landed, with PR references. - docs/development.md: document the new http-layer tracing in the --verbose/--debug diagnostics section. Closes #75.
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
Wave-2 slice of the roadmap (#65): completes roadmap Subtask 7 (redacted HTTP debug tracing in the centralized layer), adds the deferred
--fieldsrecipe, and updates the roadmap to reflect what has actually landed.Linked issue
Closes #75 (part of #65).
Changes
src/py_moodle/http.py+tests/unit/test_http.py— the centralized HTTP layer now traces every request atDEBUGon apy_moodle.httplogger (child of the sharedpy_moodlelogger, so the existing--debugflag surfaces it on stderr):HTTP <METHOD> <redacted-url> -> <status>, plus a line per retry attempt and on final failure. Only method / redacted URL / status are ever logged — never params, request/response bodies, or headers. URL query secrets are scrubbed via the existing_redact_url.docs/recipes.md— new--fieldsrecipe (json/yaml/csv projection, field ordering, unknown-field error, empty-value behavior).docs/roadmap-plan.md— dated "Progress update" section mapping subtasks → status → PRs (the phased plan is left intact as the forward-looking design).docs/development.md— documents the new http-layer tracing in the--verbose/--debugdiagnostics section.TDD evidence
Added three tests first: trace-with-status, URL-secret-redaction, and DEBUG-only opt-in. Confirmed red before the
http.pylogging existed (stashinghttp.py→ the trace assertions fail with nopy_moodle.httprecords), green after. One assertion was corrected:urlencodepercent-encodes the***REDACTED***marker, so the test asserts the survivingREDACTEDword while still proving the rawsesskey/wstokenvalues never appear.Commands run:
Backwards compatibility
Fully compatible. Tracing is silent unless
DEBUGis enabled; no request behavior changes. Docs-only for the recipe/roadmap.Notes for reviewers
http.py/config.py); this PR only adds the missing tracing half of the reliability/observability slice, so it does not touch retry/timeout logic.wstoken=%2A%2A%2AREDACTED%2A%2A%2A) — intentional and safe (no secret leak).