Skip to content

fix(mdds): log text-column numeric coercion so wire-type drift stays observable#881

Merged
userFRM merged 1 commit into
mainfrom
fix/round9-core
Jun 17, 2026
Merged

fix(mdds): log text-column numeric coercion so wire-type drift stays observable#881
userFRM merged 1 commit into
mainfrom
fix/round9-core

Conversation

@userFRM

@userFRM userFRM commented Jun 17, 2026

Copy link
Copy Markdown
Owner

The list endpoints publish their values as numeric cells while every binding presents the result as a string list: list_dates and list_expirations carry YYYYMMDD as Number cells, and list_strikes carries the strike as a Number or Price cell. extract_text_column therefore coerces numeric cells to strings, and sorted_list_values applies a numeric-aware sort on top. Rejecting numeric cells with a typed error here would break those served endpoints on every call, so the coercion is intentional rather than a swallowed type drift.

Previously the coercion was fully silent, so a text column the server unexpectedly starts publishing as numeric left no trace at all. Each coercion now emits a tracing::trace! naming the requested header and the observed wire variant. The level is trace rather than warn because numeric cells are the expected shape on the numeric list endpoints, so a higher level would be pure noise; an unexpected drift on a genuinely textual column is still recoverable from a trace-enabled run.

While in the file, the sorted_list_values numeric-sort f64::MAX fallbacks are now documented as unreachable: the all_numeric gate proves every element parses as a finite f64 and the vector is not mutated before the sort, so the unwrap_or branches only keep the comparator total without re-asserting the gate's invariant. No behavior change there.

Added a unit test confirming a Number cell in a text-requested column coerces to its decimal string rather than dropping to None.

Verification: cargo test -p thetadatadx --lib mdds (184 passed) and --features __internal extract (15 passed, including the new test); cargo fmt --all -- --check; cargo clippy -p thetadatadx --all-targets --locked --features __internal -- -D warnings clean.

🤖 Generated with Claude Code

…observable

The list endpoints publish their values as numeric cells while every binding presents the result as a string list: list_dates and list_expirations carry YYYYMMDD as Number cells, and list_strikes carries the strike as Number or Price. extract_text_column must therefore coerce numeric cells to strings, and sorted_list_values applies a numeric-aware sort on top. Rejecting numeric cells with a typed error here would break those served endpoints on every call, so the coercion is intentional rather than a swallowed type drift.

Previously the coercion was fully silent, so a text column the server unexpectedly starts publishing as numeric left no trace at all. Each coercion now emits a tracing::trace! naming the requested header and the observed wire variant. The level is trace rather than warn because numeric cells are the expected shape on the numeric list endpoints, so a higher level would be pure noise; an unexpected drift on a genuinely textual column is still recoverable from a trace-enabled run.

Also document that the sorted_list_values numeric-sort fallbacks are unreachable: the all_numeric gate proves every element parses as a finite f64 and the vector is not mutated before the sort, so the unwrap_or branches only keep the comparator total without re-asserting the gate's invariant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@userFRM userFRM merged commit cbb94a1 into main Jun 17, 2026
22 checks passed
@userFRM userFRM deleted the fix/round9-core branch June 17, 2026 20:47
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