refactor: Wave 2 god-file splits — decode/protocol/config/conditions + tdbe::time lift (refs #500)#506
Merged
Merged
Conversation
…+ tdbe::time lift (closes #500-wave2) Five structural changes: 1. crates/thetadatadx/src/decode.rs (2177 LoC) split into mdds/decode/ {error,headers,transport,extract,cell,v3}. Public API unchanged via mdds::decode::* re-exports. 2. Eastern-time + DST primitives lifted into tdbe::time as the canonical module reused by mdds, fpss, flatfiles. tdbe 0.12.9 → 0.12.10. 3. crates/thetadatadx/src/fpss/protocol.rs (1613 LoC) split into fpss/protocol/{contract,wire,subscription}. mod.rs keeps constants + re-exports; contract.rs holds Contract + Display + FromStr + OCC-21 parser; wire.rs holds payload builders/parsers; subscription.rs holds SubscriptionKind. 4. crates/thetadatadx/src/config.rs (1396 LoC, 30 flat fields) refactored into 7 nested typed sub-configs. DirectConfig now contains mdds, fpss, reconnect, retry, auth, metrics, runtime. Field-read accessors preserved for back-compat; field-write callers migrate to nested form (config.fpss.queue_depth = …). Adds mdds.connect_timeout_secs default 10s. 5. crates/tdbe/src/conditions.rs (2749 LoC) refactored to TOML-driven codegen. Source-of-truth at crates/tdbe/data/{trade,quote}_conditions.toml (149 + 75 entries). build.rs reads them and emits tdbe/src/conditions/tables_generated.rs with compile-time const arrays. Public surface unchanged; new condition_tables_pin test pins 12 known entries against the const arrays for round-trip protection. Bumps thetadatadx 8.0.35 → 8.0.36 and tdbe 0.12.9 → 0.12.10. All workspace + sub-manifest CI gates green locally.
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.
What
Wave 2 of the audit-sweep refactor (#500). Five structural changes in one squashed commit:
crates/thetadatadx/src/decode.rs(2177)mdds/decode/{error,headers,transport,extract,cell,v3}.rsdecode.rscrates/tdbe/src/time.rsfpss/protocol.rs(1613)fpss/protocol/{contract,wire,subscription}.rsconfig.rs(1396, 30 flat fields)config/{mod,mdds,fpss,reconnect,retry,auth,metrics,runtime,env}.rsconditions.rs(2749 hand-written tables)conditions/{mod,tables_generated}.rs+crates/tdbe/data/{trade,quote}_conditions.toml(149 + 75 entries)crates/tdbe/build.rs; round-trip pin test on 12 known entriesWhy
Five god-files (over 1300 LoC each) violated the Bloomberg/LSEG-grade engineering bar called out in the 2026-05-06 audit. Splitting them along responsibility lines, lifting cross-crate primitives, and replacing hand-written static tables with TOML-driven codegen brings the codebase in line with institutional norms.
How
decode.rsintotdbe::time. Every consumer incrates/thetadatadx/rewired to import fromtdbe::time::*. Public re-exports preserved atthetadatadx::mdds::decode::*so downstream code resolves identically.contract.rs/wire.rs/subscription.rs. Tests follow the symbols they cover.fpss::protocol::*re-exports keep external callers green.mdds.connect_timeout_secs(default 10s) added — covers the prior LOW finding 3.1. Field-read accessors preserved onDirectConfigfor back-compat (config.mdds_host()still works). Field-write callers (78 callsites acrosscrates/thetadatadx/src/{fpss/connection,fpss/mod,macros,mdds/client,observability,unified},ffi/src/{auth,streaming},sdks/python/src/lib.rs) migrated to nested form. TOML on-disk shape was already nested; loader rewritten to populate new structs — no migration burden for~/.thetadatadx/config.tomlusers.crates/tdbe/build.rsreads both files and emitstables_generated.rswith compile-timeconstarrays. 13 trade descriptions with embedded\"characters use TOML literal triple-strings ('''...'''); zero workarounds needed. Newcondition_tables_pintest pins 12 known entries (trade 0/30/40/60/61/90/120/148, quote 0/17/50/74) against the live arrays.Version
Bumps
thetadatadx8.0.35 → 8.0.36 andtdbe0.12.9 → 0.12.10. Single atomic bump viascripts/bump_version.py 8.0.36. `check_version_sync.py` reports `version sync: ok`.Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace— every existing test + new round-trip pincargo deny checkcargo run -p thetadatadx --bin generate_sdk_surfaces --features config-file -- --checkcargo check --manifest-path tools/{cli,mcp,server}/Cargo.toml --lockedcargo clippy --manifest-path tools/mcp/Cargo.toml --all-targets -- -D warningscargo test --manifest-path tools/mcp/Cargo.toml --no-runcargo check --manifest-path sdks/{python,typescript}/Cargo.toml --lockedcargo build -p tdbe --release(build.rs codegen runs at release-build time)python3 scripts/check_version_sync.pyRefs #500.