Skip to content

🐛 fix(watch): count onEvent sink failures as emitErrors, not classifyErrors - #390

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-388
Oct 27, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
scanner/fix-388

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

watch wrapped both classification and the onEvent callback in one try, so a throwing sink was counted as classifyErrors, misdirecting the diagnostics runbook. onEvent is now guarded inside emit and counted in a new emitErrors counter (also covers capture mode); classifyErrors only reflects classifier failures. Adds tests, a runbook row, README sample update and a changelog fragment. Note: eventsEmitted still counts events the sink threw on (documented on the field).

Closes #388

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

…rors

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 27, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 27, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read watch() in full at 69d3c45 (src/watch.ts:75-192) plus the diagnostics consumers. Looks correct to me.

  • emit now owns the onEvent try/catch (src/watch.ts:87-92), so in stream mode the outer handler's catch (src/watch.ts:165-168) only sees stripANSI/classify failures, and in capture mode the poll loop's catch (src/watch.ts:124-128) only sees tmux/classifier failures. The misattribution in #388 is gone in both modes.
  • Small behavioural side effect, which I think is an improvement: a throwing sink no longer aborts the rest of the line/frame handler, so includeRaw output (src/watch.ts:164) is still emitted after a failed classified-event delivery.
  • Diagnostics spreads the stats object, so emitErrors reaches the stderr summary without further wiring; README sample and runbook row updated to match.
  • Built and ran test/diagnostics.test.js locally: 18/18 pass, including the new classifier-failure counter test.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read src/watch.ts at the PR head rather than just the diff. Looks correct to me.

  • emit (src/watch.ts:84-91) is the single funnel for both stream and capture mode, so wrapping opts.onEvent there is the right place: a throwing sink now increments emitErrors and no longer propagates into the stream-mode catch at src/watch.ts:164-167 (which only counts classifyErrors) or the capture-mode catch at src/watch.ts:132-136 (captureFailures). Both of those previously misattributed sink failures.
  • src/cli.ts:219 spreads watcher.stats() straight into the diagnostics line, so the new counter reaches --diagnostics output without further wiring; README sample and the runbook table (runbooks/session-monitoring-failure.md:50) are updated to match.
  • The new Classifier.prototype.classify stub test pins the remaining classifyErrors path, so the two counters are now independently tested.

One behaviour change worth knowing, not a defect: in stream mode with --include-raw, a sink that throws on the classified event previously aborted the line (the raw emit at src/watch.ts:162 was skipped). It now still emits the raw event, so a flaky sink sees more deliveries than before. That seems like the intended semantics — the sink failing is the sink's problem — but noting it since it changes observable output.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 980a970 into main Oct 27, 2026
12 of 13 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-388 branch October 27, 2026 10:24
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#39069d3c45` sha256:a59bd85f3f53f48b41f53163883186660c38e1df0ccdea842adb822aa695f716 — download from the dashboard or `hivectl review evidence #390`.

@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] watch: classifyErrors counter also counts onEvent sink failures, misdirecting the diagnostics runbook

0 participants