Skip to content

Test a base URL with a path prefix and non-ASCII event text - #22

Merged
dmccoystephenson merged 1 commit into
mainfrom
trace/test-endpoint-prefix-and-utf8
Oct 22, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
trace/test-endpoint-prefix-and-utf8

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle: two characterization tests are added for wire-format behavior that was previously unexercised. No production code is changed.

  • test_a_base_url_with_a_path_keeps_it_in_front_of_the_endpoint — a base URL under a path prefix (a trace server behind a reverse proxy, …/trace//) is posted to /trace/api/metrics: the prefix is kept and every trailing slash is stripped. This locks in the README's POST {base_url}/api/metrics for more than a bare host.
  • test_non_ascii_names_and_tags_arrive_intact_as_utf8_json — a non-ASCII event name and tag values (Latin-1 accents and an astral-plane emoji) decode on the server to exactly what was reported, sent with the exact Content-Type: application/json; charset=utf-8 header.

Test plan

  • python3 -m unittest locally — Ran 64 tests, OK
  • CI Build — test (3.8), test (3.10), test (3.12)

Issues

No tracking issue — gap found during triage. #16 is skipped: it remains blocked on an owner decision about the README's "tags always holds at least version" promise at the MAX_TAGS cap and on a coordinated change in trace-client-java (see the comment on #16).

trace-client-java

No Java-visible behavior changed (tests only).

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (performed inline in the same session; not an independent review):

  • Scope: PASS — gh pr diff 22 touches only tests/test_trace_client.py (+20 lines, two new test methods).
  • Tests-new: PASS (n/a) — no new public names; __all__ unchanged.
  • Tests-fix: PASS (n/a) — no bug fix; both tests are characterization tests of current behavior and pass against unchanged trace_client/trace_client.py.
  • Sibling structure: PASS — both tests follow the neighbors: TraceClient(self.base_url, ...), capture.arrived.wait(5), close() before asserting, assertion messages naming the promise.
  • Sibling renames: PASS (n/a) — nothing renamed.
  • Docs: PASS — README "The wire format" (POST {base_url}/api/metrics) already describes the behavior locked in; no doc change needed.
  • Issue resolution: PASS (n/a) — no Closes; The version tag is added even when it pushes an event past MAX_TAGS #16's skip reason is recorded in the PR body.
  • CI: PASS — test (3.8), test (3.10), test (3.12) green on the PR head (run 39770539380).
  • Stdlib-only: PASS — no import lines added.
  • Py3.8 floor: PASS — test (3.8) green.
  • Never-raises / never-blocks: PASS (n/a) — no production code changed.
  • Log level: PASS (n/a) — no _LOG calls added.
  • Version agreement: PASS — no version string touched.
  • Exports: PASS (n/a).
  • Java parity noted: PASS — PR body states no Java-visible behavior changed.

Observation (judgment, non-blocking):

  • tests/test_trace_client.py:116 — test_non_ascii_names_and_tags_arrive_intact_as_utf8_json: json.dumps keeps its default ensure_ascii=True, so the body bytes are actually ASCII with \u escapes (which is still valid UTF-8). The test asserts what the server decodes and the exact Content-Type header, not the byte encoding. That is deliberate: a later switch to raw UTF-8 bytes would be equally correct on the wire and should not break this test.

Verdict: tests-only, CI green, no do-not-auto-merge path touched.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit f277849 into main Oct 22, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the trace/test-endpoint-prefix-and-utf8 branch October 22, 2026 11:27
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.

1 participant