Skip to content

Test pathKind and makeParentDirectories directly - #20

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-path-helpers
Oct 29, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-path-helpers

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B — unit-test expansion (trace_client::detail filesystem helpers). Test-only; no production code is changed.

  • pathKindTellsAMissingPathFromAFileFromAnythingElse: detail::pathKind is asserted to answer PATH_MISSING for an absent path and for a path below a regular file, PATH_FILE for a regular file, and PATH_OTHER for a directory. Before this, PATH_FILE was never asserted anywhere in the suite.
  • makeParentDirectoriesCreatesEveryAncestorButNotThePathItself: detail::makeParentDirectories is asserted to create every missing ancestor but not the leaf, to leave existing directories alone, to treat a trailing separator as making the last component a parent, and to ignore a failure under a regular file without touching that file. Under _WIN32, the backslash separator is also exercised (built only by the windows job).

Both helpers were previously used only as fixtures by the installation-ID tests, so their own documented behavior had no direct assertion.

No tracking issue — gap found during triage.

Test plan

  • make test (g++, C++11, -Wall -Wextra -pedantic -Werror): 59 tests, 0 failed checks (57 before; +2, both registered in tests[])
  • CI Build green on all jobs (linux g++/clang++ × c++11/17/20, libcurl, sanitizers, macos, windows)

Deferred

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

Both were used only as fixtures for the installation-ID tests, so
nothing asserted that pathKind ever answers PATH_FILE, that a path
under a regular file counts as missing, or that makeParentDirectories
creates every ancestor but not the leaf, leaves existing directories
alone and ignores a failure without touching the file in the way. On
Windows the backslash separator is exercised too.

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

dmccoystephenson commented Oct 29, 2026 •

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI run 40806194179, all 11 jobs green on the PR head):

  • Scope: PASS — the only file changed is test/test_trace_client.cpp: two test functions plus their two tests[] entries. No production code, formatting or renames.
  • Tests-new: PASS (n/a) — no new public function. Both tests target existing detail:: helpers that had no direct assertion.
  • Tests-fix: n/a — not a bug fix. As a substitute check, pathKind was temporarily mutated to never return PATH_FILE, and makeParentDirectories to skip a trailing separator. make test then reported 59 tests, 7 failed checks, with both new tests failing at their own assertions (lines 1152, 1173, 1179). After the header was restored, the run was back to 59 tests, 0 failed checks.
  • Sibling structure: PASS — both are static void functions named as behavior sentences. They use CHECK/CHECK_EQ and the existing tempBase/writeFile/readFile/removeDirectory fixtures, and sit with the installation-ID section.
  • Sibling renames: n/a — nothing renamed.
  • Docs: PASS — no behavior changed, so no README or header comment needs updating. The README does not describe these helpers.
  • Issue resolution: n/a — no Closes. TRACE_CLIENT_CURL override is ignored on Windows when System32\curl.exe exists #1 is deferred as an owner decision.
  • CI: PASS — every job is green. That includes linux-sanitizers (thread; address,undefined) and windows, and the windows log shows both new tests ran (59 tests, 0 failed checks), so the _WIN32 backslash branch was exercised.
  • Registered: PASS — each new name appears twice in the file. The count went from 57 to 59 tests.
  • C++11: PASS — local make test (g++, -std=c++11 -Wall -Wextra -pedantic -Werror) built clean, and the CI c++11 legs are green. clang++ is not installed locally, so the clang legs rest on CI alone.
  • No new dependency / Never throws / Curl argv fixed / Version triple: n/a — trace_client.hpp is untouched.
  • Sanitizers: PASS — both sanitizer jobs are green.

One judgment call worth noting: test/test_trace_client.cpp:1155 asserts that a path below a regular file is PATH_MISSING. On POSIX that comes from ENOTDIR. On Windows _stat reports a not-found error, and the windows job confirms that this also maps to missing.

Summary: test-only characterization of two filesystem helpers. Each new test was shown able to fail. No production change.

This review 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 6168073 into main Oct 29, 2026
11 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-path-helpers branch October 29, 2026 02: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