Skip to content

fix(flatfiles): emit strikes in dollars and bound the wire connection#814

Merged
userFRM merged 3 commits into
mainfrom
fix/flatfile-strike-units-timeout
Jun 16, 2026
Merged

fix(flatfiles): emit strikes in dollars and bound the wire connection#814
userFRM merged 3 commits into
mainfrom
fix/flatfile-strike-units-timeout

Conversation

@userFRM

@userFRM userFRM commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Strikes in dollars across every output format

Flat-file CSV and JSONL emitted the raw scaled wire strike (tenths of a cent, e.g. 580000) while the Arrow and typed-row paths emitted dollars (e.g. 580.0). The same request therefore produced two different strike units depending on output format. Strikes are dollars on every client-facing surface; the scaled integer wire form must never reach a caller.

A single shared conversion (strike_dollars, alongside the wire-scale constant where the strike is decoded) now feeds CSV, JSONL, Arrow, and the typed FlatFileRow, so all four agree on the exact value for the same input. Sub-dollar strikes round-trip without trailing-zero noise via f64 Display. A cross-surface test asserts CSV, JSONL, and Arrow emit an identical dollar strike for whole-dollar and sub-dollar inputs.

Connect and read timeouts on the flat-file wire path

The flat-file path established its TLS connection and streamed the response with no connect or read timeout, unlike the historical channel which already has connect_timeout_secs. A host that accepted the socket but never completed the TLS handshake, or a server that stalled mid-stream, would block a download forever.

The session now bounds the combined connect plus auth handshake per host, and bounds the wait for each response frame. Both expiries are classified as transient so the existing retry ladder reconnects on a fresh session rather than hanging. The bounds wire to new FlatFilesConfig fields: connect_timeout_secs defaults to 10 (matching the historical channel), and read_timeout_secs defaults to 60 — far beyond any healthy inter-chunk gap, so a slow-but-progressing bulk transfer is never cut off mid-chunk. A test points connect_and_login at a non-routable TEST-NET host and confirms the connect bound fires instead of hanging.

Verification

  • cargo fmt --all -- --check clean
  • cargo test -p thetadatadx --features "arrow,polars,frames,config-file" --lib flatfiles — 68 passed
  • cargo clippy -p thetadatadx --all-targets --features "arrow,polars,frames,config-file,__internal,__test-helpers" -- -D warnings clean

🤖 Generated with Claude Code

The CSV and JSONL writers emitted the raw scaled wire strike (tenths of a cent) while the Arrow and typed-row paths emitted dollars, so the same request produced two different strike units depending on output format. Strikes are dollars on every client-facing surface; the scaled integer wire form must never reach a caller. A single shared conversion now feeds CSV, JSONL, Arrow, and the typed row so all four agree on the exact value, and a cross-surface test pins the invariant.

The flat-file wire path also had no connect or read timeout, so a host that accepted the socket but never finished the TLS handshake, or a server that stalled mid-stream, would block a download forever. The session now bounds the combined connect plus auth handshake per host and bounds the wait for each response frame, classifying both as transient so the existing retry ladder reconnects. The bounds default to the same connect budget as the historical channel, with a generous inter-frame ceiling that never cuts off a slow-but-progressing transfer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@userFRM userFRM enabled auto-merge (squash) June 16, 2026 09:24
claude added 2 commits June 16, 2026 11:56
Bind FlatFilesConfig.connect_timeout_secs and read_timeout_secs as u64-second config knobs across the C ABI, Python, TypeScript, and C++ surfaces, mirroring the existing flatfile backoff setters so the per-host connect/auth bound and the per-frame read bound are tunable from every language. Each field carries a setter, a getter, a documented production default, a parity row, and a round-trip binding test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The decode-only golden fixed the strike at the raw wire integer; the
CSV writer now emits dollars like every other output surface, so the
golden expectation moves to 580 to match.
@userFRM userFRM merged commit c58b042 into main Jun 16, 2026
31 checks passed
@userFRM userFRM deleted the fix/flatfile-strike-units-timeout branch June 16, 2026 11:17
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.

2 participants