Skip to content

Fix: read a JSON field named count in a badge extract path - #65

Merged
SandObserver merged 1 commit into
mainfrom
fix/badge-extract-count-field
Aug 14, 2026
Merged

SandObserver merged 1 commit into
mainfrom
fix/badge-extract-count-field

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Treat $count as the array-length token unconditionally, and count as the token only when the current value is an array.
  • Fall through to normal field access for a count segment on an object, so a badge pointed at a body such as {"count": 99} returns 99 instead of 0.

Testing
All green, except the Docker build smoke test, which has no local Docker and is left to CI. Added 1 test covering a count field on an object and through computeBadgeValue.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

@SandObserver SandObserver added the bug Something isn't working label Aug 14, 2026
The extractor treated a path segment of `count` as the array-length token
wherever it appeared, so a badge pointed at a body such as {"count": 99}
resolved to zero. Only $count is the token unconditionally now; `count`
counts an array and otherwise reads the field.
@SandObserver
SandObserver force-pushed the fix/badge-extract-count-field branch from 8018088 to fe1fcf4 Compare August 14, 2026 20:46
@SandObserver
SandObserver merged commit d3a1c1f into main Aug 14, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/badge-extract-count-field branch August 14, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant