fix(mdds): log text-column numeric coercion so wire-type drift stays observable#881
Merged
Conversation
…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>
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 free
to 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.
The list endpoints publish their values as numeric cells while every binding presents the result as a string list:
list_datesandlist_expirationscarryYYYYMMDDasNumbercells, andlist_strikescarries the strike as aNumberorPricecell.extract_text_columntherefore coerces numeric cells to strings, andsorted_list_valuesapplies 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 istracerather thanwarnbecause 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_valuesnumeric-sortf64::MAXfallbacks are now documented as unreachable: theall_numericgate proves every element parses as a finitef64and the vector is not mutated before the sort, so theunwrap_orbranches only keep the comparator total without re-asserting the gate's invariant. No behavior change there.Added a unit test confirming a
Numbercell in a text-requested column coerces to its decimal string rather than dropping toNone.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 warningsclean.🤖 Generated with Claude Code