Skip to content

Say what the install ID needs and what isBot and pagePath fall back to - #39

Merged
dmccoystephenson merged 1 commit into
mainfrom
feat/docs-sweep-runtime-installid-isbot
Nov 8, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feat/docs-sweep-runtime-installid-isbot

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage A documentation accuracy sweep: every source of truth was checked against trace-client.ts, and the drift below was fixed in the docs. No behavior changed.

  • README intro, runtime list. It said the client uses only fetch, AbortController, setTimeout and URL (plus process.env). The optional installation ID also uses crypto.randomUUID (randomId(), guarded, with a Math.random() fallback) and process.getBuiltinModule (builtin(), guarded). The file header already mentions the second. The intro now names both and links to the installation-ID section.
  • Installation-ID heading. "Every event carries a random installation ID" overclaimed. The install tag is sent only when installId or installIdFile is given (constructor, this.install), and the section's own first sentence says "can also carry". The heading is now "Events can carry a random installation ID", and the one in-page link to it was updated.
  • isBot() / pagePath() fallbacks. The README never said that isBot() treats a missing, empty or blank User-Agent as a bot, even though the middleware example depends on it. It also never said that pagePath() returns / for a non-string or an unparseable absolute URL, or that it adds a missing leading slash. Both are now stated, matching the TSDoc and the code.
  • MAX_VERSION_LENGTH TSDoc. It now says the constant also bounds installId, which the constructor enforces and the README already says. Only the comment changed.
  • A CHANGELOG.md [Unreleased] bullet records the doc changes.

No tracking issue: these gaps were found during the sweep.

Skipped issues

Cross-client parity

No cross-client-visible behavior changed. Only docs and one doc comment were edited, so trace-client-python and trace-client-java need no matching change.

Test plan

  • CI test job green (npm ci, npm run typecheck, npm test on Node 22). Node is not available in the session environment, so CI on the head SHA is the anchor. The only trace-client.ts change is a doc comment.
  • grep confirms no remaining reference to the old heading 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

A documentation sweep against trace-client.ts. The README intro listed
the runtime APIs as fetch, AbortController, setTimeout and URL only,
though the optional install ID also uses crypto.randomUUID and
process.getBuiltinModule when they are present. The heading "Every event
carries a random installation ID" overclaimed, since the tag is sent only
when the program configures an ID. The README now also covers isBot()
treating a missing or blank User-Agent as a bot, and pagePath()'s "/"
fallback. The MAX_VERSION_LENGTH doc comment now says it bounds installId
too. No behavior changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI run 42442024350: # tests 78, # pass 78, # fail 0; typecheck green):

  • Scope: PASS. Three files changed: README.md, CHANGELOG.md, and one doc-comment line in trace-client.ts. Each change fixes a drift item listed in the PR body.
  • Tests-new: PASS (not applicable). No new public member was added.
  • Tests-fix: PASS (not applicable). No bug fix; docs only.
  • Sibling structure: PASS. No new files.
  • Sibling renames: PASS. The heading "Every event carries a random installation ID" was renamed. Its sibling "Every event carries the program's version" is still accurate (withVersion() always adds version), so it was kept. The one in-page anchor link was updated, and grep finds no stale reference.
  • Docs: PASS. Each new README sentence was checked against the code: randomId() (guarded crypto.randomUUID), builtin() (guarded process.getBuiltinModule), isBot() (typeof userAgent !== "string" || !userAgent.trim() returns true), and pagePath() (non-string or unparseable absolute URL becomes "", then /; a missing leading slash is prepended). The constructor enforces the installId length bound against MAX_VERSION_LENGTH.
  • Issue resolution: PASS (not applicable). No Closes; the gaps were found during the sweep.
  • CI: PASS. The test job is green on the head SHA.
  • Zero-dependency: PASS. There are no imports in trace-client.ts and package.json is untouched.
  • Edge gate intact: PASS. git diff origin/main -- tsconfig.json is empty.
  • Never-throws / never-rejects: PASS. No code changed.
  • No console: PASS. No console. lines were added.
  • Export surface: PASS. No export lines changed.
  • Version agreement: PASS. 0.4.1 is unchanged in the header, TRACE_CLIENT_VERSION, package.json, package-lock.json (x2), the README User-Agent line, and the test assertion.
  • Changelog: PASS. An [Unreleased] bullet was added.
  • Cross-client parity noted: PASS. The PR body states that no cross-client-visible behavior changed.

Judgment note (non-blocking): README.md, in the new intro sentence, says "does without them when they are not". That is accurate for crypto.randomUUID (Math.random() fallback) and for getBuiltinModule (an in-memory ID, no file). The installation-ID section gives the details, so the intro was kept short on purpose.

Do-not-auto-merge path check: no protected path matched. There is no version change, no wire-format change, no package.json/tsconfig.json change, and no file with more than 50 deleted lines.

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 cf5dcfb into main Nov 8, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feat/docs-sweep-runtime-installid-isbot branch November 8, 2026 03:17
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