Skip to content

Incremental improvements: refactors, edge cases, robustness#1

Open
defnalk wants to merge 5 commits intomainfrom
review/incremental-improvements
Open

Incremental improvements: refactors, edge cases, robustness#1
defnalk wants to merge 5 commits intomainfrom
review/incremental-improvements

Conversation

@defnalk
Copy link
Copy Markdown
Owner

@defnalk defnalk commented Apr 9, 2026

Summary

Five atomic fixes across engine (C++), cli (Java) and dashboard (TS).

  • fix(engine): reject non-integral values in INTEGER columns — strtod was accepting 1.5, 1e-3, NaN, Inf for INTEGER schema columns; now rejected as TYPE_MISMATCH.
  • fix(cli): expand lowercase env vars in config interpolation${VAR} regex was uppercase-only, silently dropping ${home} / ${my_token}; broadened to POSIX env-var names.
  • fix(cli): restore interrupt status when Slack dispatch is interrupted — the catch-all was swallowing InterruptedException, so executor shutdown couldn't observe the interrupt.
  • fix(cli): deterministic tiebreaker in SqliteStateRepository.recent — ordering by processed_at DESC alone left ties unresolved; added id DESC as a stable secondary sort.
  • fix(dashboard): validate /files/:id as a positive integerNumber.isFinite accepted 1.5 and negatives, which better-sqlite3 silently coerced; now requires a positive integer.

Test plan

  • cmake --build engine/build --target valengine compiles cleanly (verified locally; pre-existing unrelated -Wunused-result break in test_fuzz.cpp left untouched)
  • Java mvn -pl cli test (not run; no mvn available in sandbox)
  • Dashboard npm test (not run; no node available in sandbox)

Do not merge.

defnalk and others added 5 commits April 9, 2026 20:54
The validator parsed INTEGER columns with strtod, which happily accepts
"1.5", "1e-3", "NaN" and "Inf" as valid doubles. That meant an INTEGER
schema column would silently pass fractional or non-finite values,
defeating the point of choosing INTEGER over FLOAT. Enforce that the
parsed value is finite and has no fractional part before accepting it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ConfigLoader's ${VAR} regex only matched [A-Z0-9_], so lowercase or
mixed-case env vars such as ${home} or ${my_token} were left untouched
in the rendered TOML. POSIX env var names permit both cases; broaden
the pattern to [A-Za-z_][A-Za-z0-9_]* so every valid name is expanded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HttpClient.send can throw InterruptedException; the catch-all was
swallowing it and clearing the thread's interrupt flag. During a
shutdown-driven interrupt the FileProcessor executor would then fail
to notice it should wind down. Catch InterruptedException explicitly
and re-interrupt the current thread before returning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ordering solely by processed_at DESC leaves ties unresolved, so two
rows sharing a timestamp (possible when clock resolution is coarse,
or when tests insert with a shared Instant) may swap positions between
calls. Break ties on the monotonic id column so recent() is stable and
matches the ordering the dashboard uses for its id-based polling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Number.isFinite accepted fractional ids like 1.5 and negative values,
which then flowed into better-sqlite3 where 1.5 gets coerced to 1 and
negative ids always miss. Require a positive integer so the API fails
loudly and consistently for malformed inputs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant