Skip to content

refactor!: 9.0.0 cut — drop wire-internal surface, IntoOptionSpec, FpssConnectArgs, public-API discipline (closes #500)#508

Merged
userFRM merged 2 commits into
mainfrom
refactor/wave4-9.0.0-cut
May 7, 2026
Merged

refactor!: 9.0.0 cut — drop wire-internal surface, IntoOptionSpec, FpssConnectArgs, public-API discipline (closes #500)#508
userFRM merged 2 commits into
mainfrom
refactor/wave4-9.0.0-cut

Conversation

@userFRM
Copy link
Copy Markdown
Owner

@userFRM userFRM commented May 7, 2026

Summary

Wave 4 of the audit-sweep refactor. ThetaDataDx 9.0.0 cuts the public surface to what users actually need and removes wire-internal state from every binding (Rust, C ABI, Python, TypeScript, C++).

B1 — Drop wire-internal contract_id: i32

Surface Before After
Rust ThetaDataDx::{contract_map, contract_lookup}, FpssClient::{contract_map, contract_lookup} removed
C ABI tdx_unified_contract_map, tdx_unified_contract_lookup, tdx_fpss_contract_map, tdx_fpss_contract_lookup, tdx_contract_map_array_free, TdxContractMapArray, TdxContractMapEntry removed
Python contract_map(), contract_lookup() removed
TypeScript contractMap(), contractLookup() removed
C++ FpssClient::{contract_map, contract_lookup} removed

The reader-thread cache stays internal. Consumers that still need an id→contract map build it from the FpssControl::ContractAssigned { id, contract } event stream — every event still carries the assignment.

// Before:
let map = client.contract_map()?;

// After: build the map yourself from the event stream.
client.start_streaming(|event| {
    if let FpssEvent::Control(FpssControl::ContractAssigned { id, contract }) = event {
        my_map.insert(*id, Arc::clone(contract));
    }
})?;

B2 — pub mod protopub(crate)

The generated protobuf module is wire-internal. Bindings that need DataTable / DataValueList / ResponseData / Price / data_value::* consume the new thetadatadx::wire re-export, which surfaces only the types offline-decode harnesses actually use.

// Before:
use thetadatadx::proto::{DataTable, ResponseData};

// After:
use thetadatadx::wire::{DataTable, ResponseData};

B3 — pub mod fpss::{connection, framing, dispatcher, ring}pub(crate)

Only protocol remains a public submodule of fpss. Frame, read_frame, write_frame are surfaced as items at thetadatadx::fpss:: for benchmark consumers; everything else (TLS connect, ring-buffer wait strategies, dispatcher internals) is now crate-private.

// Before:
use thetadatadx::fpss::framing::{read_frame, write_frame, Frame};

// After:
use thetadatadx::fpss::{read_frame, write_frame, Frame};

B4 — FpssConnectArgs replaces 9-arg connect

// Before:
FpssClient::connect(&creds, &hosts, 4096, FpssFlushMode::default(),
                    ReconnectPolicy::default(), true, handler)?;

// After:
let args = FpssConnectArgs::new(&creds, &hosts);
FpssClient::connect(args, handler)?;

Default impl + FpssConnectArgs::new(creds, hosts) shortcut cover the common path.

B5 — Contract::option polymorphic via IntoOptionSpec

// Before:
let c = Contract::option("SPY", "20261218", "60", "C")?;
let c = Contract::option_raw("SPY", 20261218, true, 60_000);

// After:
let c = Contract::option("SPY", ("20261218", "60", "C"))?;
let c = Contract::option("SPY", (20261218, true, 60_000))?;

New sealed trait IntoOptionSpec accepts either (&str, &str, &str) (human-friendly: expiration / strike / right) or (i32, bool, i32) (wire-format integer triple). Contract::option_raw is gone.

Public-API discipline sweep

  • auth::{creds, nexus, session} reduced to pub(crate); user-facing types stay re-exported at thetadatadx::auth::* and the crate root.
  • Dead helpers removed: fpss::connection::connect_to, fpss::framing::FrameReadState::is_idle, fpss::ring::DEFAULT_RING_SIZE.
  • Every pub fn / pub struct reachable from a public path was audited; internal helpers (parsers, decoders, format converters, TLS connect entry points) are now crate-private.

Versions

  • thetadatadx 8.0.37 → 9.0.0
  • tdbe 0.12.10 → 0.13.0 (eastern-time + json_canon + conditions codegen surface expansion warrants the minor bump)

All seven Cargo.tomls, four npm package.jsons, and five Cargo.lock files updated atomically. python3 scripts/check_version_sync.py reports version sync: ok.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace (every crate green)
  • cargo deny check — advisories ok, bans ok, licenses ok, sources ok
  • cargo run -p thetadatadx --bin generate_sdk_surfaces --features config-file -- --check
  • cargo check --manifest-path tools/cli/Cargo.toml --locked
  • cargo check --manifest-path tools/server/Cargo.toml --locked
  • python3 scripts/check_version_sync.py
  • cmake -S sdks/cpp -B build/cpp && cmake --build build/cpp --target thetadatadx_cpp
  • cmake --build build/cpp --target thetadatadx_fpss_smoke

Closes #500.

userFRM added 2 commits May 7, 2026 08:05
…ssConnectArgs, public-API discipline (closes #500)

Wave 4 of the audit-sweep refactor. ThetaDataDx 9.0.0 cuts the
public surface to what users actually need and removes wire-internal
state from every binding.

B1. Drop wire-internal `contract_id: i32` from public surface.
  - Removed: `ThetaDataDx::{contract_map, contract_lookup}`,
    `FpssClient::{contract_map, contract_lookup}`, every C ABI /
    Python / TypeScript / C++ wrapper, plus `TdxContractMapArray` /
    `TdxContractMapEntry` / `tdx_contract_map_array_free`.
  - The reader-thread cache stays internal; downstream consumers
    that still need an id->contract map build it from the
    `FpssControl::ContractAssigned { id, contract }` event stream.

B2. `pub mod proto` -> `pub(crate)`. Generated protobuf payload
  types are surfaced via the new `thetadatadx::wire` re-export
  (`DataTable`, `DataValueList`, `DataValue`, `ResponseData`,
  `Price`, `data_value`, `CompressionAlgo`, `CompressionDescription`).

B3. `pub mod fpss::{connection, framing, dispatcher, ring}` ->
  `pub(crate)`. `protocol` stays public; `Frame`, `read_frame`,
  `write_frame` are surfaced as items at `fpss::` root for bench
  consumers.

B4. `FpssClient::connect` takes one `FpssConnectArgs` struct
  instead of seven loose arguments. `Default` impl + a
  `FpssConnectArgs::new(creds, hosts)` shortcut cover the common
  path.

B5. `Contract::option_raw` collapsed into `Contract::option` via
  the new sealed `IntoOptionSpec` trait. Both `(&str, &str, &str)`
  (human-friendly) and `(i32, bool, i32)` (wire-format integer
  triple) input shapes route through the same call.

Public-API discipline sweep:
  - `auth::{creds, nexus, session}` reduced to `pub(crate)`;
    user-facing types stay re-exported at `thetadatadx::auth::*`.
  - Dead helpers removed (`fpss::connection::connect_to`,
    `fpss::framing::FrameReadState::is_idle`,
    `fpss::ring::DEFAULT_RING_SIZE`).
  - Every `pub fn` / `pub struct` reachable from a public path
    was audited; internal helpers are now crate-private.

Versions: thetadatadx 8.0.37 -> 9.0.0; tdbe 0.12.10 -> 0.13.0
(eastern-time + json_canon + conditions codegen surface expansion
warrants the minor bump). All seven Cargo.tomls, four npm
package.jsons, and five Cargo.lock files updated atomically.

Closes #500.
TS / Python bindings hold String params and pass &String refs into
Contract::option(). Add (String, String, String) and (&String, &String,
&String) impls that delegate to the existing (&str, &str, &str) impl
via .as_str() on each component. CI failure on Wave 4 9.0.0 cut
caught the missing impl coverage.
@userFRM userFRM merged commit 8dc7683 into main May 7, 2026
32 checks passed
@userFRM userFRM deleted the refactor/wave4-9.0.0-cut branch May 7, 2026 06:49
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.

Refactor sweep: ship all audit findings + 9.0.0 breaking cut

1 participant