Skip to content

fix(worker): accept decimal-string observation ids - #5339

Closed
Afloat16 wants to merge 2 commits into
thedotmack:mainfrom
Afloat16:fix/worker-observation-string-ids-20261103
Closed

Afloat16 wants to merge 2 commits into
thedotmack:mainfrom
Afloat16:fix/worker-observation-string-ids-20261103

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #5335.

The worker observations batch route accepts native numeric arrays, JSON-encoded numeric arrays, and CSV strings, but rejects per-element decimal strings such as ["56390", "56391"]. The shared MCP tool can legitimately lead callers to use string ids, so this costs a failed worker request and an extra turn.

Normalize decimal-string elements before integer validation. Keep native numeric arrays and the existing whole-array/CSV formats. Cloud ids, blank strings, booleans, null, and non-integer strings remain invalid. Extract the focused schema so it can be exercised without starting the worker, and add the matching route regressions.

Validation

  • Before: all 3 numeric-string schema regressions fail; 11 existing/invalid-input cases pass.
  • After: all 14 schema cases pass under Node 24 and Vitest 4.1.11 with bun:test aliased to Vitest.
  • Focused TypeScript compilation of the schema and git diff --check: passed.
  • Three route-chain cases are included for the native Bun suite. Bun aborts even on bun -e 'console.log(1)' in this environment, so the route suite, full worker suite, and release-bundle build have not been claimed as passed.

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Accepts decimal-string observation IDs while keeping the existing numeric-array, JSON-array, and CSV formats.

  • The observation batch route accepts decimal-string IDs.

No actionable new issues were found. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "build(plugin): regenerate observation ID..." · Reviewed by Greptile

Ship the numeric-string observation ID coercion in the committed worker bundle and its source map.

Regenerated with the repository esbuild configuration and integrity checks, preserving the dependency versions in the original distribution.

Validation: 14 focused regression tests passed under Node 24 / Vitest with bun:test imports adapted; emitted bundles pass node --check.
thedotmack added a commit to ryrenz/claude-mem that referenced this pull request Nov 4, 2026
Carries the extra rejection cases from thedotmack#5339 into the route-level coercion
tests. The new cases are booleans, null, decimals, exponents and blank strings.

Co-authored-by: Afloat <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
thedotmack added a commit that referenced this pull request Nov 4, 2026
)

* fix(worker): accept numeric-string ids in /api/observations/batch

* test(worker): cover more invalid observation id elements

Carries the extra rejection cases from #5339 into the route-level coercion
tests. The new cases are booleans, null, decimals, exponents and blank strings.

Co-authored-by: Afloat <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Alex Newman <[email protected]>
Co-authored-by: Afloat <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@thedotmack

Copy link
Copy Markdown
Owner

Thank you @Afloat16! I'm closing this because #5336 landed the same fix for #5335 (de134d3), and it needed fewer changes because integerArrayLike could stay where it was.

Your extra rejection cases (true, null, "1.5", "1e2", " ") are in that merge as route tests, and you are listed as Co-authored-by on the commit. The rest of this PR is not in it: the new middleware file was not needed, and main already tests the empty-array case. Generated bundles are rebuilt at release, so they stay out of PRs.

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.

get_observations still 400s at /api/observations/batch when ids are numeric strings (worker runtime) — follow-up to #1172

2 participants