Skip to content

Stop calling delivered reports dropped, and Cubot phones bots - #38

Merged
dmccoystephenson merged 2 commits into
mainfrom
feat/delivered-is-delivered
Nov 7, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feat/delivered-is-delivered

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A delivered report is no longer called dropped. Reading the response body could fail synchronously, as with a custom fetch whose response has no arrayBuffer or one that throws, and that escaped the guard around the read. A 2xx was then logged as could not deliver, and a non-2xx produced two debug lines for one drop. The read is now guarded the same way for a throw as for a rejection.
  • isBot() no longer flags Cubot phones. Cubot is a phone brand, so model names such as CUBOT_X19 and CUBOT NOTE 20 PRO matched the generic bot patterns and those page views went uncounted. The brand-specific alternatives in the pattern are unchanged.

No tracking issue: both gaps were found during triage.

Test plan

  • The regression tests alone are pushed first and CI goes red on exactly the new tests
  • With the fix pushed, CI is green on the PR head with # pass equal to # tests
  • npm run typecheck is green, so the lookbehind and the wrapper still compile against ES2022 + DOM

Cross-client parity

No wire format, opt-out value or disabledReason changed. Whether trace-client-python or trace-client-java carry an isBot equivalent could not be checked, because those repositories could not be read from this run.

Changelog

CHANGELOG.md gains two bullets under [Unreleased]. No version string changed.

Runtime coverage

CI runs Node 22 only. The isBot() pattern now uses a lookbehind, which is ES2018 and is accepted by the ES2022 baseline, but no CI job runs it in the Edge runtime.

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

@dmccoystephenson

dmccoystephenson commented Nov 7, 2026 •

Copy link
Copy Markdown
Member Author

Self-review rubric (head 4ca4399):

  • Scope: PASS, with a note. Three files changed, 12 non-test lines added and 3 removed. Each change serves one of the two fixes. The two fixes are independent of each other, so this is a two-item batch rather than one change; both were small enough to fit the Phase 2 default of 1–2.
  • Tests-new: PASS. No public member was added; the three changed tests cover the two behavior changes.
  • Tests-fix: PASS, shown empirically by test-first push. Run 42342660897 on 6f5af92 (tests only) was red with # tests 78, # pass 75, # fail 3. The failures were exactly does not call a report dropped when reading the body throws, or cannot be done at all, gives a rejected report one debug line when its body cannot be read either, and does not flag real browsers. Run 42342714660 on 4ca4399 (fix added) was green with # tests 78, # pass 78, # fail 0, # cancelled 0.
  • Sibling structure: PASS. No new file. The tests sit in the existing TraceClient and isBot blocks.
  • Sibling renames: PASS. Nothing was renamed.
  • Docs: PASS. The README's debug section and the isBot() TSDoc describe behavior that now holds without edits; CHANGELOG.md gained both entries under [Unreleased].
  • Issue resolution: not applicable. No Closes reference; both gaps were found during triage.
  • CI: PASS. The test job is green on the exact head SHA. The local anchor is UNVERIFIED, because node is not on PATH and npm resolves to a Windows install in this environment, so CI on the head SHA is the anchor.

Repo-specific rubric:

  • Zero-dependency: PASS. trace-client.ts has no import, package.json is unchanged, and no test import was added.
  • Edge gate intact: PASS. tsconfig.json is unchanged and npm run typecheck is green on the head.
  • Never-throws / never-rejects: PASS. The new wrapper turns a synchronous throw into a rejection that the existing .catch absorbs, and it is raced against the existing timeout. A rejection arriving after the timeout wins is handled, because Promise.race has attached to it.
  • No console: PASS. The only console. in the file is the existing TSDoc example.
  • Export surface: PASS. The API shape test is unchanged and no export line was added.
  • Version agreement: PASS. No version string changed.
  • Changelog: PASS. Both user-visible changes have a bullet.
  • Cross-client parity noted: PASS, with a gap stated. No wire format, opt-out value or disabledReason changed. Whether the Python and Java clients have an isBot equivalent could not be checked.

Judgment calls, none blocking:

  • trace-client.ts:494: the lookbehind is repeated on two alternatives rather than factored into one group. This keeps the diff to the smallest edit of a long pattern.
  • trace-client.ts:494: a crawler whose name happened to end in cubot would no longer be caught by the generic patterns. No such crawler is known, and the check is best-effort either way.
  • Lookbehind is ES2018, but CI runs Node 22 only, so nothing executes it in the Edge runtime.

The self-review was performed in the same session that wrote the change, so it is not independent review.

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 52d09ae into main Nov 7, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feat/delivered-is-delivered branch November 7, 2026 05: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