Skip to content

fix(runtime-node): stop redaction masking GenAI/usage token counts - #17

Merged
sagnik11 merged 4 commits into
Autter-dev:mainfrom
rajeshaipython-stack:fix/redact-token-usage-overmatch
Aug 29, 2026
Merged

fix(runtime-node): stop redaction masking GenAI/usage token counts#17
sagnik11 merged 4 commits into
Autter-dev:mainfrom
rajeshaipython-stack:fix/redact-token-usage-overmatch

fix(runtime-node): tighten GenAI usage redaction

29a86db
Select commit
Loading
Failed to load commit list.
Autter.dev / autter/review-gate succeeded Aug 26, 2026 in 12m 18s

Autter review gate passed

Autter completed its agentic checks for #17: 7 finding(s) total, 2 discovered by the post-review build/test/deep scans; none meet the merge-blocking bar.

Details

Findings

7 finding(s) — 0 high · 6 medium · 1 low.

🟠 Medium (6)

  • Canonical usage exemption ignores additional key redaction patternspackages/runtime-node/src/redact.ts:170 · risk 56 (ai)
    The canonical GenAI branch returns before checking r.keyPatterns, so a caller-supplied additionalKeyPatterns match can never redact a valid numeric value under a canonical usage key such as gen_ai.usage.input_tokens. This is reachable through the documented redactAttributes(attributes, { additionalKeyPatterns: [...] }) API and violates the option contract that extra key patterns extend the built-in key rules, allowing a configured policy to be silently bypassed for these attributes.
  • Biome: lint/style/useNumberNamespacepackages/runtime-node/test/redact.test.mjs:158 · risk 55 (deterministic)
    Use Number.NaN instead of the equivalent global.
  • Biome: lint/style/useNumberNamespacepackages/runtime-node/test/redact.test.mjs:159 · risk 55 (deterministic)
    Use Number.POSITIVE_INFINITY instead of the equivalent global.
  • Missing linked tracker issuepackages/runtime-node/test/redact.test.mjs:127 · risk 50
    This PR's title and body do not reference any tracker issue (GitHub #123, Jira/Linear KEY-123, or Fixes/Closes/Resolves).
  • Missing CODEOWNERS reviewer approvalpackages/runtime-node/src/redact.ts:145 · risk 49
    packages/runtime-node/src/redact.ts has no configured CODEOWNERS entry in the supplied metadata and has no approving review; only comments or change requests are present. The affected redactAttributes, isSensitiveKey, and makeSafeCapture path can alter redaction of runtime telemetry. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions redactAttributes, redactValue, isSensitiveKey, redactWith, makeRedactor, redactString; scopes @autter/runtime-node; dependent files @opentelemetry/api.
  • Missing CODEOWNERS reviewer approvalpackages/runtime-node/test/redact.test.mjs:128 · risk 45
    The changed redaction regression tests have no configured CODEOWNERS entry in the supplied metadata and no approving review from a matching owner. These tests govern redactAttributes behavior used by runtime-node telemetry capture. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: scopes @autter/runtime-node; dependent files ../dist/index.js, node:assert/strict, node:test.

🟡 Low (1)

  • Missing linked tracker issuepackages/runtime-node/src/redact.ts:152 · risk 35
    The PR description explicitly states that no linked issue was identified. This changes exported redactAttributes and its makeSafeCapture caller, affecting whether runtime telemetry token-count attributes reach downstream ingestion and storage. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions redactAttributes, redactValue, isSensitiveKey, redactWith, makeRedactor, redactString; scopes @autter/runtime-node; dependent files @opentelemetry/api.

Annotations

Check warning on line 127 in packages/runtime-node/test/redact.test.mjs

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Missing linked tracker issue

This PR's title and body do not reference any tracker issue (GitHub `#123`, Jira/Linear `KEY-123`, or `Fixes/Closes/Resolves`).
Suggested fix:
In the PR description, add a reference to the tracker issue this change implements (GitHub `#123`, Jira/Linear `PROJ-456`, or a `Fixes/Closes/Resolves` marker). Reviewers anchor on `packages/runtime-node/test/redact.test.mjs` around line 127 need that context to understand why this change exists and what success looks like. Why it matters: reviewers and on-call engineers need the linked issue to understand the why behind a change months from now.

Check warning on line 145 in packages/runtime-node/src/redact.ts

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Missing CODEOWNERS reviewer approval

packages/runtime-node/src/redact.ts has no configured CODEOWNERS entry in the supplied metadata and has no approving review; only comments or change requests are present. The affected redactAttributes, isSensitiveKey, and makeSafeCapture path can alter redaction of runtime telemetry. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.
Suggested fix:
Configure or identify the CODEOWNERS owner for packages/runtime-node/src/redact.ts, then obtain an approving review from a matching owner before merging. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.

Check warning on line 128 in packages/runtime-node/test/redact.test.mjs

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Missing CODEOWNERS reviewer approval

The changed redaction regression tests have no configured CODEOWNERS entry in the supplied metadata and no approving review from a matching owner. These tests govern redactAttributes behavior used by runtime-node telemetry capture. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: scopes `@autter/runtime-node`; dependent files `../dist/index.js`, `node:assert/strict`, `node:test`.
Suggested fix:
Configure or identify the CODEOWNERS owner for packages/runtime-node/test/redact.test.mjs, then obtain an approving review from a matching owner before merging. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: scopes `@autter/runtime-node`; dependent files `../dist/index.js`, `node:assert/strict`, `node:test`.

Check notice on line 152 in packages/runtime-node/src/redact.ts

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟡 Low · Missing linked tracker issue

The PR description explicitly states that no linked issue was identified. This changes exported redactAttributes and its makeSafeCapture caller, affecting whether runtime telemetry token-count attributes reach downstream ingestion and storage. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.
Suggested fix:
Add a valid tracker reference to the PR description, such as GitHub #123 or a Jira/Linear KEY-123, and explain how it tracks this redaction behavior change. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.

Check warning on line 170 in packages/runtime-node/src/redact.ts

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Canonical usage exemption ignores additional key redaction patterns

The canonical GenAI branch returns before checking `r.keyPatterns`, so a caller-supplied `additionalKeyPatterns` match can never redact a valid numeric value under a canonical usage key such as `gen_ai.usage.input_tokens`. This is reachable through the documented `redactAttributes(attributes, { additionalKeyPatterns: [...] })` API and violates the option contract that extra key patterns extend the built-in key rules, allowing a configured policy to be silently bypassed for these attributes.
Suggested fix:
Evaluate the configured key patterns before applying the canonical GenAI numeric exemption, while retaining the exemption only when no configured pattern matches and the value is a finite non-negative number.

Check warning on line 158 in packages/runtime-node/test/redact.test.mjs

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Biome: lint/style/useNumberNamespace

Use Number.NaN instead of the equivalent global.
Suggested fix:
Fix the Biome `lint/style/useNumberNamespace` issue at packages/runtime-node/test/redact.test.mjs:158: Use Number.NaN instead of the equivalent global.

Check warning on line 159 in packages/runtime-node/test/redact.test.mjs

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Biome: lint/style/useNumberNamespace

Use Number.POSITIVE_INFINITY instead of the equivalent global.
Suggested fix:
Fix the Biome `lint/style/useNumberNamespace` issue at packages/runtime-node/test/redact.test.mjs:159: Use Number.POSITIVE_INFINITY instead of the equivalent global.

Check warning on line 127 in packages/runtime-node/test/redact.test.mjs

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Missing linked tracker issue

This PR's title and body do not reference any tracker issue (GitHub `#123`, Jira/Linear `KEY-123`, or `Fixes/Closes/Resolves`).
Suggested fix:
In the PR description, add a reference to the tracker issue this change implements (GitHub `#123`, Jira/Linear `PROJ-456`, or a `Fixes/Closes/Resolves` marker). Reviewers anchor on `packages/runtime-node/test/redact.test.mjs` around line 127 need that context to understand why this change exists and what success looks like. Why it matters: reviewers and on-call engineers need the linked issue to understand the why behind a change months from now.

Check warning on line 145 in packages/runtime-node/src/redact.ts

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Missing CODEOWNERS reviewer approval

packages/runtime-node/src/redact.ts has no configured CODEOWNERS entry in the supplied metadata and has no approving review; only comments or change requests are present. The affected redactAttributes, isSensitiveKey, and makeSafeCapture path can alter redaction of runtime telemetry. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.
Suggested fix:
Configure or identify the CODEOWNERS owner for packages/runtime-node/src/redact.ts, then obtain an approving review from a matching owner before merging. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.

Check warning on line 128 in packages/runtime-node/test/redact.test.mjs

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟠 Medium · Missing CODEOWNERS reviewer approval

The changed redaction regression tests have no configured CODEOWNERS entry in the supplied metadata and no approving review from a matching owner. These tests govern redactAttributes behavior used by runtime-node telemetry capture. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: scopes `@autter/runtime-node`; dependent files `../dist/index.js`, `node:assert/strict`, `node:test`.
Suggested fix:
Configure or identify the CODEOWNERS owner for packages/runtime-node/test/redact.test.mjs, then obtain an approving review from a matching owner before merging. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: scopes `@autter/runtime-node`; dependent files `../dist/index.js`, `node:assert/strict`, `node:test`.

Check notice on line 152 in packages/runtime-node/src/redact.ts

See this annotation in the file changed.

@autter-dev autter-dev / autter/review-gate

🟡 Low · Missing linked tracker issue

The PR description explicitly states that no linked issue was identified. This changes exported redactAttributes and its makeSafeCapture caller, affecting whether runtime telemetry token-count attributes reach downstream ingestion and storage. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.
Suggested fix:
Add a valid tracker reference to the PR description, such as GitHub #123 or a Jira/Linear KEY-123, and explain how it tracks this redaction behavior change. Blast radius — skipping this guardrail cascades to the downstream usage that depends on this file: functions `redactAttributes`, `redactValue`, `isSensitiveKey`, `redactWith`, `makeRedactor`, `redactString`; scopes `@autter/runtime-node`; dependent files `@opentelemetry/api`.