Skip to content

ci(node): integrate shared benchmark reports - #5454

Open
dustinbyrne wants to merge 6 commits into
feat/node-performance-benchmarksfrom
ci/node-benchmark-reporting
Open

dustinbyrne wants to merge 6 commits into
feat/node-performance-benchmarksfrom
ci/node-benchmark-reporting

Conversation

@dustinbyrne

Copy link
Copy Markdown
Contributor

Changes

Stacked on the Node benchmark producer PR #5453.

  • Invoke the shared harness action in offline render mode inside the existing read-only benchmark job. Upload rendered comparisons separately from the three-file raw artifact.
  • Add a separate default-branch workflow_run consumer using the shared trusted publishing workflow. No SDK/PR code executes in the writable job.
  • Pin the harness action and shared workflow to real published immutable commits and document activation/measurement semantics.

Dependencies:

Both shared components and this caller configuration need normal review. Automatic PR comments activate only after the workflow_run caller lands on the default branch; summaries can render on this PR already.

Validation

  • Actionlint, immutable-pin/path verification through GitHub, and diff checks passed.
  • Real Node/Python result pairs rendered using the shared action code.
  • Shared harness: 185 focused tests; full suite 1,501 passed / 502 skipped. Shared workflow: five boundary/pin checks and 40 existing tests passed.
  • Fresh integrated read-only review covered this wiring and the shared implementation.

CI/tooling only; no SDK runtime, workload, or release changes in this layer. Performance differences remain informational.

Agent context

Autonomy: Human-driven (agent-assisted).
Implemented with Pi and reviewed independently. The stack keeps producer measurements separate from shared reporting integration.

@dustinbyrne
dustinbyrne requested a review from a team as a code owner October 27, 2026 22:04
@dustinbyrne dustinbyrne self-assigned this Oct 27, 2026
@stamphog stamphog Bot removed the stamphog label Oct 27, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved — this change needs a human reviewer.

Re-adding the stamphog label gives the same result unless the changed files change.

stamphog can't auto-approve this pull request because two gates failed. The deny-list gate flagged it as infra_cicd, since it adds .github/workflows/node-benchmark-report.yml and changes .github/workflows/node-benchmarks.yml. The tier gate classified it as T2-never, because it touches CI workflows across two areas. The size gate passed, so splitting the change wouldn't clear the refusal. Please ask a human reviewer, such as a CI or infra owner, to review and merge it.

Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✗ matches: infra_cicd
size ✓ 41L, 2F substantive, 47L/3F incl. docs/generated/snapshots — within ceiling
tier ✗ classified as T2-never: T2-never (47L, 3F, two-areas, ci)
stamphog 2.6.1 .stamphog/policy.yml @ unknown · reviewed head 8783dd4

@dustinbyrne
dustinbyrne added this pull request to stack #5455 October 27, 2026 22:04
@github-actions

Copy link
Copy Markdown
Contributor

📝 No Changeset Found

This PR doesn't include a changeset. A changeset is required to release a new version.

How to add a changeset

Run this command and follow the prompts:

pnpm changeset

Remember: Never use major version bumps for posthog-js as it's autoloaded by clients.

@github-actions

Copy link
Copy Markdown
Contributor
⚠️ `posthog-node` is modified but this PR has no changeset

This is informational — the PR is not blocked. Click the triangle above to collapse, or push a fix and this comment will auto-delete.

Modified in this PR but no changeset added:

  • posthog-node

If this change should ship, run pnpm changeset and select a bump level.
If it isn't user-facing (refactor with no behavior change, internal tooling, generated files), no action needed.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 8783dd4: 2 Should fix.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

contents: read
actions: read
pull-requests: write
uses: PostHog/.github/.github/workflows/sdk-benchmark-report.yml@ced4b9694b90c9221bc277b1c8d9f013eafe56c5 # SDK benchmark workflow (PostHog/.github PR #84)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Preserve queued publishers for different pull requests

When three benchmark runs finish close together, the pinned reusable workflow puts all Node publishers in one concurrency group. GitHub replaces the pending job even with cancel-in-progress: false, so a different PR loses its report. Queue publishers without dropping them or serialize by verified PR.

Comment thread .github/workflows/node-benchmarks.yml Outdated
--repetitions 6

- name: Render benchmark comparison
if: ${{ !cancelled() && (steps.measure.outcome == 'success' || steps.measure.outcome == 'failure') }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Carry measurement failures into partial reports

If run.mjs throws after saving a successful pair, such as on an invalid metric, this step renders the last saved documents without the exception. The publisher also ignores the source-run conclusion, so it posts a normal-looking comparison for an aborted suite. Propagate the measurement failure into both reports.

@github-actions

Copy link
Copy Markdown
Contributor

Coherence

0 spec problems · 0 failing chokepoints · 2 spec gaps · 0 guard failures

44 components, 7 bullets (5 invariants, 2 requirements), 0 problems

Chokepoints: none declared.

Spec gaps: 2 entrances with outside or unknown trust and no traced control, and 10 more held by the adoption baseline

  • packages/web/Web.spec.md entrance public api (trust host-app): packages/web
  • packages/webpack-plugin/Webpack-plugin.spec.md entrance webpack plugin (trust build): packages/webpack-plugin

Close one with guard: <chokepoint>, an invariant that names it on its entrances: line, or control: none — <reason>; scaffold control proposes it.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Node SDK acceptance v2

Commit: f58c2d7
Workflow run and artifacts

Capture v0

✅ 55 passed / ❌ 1 non-passing / ⚠️ 101 not selected

Drill-down: run artifacts → node-v2-v0 → acceptance/report.json.diagnostics.json (match case_id below).

❌ migration/yaml-parity-v1/remote-flags-v1.feature::Omitted GeoIP settings default to enabled in flag requests — failed_assertion

Flags field differs

Code: flag_request_field

Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:134

the first flags request field "geoip_disable" should equal JSON false

Operation: /flags/

Field: geoip_disable

Expected:

false

Actual value:

true

Harness exit: 1; report validation exit: 1.

Capture v1

✅ 120 passed / ❌ 1 non-passing / ⚠️ 36 not selected

Drill-down: run artifacts → node-v2-v1 → acceptance/report.json.diagnostics.json (match case_id below).

❌ migration/yaml-parity-v1/remote-flags-v1.feature::Omitted GeoIP settings default to enabled in flag requests — failed_assertion

Flags field differs

Code: flag_request_field

Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:134

the first flags request field "geoip_disable" should equal JSON false

Operation: /flags/

Field: geoip_disable

Expected:

false

Actual value:

true

Harness exit: 1; report validation exit: 1.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed ee2a194: 2 Should fix.

Comment thread .github/workflows/node-benchmarks.yml Outdated
--repetitions 6

- name: Render benchmark comparison
if: ${{ !cancelled() && (steps.measure.outcome == 'success' || steps.measure.outcome == 'failure') }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Publish failures that occur before measurement

When a build or test:benchmarks fails before measure, this condition skips rendering and the raw artifact contains at most revisions.json. The pinned publisher requires all three result files, so it cannot post the failure and leaves any previous benchmark comment in place. Publish an explicit pre-measurement failure instead.

Comment on lines +143 to +153
...['steady', 'burst'].flatMap((drain_strategy) =>
[32, 4096].map((payload_bytes) => ({
id: `capture.drain.${drain_strategy}.${payload_bytes}`,
mode: 'drain',
payload_bytes,
operations: smoke ? 200 : 1000,
concurrency: 1,
drain_strategy,
flush_every: drain_strategy === 'steady' ? 100 : smoke ? 200 : 1000,
completion_boundary: 'completed_delivery',
passes: ['timing', 'allocation', 'memory'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Reserve time to upload results before the job timeout

The four drain workloads add 144 worker executions to a suite whose prior CI runs already took roughly 20 minutes under a 30-minute job timeout. A slower SDK or runner can exhaust that deadline, cancelling the job before partial results are rendered or uploaded. Bound measurement below the job deadline or increase the timeout with a separate upload reserve.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed f58c2d7: 2 Should fix.

This is review round 3 on this pull request. When findings keep coming back in the same code, the approach is usually the problem. Before the next fix, check whether a different design would remove the whole class of findings.

Comment on lines +111 to +116
- name: Collect and render benchmark comparison
uses: PostHog/.github/.github/actions/benchmark-report@9b34fde6b26df7d874b85d2de09904b4ab701234 # SDK benchmark reporting (PostHog/.github PR #84)
with:
mode: collect
source-status: ${{ needs.benchmark.result }}
shard-manifest: packages/node/benchmarks/shards.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Publish a failure when a shard stops after timeouts

If two workers time out before a shard finishes its inventory, run.mjs saves partial results and stops, but collect rejects their incomplete workload coverage before producing bundle.json. The publisher then has no canonical artifact and leaves any previous PR comment in place. Provide a verified failure-report path for incomplete shards.

Comment on lines +15 to +18
strategy:
fail-fast: false
matrix:
shard: [flags-single, flags-scaling, flags-memory, capture]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Skip benchmark shards for unrelated changes

Every pull request update now starts all four shards, including changes unrelated to posthog-node. Each shard independently installs and builds both revisions without caching, multiplying runner usage and queue pressure across the monorepo. Restore an affected-package guard, including benchmark workflow paths, before starting the matrix.

This branch has not been deployed

No deployments
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