Repository navigation
fix(otel,metrics): reject bare string classification_values, whitespace-padded entries, and reserved '_other' bucket (#113) - #118
Conversation
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
2ce7616 to
c3a7ecf
Compare
…ce-padded entries, and reserved '_other' bucket (agentrust-io#113) Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
c3a7ecf to
70f4c9d
Compare
dinakarjs
left a comment
There was a problem hiding this comment.
Reviewed the Python and TypeScript metric emitters. Both reject bare strings, padded values and the reserved fallback bucket before creating instruments. The full Python suite passed with 167 tests and 179 subtests. The TypeScript build and all 51 TypeScript tests passed using Node's test runner with the tsx import. Hosted workflows await maintainer authorization.
Prepared with OpenAI Codex.
imran-siddique
left a comment
There was a problem hiding this comment.
Approving at 70f4c9d: ran conformance, the Python suite and the TS check on this head; each new test fails against main's source; all 11 PRs in this series merge onto main together without conflicts and pass combined.
rajnisht7
left a comment
There was a problem hiding this comment.
The core fix looks good, a few things needs hardening(can be followed up):
- Length counting-Python len() counts Unicode code points; JS .length counts UTF-16 code units.Example: 65–128 emoji characters are accepted by Python but rejected by TypeScript.Prefer Array.from(value).length (or equivalent) in TS if the intent is code-point counting.
- str.strip() and String.trim() disagree on some characters (e.g. U+001C, U+0085, U+FEFF). The same value can be accepted by one SDK and rejected by the other.
Also missing a few explicit boundary tests (64 entries accept, 128-char accept, 129-char reject, empty string, whitespace-only).
Closes #113
Summary
str/bytesforclassification_values/classificationValuesinOTelMetricEmitter(src/agentrust_telemetry/otel.pyandpackages/typescript/src/metrics.ts) so a string is not iterated character-by-character."_other"in both Python and TypeScript.tests/test_otel_projectors.pyandpackages/typescript/test/metrics.test.ts.Validation
pytest tests/test_otel_projectors.py -k "not real and not action_metrics" -q— passed (3 passed, 5 subtests passed)