test: cover the configuration the JS client forwards into each request - #17
Merged
Merged
Conversation
ref, apiBase, a forced raw transport with a token, token trimming, the Contents API headers, target trimming, the size-limit boundary and the two standalone fetchers had no asserting test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Self-review rubric (anchored on CI run 37108483239 on the head SHA and on
Judgment call flagged: Local anchor: UNVERIFIED ( This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
Stage B (unit-test expansion) on
js/src/client.ts. Characterization tests only — no production code is changed.Several configuration options and branches in the client were accepted but never asserted to reach the outgoing request. Tests were added for:
ref— a non-default ref reaches the raw-host URL (and is trimmed); a blank ref falls back toHEAD; on the Contents API it is sent as an encoded?ref=query parameter.apiBase— a GitHub Enterprise base (with a trailing slash) is used for API requests.rawtransport with a token configured — the token is not sent toraw.githubusercontent.com(headers are exactly{Accept: 'text/plain'}). This is a credential-handling property that had no asserting test.Accept: application/vnd.github.raw, the pinnedX-GitHub-Api-Version, and a token arriving with surrounding whitespace is trimmed before it goes intoAuthorization.fetchMarkdown(' rules ')resolves the catalogue entry.maxDocumentBytesis served.fetchRawMarkdownapplies its ownmaxDocumentBytesand passes an abort signal;fetchApiMarkdownsends noAuthorizationheader for anundefined,null, empty, or blank token.While reading
fetchMarkdown, the size check was found to comparestring.lengthafter the full body is buffered, so it bounds neither bytes nor memory. Per the Stage B rule that production code is not changed under a test-expansion cycle, no test was written to lock that behavior in; it is filed as #16.Half:
js/only.Deferred issues: #5 and #6 are release/publishing prerequisites that require operator actions outside this repository (npm token and scope, PyPI trusted publisher, environments), so neither can be closed by a code change.
No tracking issue — coverage gap found during triage.
Test plan
js (18 | 20 | 22)green on the head SHA:npm run typecheck(the tests are included intsconfig.json) andnpm testpythonlegs green (unaffected)nodeis not installed in the session sandbox, so the new tests were not run locally; CI on the PR head SHA is the anchor.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