fix(ingest): filter BIT-<id> smoke-test probes in noise policy (BIT-32681)
CI / Test ingest-api (pull_request) Successful in 24s
CI / Test api (pull_request) Successful in 26s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m58s
CI / Validate Docker build (pull_request) Successful in 3m33s

Hand-sent pipe-liveness probes referenced by a BIT task id (e.g.
`BIT-32663 smoke test` or `[BIT-30527] ... smoke test`) were not matched
by the ingest noise policy: they lack the reserved `BIT-SMOKE-` token and
the bracket-only fleet-audit regex, so they passed ingest and opened a
false-positive Error Loop issue (BIT-32681 / ERRCLUSTER a513bc4e4505).

- noisePolicy.ts: add `_BIT_ID_SMOKE_PROBE_RE` matching bare and bracketed
  `BIT-<id> ... smoke test` forms; filtered at every severity under the
  existing `bitreport_smoke_marker` rule. Bump ruleset 1.0.7 -> 1.0.8.
- noisePolicy.test.ts: cover bare, bracketed, critical-level, and a
  negative case (`Smoke detector sensor offline` stays unfiltered).
- paperclip_fleet_error_reporting_audit_once.py: relax `_SYNTHETIC_EVENT_RE`
  to the same bare/bracketed shape so ingest and fleet audit agree.
- docs/operations/ingest-hardening-runbook.md: document the new probe shape.

Verified locally: ingest-api vitest 44 passed | 14 skipped; typecheck clean;
reporter context contract ok; fleet audit py_compile ok.

Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8)
Paperclip-Issue: BIT-32681
Paperclip-Run: 64667793-6ac7-404b-80bc-f369f0c4f9e0
This commit is contained in:
nelson-baptista committed 2026-11-20 09:42:08 +00:00
1 parent e01c8f62d5
commit b8ca70709e
4 files changed
+71 -3

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ Per-key overrides: set `rate_limit_max` and/or `rate_limit_window_ms` on the key
- Rules live in `ingest-api/src/lib/noisePolicy.ts`; ruleset id: `noise_ruleset_version` in the ingest response.
- **Check:** send a known-noise payload (for example ResizeObserver message at non-fatal level); expect `skipped: true`, `noise_filtered_count` incremented, and no new `er_incidents` row.
- **Check:** send the same pattern at `fatal` / `critical` level; expect **not** skipped (noise rules do not hide critical), **except** when the **message** or **client-provided stacktrace** contains reserved substring `BIT-SMOKE-` (intentional reporter smoke, e.g. wdmi-store `/smoke/wdmi.js`, CRM `/smoke/crm-main.php`, CRM `/smoke/crm.php` direct-forward `BIT-SMOKE-CRM-DIRECT-FWD`) — those are skipped at every level (`rule_id`: `bitreport_smoke_marker`). Matching treats unicode hyphen/minus characters as ASCII `-` (ruleset **1.0.5+**). The exact deploy-probe failure ribbon `BIT-SMOKE error hub ingest live check` (space after `BIT-SMOKE`, see [RUNBOOK_INGEST_DEBUG.md](../RUNBOOK_INGEST_DEBUG.md) §0) is also skipped at every level with the same `rule_id`.
- **Check:** send the same pattern at `fatal` / `critical` level; expect **not** skipped (noise rules do not hide critical), **except** when the **message** or **client-provided stacktrace** contains reserved substring `BIT-SMOKE-` (intentional reporter smoke, e.g. wdmi-store `/smoke/wdmi.js`, CRM `/smoke/crm-main.php`, CRM `/smoke/crm.php` direct-forward `BIT-SMOKE-CRM-DIRECT-FWD`) — those are skipped at every level (`rule_id`: `bitreport_smoke_marker`). Matching treats unicode hyphen/minus characters as ASCII `-` (ruleset **1.0.5+**). The exact deploy-probe failure ribbon `BIT-SMOKE error hub ingest live check` (space after `BIT-SMOKE`, see [RUNBOOK_INGEST_DEBUG.md](../RUNBOOK_INGEST_DEBUG.md) §0) is also skipped at every level with the same `rule_id`. Hand-sent pipe-liveness probes referenced by a BIT task id — `BIT-<id> smoke test` (bare) or `[BIT-<id>] ... smoke test` (bracketed) — are likewise skipped at every level (ruleset **1.0.8+**, BIT-32681), aligning ingest with the fleet audit synthetic-event exclusion.
## Rate limits
+48
View File
@@ -143,6 +143,54 @@ describe("evaluateNoise", () => {
});
});
it("matches bare 'BIT-<id> smoke test' pipe-liveness probe (BIT-32681)", () => {
const _r = evaluateNoise({
level: "error",
message: "BIT-32663 smoke test",
filePathHint: "",
});
expect(_r).toEqual({
matched: true,
ruleId: "bitreport_smoke_marker",
reason: "filtered_intentional_smoke_event",
});
});
it("matches bracketed '[BIT-<id>] ... smoke test' probe (fleet-audit synthetic form)", () => {
const _r = evaluateNoise({
level: "error",
message: "[BIT-30527] paperclip-chat pipe-liveness smoke test",
filePathHint: "",
});
expect(_r).toEqual({
matched: true,
ruleId: "bitreport_smoke_marker",
reason: "filtered_intentional_smoke_event",
});
});
it("suppresses 'BIT-<id> smoke test' probe even at critical level", () => {
const _r = evaluateNoise({
level: "critical",
message: "BIT-32663 smoke test",
filePathHint: "",
});
expect(_r).toEqual({
matched: true,
ruleId: "bitreport_smoke_marker",
reason: "filtered_intentional_smoke_event",
});
});
it("does not match a real error that merely contains 'smoke' without the BIT-<id> probe shape", () => {
const _r = evaluateNoise({
level: "error",
message: "Smoke detector sensor offline",
filePathHint: "",
});
expect(_r).toEqual({ matched: false });
});
it("matches CRM deploy ingest live-check failure ribbon (BIT-931 family)", () => {
const _r = evaluateNoise({
level: "critical",
+17 -1
View File
@@ -4,7 +4,7 @@ import { normalizeLevelToSeverity } from "./normalize.js";
* Versioned ruleset id (document in release notes when rules change).
* Rule inventory and validation steps: `docs/operations/ingest-hardening-runbook.md`.
*/
export const NOISE_RULESET_VERSION = "1.0.7";
export const NOISE_RULESET_VERSION = "1.0.8";
export type NoiseEvaluation =
| { matched: false }
@@ -12,6 +12,15 @@ export type NoiseEvaluation =
const _DEPLOY_INGEST_PROBE_MESSAGE = "BIT-SMOKE error hub ingest live check";
/**
* Hand-sent pipe-liveness probes referenced by a BIT task id (e.g. `BIT-32663 smoke test`
* or `[BIT-30527] paperclip-chat pipe-liveness smoke test`). The fleet audit already
* treats the bracketed form as synthetic (`_SYNTHETIC_EVENT_RE`); ingest must agree so
* these probes do not open Error Loop issues. Matched at every severity, like `BIT-SMOKE-`.
* BIT-32681 / ERRCLUSTER a513bc4e4505.
*/
const _BIT_ID_SMOKE_PROBE_RE = /\[?BIT-\d+\]?\s+.*smoke test/i;
/**
* CRM / editor copy-paste sometimes inserts unicode hyphens (U+2011 etc.) in the reserved
* `BIT-SMOKE-` token; strip ZW* / BOM so probes still match `bitreport_smoke_marker` (BIT-933).
@@ -155,6 +164,13 @@ export function evaluateNoise(input: {
reason: "filtered_intentional_smoke_event",
};
}
if (_BIT_ID_SMOKE_PROBE_RE.test(_msg) || _BIT_ID_SMOKE_PROBE_RE.test(_stack)) {
return {
matched: true,
ruleId: "bitreport_smoke_marker",
reason: "filtered_intentional_smoke_event",
};
}
const _sev = normalizeLevelToSeverity(input.level);
if (_sev === "critical") {
return { matched: false };
@@ -43,7 +43,11 @@ from urllib.error import HTTPError, URLError
# hand while investigating a "stale" finding, per BIT-30273/BIT-30527). These are real
# hub rows but not production traffic — counting them as "fresh" masks genuine staleness
# for as long as they remain the newest row for a slug. Excluded from freshness scoring.
_SYNTHETIC_EVENT_RE = re.compile(r"^\[BIT-\d+\]\s+\S+.*smoke test", re.IGNORECASE)
# Accepts both the bracketed form (`[BIT-30527] ... smoke test`) and the bare form
# (`BIT-32663 smoke test`), matching the ingest noise policy `_BIT_ID_SMOKE_PROBE_RE`
# (BIT-32681). Anchored to start so a real error mentioning the phrase mid-sentence is not
# misclassified.
_SYNTHETIC_EVENT_RE = re.compile(r"^\[?BIT-\d+\]?\s+.*smoke test", re.IGNORECASE)
# ---------------------------------------------------------------------------
# Env helpers