Uh oh!
There was an error while loading. Please reload this page.
Fix tsfile-cli clean-build race and harden CLI validation - #836
Merged
Conversation
Build: tsfile_cli_obj compiled against the staged include tree without depending on the copy_* targets that populate it, so a clean parallel build could fail with "'common/db_common.h' file not found" (deterministic via `make tsfile_cli_obj` in a fresh build dir). Add the missing add_dependencies edge. CLI hardening: - reject --offset on non-row commands and --model on write; name each read-only flag rejected by write instead of a lumped message - error when -d/-t does not match the file's data model in head/cat/sample/schema instead of silently ignoring the filter - include the storage error code in open/create failure messages - detect numeric flag overflow (ERANGE) in -n/--offset/--start/--end/--seed - cap the sample reservoir pre-allocation so a huge -n cannot abort via std::length_error; add a last-resort exception handler in main - emit null for non-finite FLOAT/DOUBLE cells in JSON output (bare nan/inf is not valid JSON) - docs: -m also applies to stats/count, count covers all tables, note that the table format buffers rows in memory
13 tasks
jt2594838
approved these changes
Jun 10, 2026
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Build fix.
tsfile_cli_objcompiles against the staged include tree (LIBRARY_INCLUDE_DIR) but had no dependency on thecopy_*targets that populate it, so a clean parallel build could fail withfatal error: 'common/db_common.h' file not found— deterministically reproducible withmake tsfile_cli_objin a fresh build directory. This adds the missingadd_dependencies(tsfile_cli_obj tsfile)edge (tsfile transitively depends on all header-staging targets). Include paths stay onCMAKE_CURRENT_SOURCE_DIR, which is also correct whencpp/is embedded by an outer project viaadd_subdirectory. Supersedes #835.Crash fix.
sample -n <huge value>aborted via an uncaughtstd::length_errorfromreservoir.reserve(). The pre-allocation is now capped (the reservoir still grows to-nas rows actually arrive) andmaingets a last-resort exception handler so e.g.std::bad_allocreports an error instead of SIGABRT.Validation & diagnostics.
--offsetis rejected on non-row commands,--modelonwrite, matching the existing "reject instead of silently ignore" policywritenames the specific offending read-only flag instead ofread-only flags are not valid for writehead/cat/sample/schemanow error when-d/-tdoes not match the file's data model instead of silently ignoring the filter (previouslyhead -d dev1on a table-model file printed all rows unfiltered)cannot open x.tsfile: file is corrupted (code N)) instead of one lumped messageERANGE(previously-n 9...9silently clamped toLLONG_MAX)Output correctness. Non-finite FLOAT/DOUBLE cells are emitted as
nullin JSON output — barenan/infis not valid JSON and brokejq/json.loadsconsumers.Docs. README/SKILL:
-malso applies tostats/count;countcovers all tables (not first-table-only); note that thetableformat buffers all rows in memory to align columns.Test plan
cmake+make tsfile_cli -j8succeeds (previously raced/failed);make tsfile_cli_objalone also succeedswrite+count/cat/stats/ls/meta/schema/head/sampleregression on macOSsample -n 4611686018427387904returns rows, exit 0 (previously SIGABRT)python json.loads./mvnw spotless:apply -P with-cppproduces no further changes