Skip to content

DDIR: lib.rs as the public facade, and every pub narrowed to what escapes - #1017

Merged
frankmcsherry merged 1 commit into
TimelyDataflow:master-nextfrom
frankmcsherry:ddir-pub-facade
Oct 24, 2026
Merged

frankmcsherry merged 1 commit into
TimelyDataflow:master-nextfrom
frankmcsherry:ddir-pub-facade

Conversation

@frankmcsherry

@frankmcsherry frankmcsherry commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

lib.rs now lists the crate's modules by layer (IR vocabulary, language, analyses, runtime, host), with a comment on each saying what escapes it. "Escapes" means what the server, the tests and the examples use. Everything else is now pub(crate) or private, and #![warn(unreachable_pub)] keeps it that way. Every path used outside the crate is unchanged.

Changes

All visibility, unless noted:

  • 107 to pub(crate): 52 items, 48 methods, 5 modules and 2 fields. The modules are runtime::{bytes, half_join, join, reduce} and backend::corgi.
  • 12 to private, and 16 to pub(super) inside modules that were already private.
  • Deleted ColTimes::less_equal_cross, which has had no callers since dogs3 half join: ship each output with the unit's capabilities #955.
  • Not visibility:
    • half_join::Run::new is #[cfg(test)], since only tests call it.
    • Server::snapshot_local takes &self; clippy noticed once it was crate-only.
    • Doc links to items that became crate-only are now plain code spans.

The commit message lists what escapes each module.

Kept public on purpose

Checks

  • cargo check -p interactive -p ddir-server --all-targets: no warnings.
  • cargo test -p interactive -p ddir-server: 200 passed, 6 ignored.
  • Clippy: nothing new.
  • cargo doc -p interactive --no-deps: 4 warnings, down from 8 on master-next.
  • Release LDBC authored/check.py --fixture --workers 4: 41 of 41 answers match.
  • Release explain suite: 30 of 30.
  • Difftest, 2,000 cases with all oracles: all pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_019XsakwFGwtESwZ1gSYwG4o

…scapes

`lib.rs` now lists the crate's modules by layer (IR vocabulary, language, analyses, runtime,
host), with a comment on each saying what escapes it. "Escapes" means what the server, the tests
and the examples use. Everything else is now `pub(crate)` or private, and
`#![warn(unreachable_pub)]` keeps it that way. The build is clean under the lint. Every path
used outside the crate is unchanged.

Changes, all visibility unless noted:
- 107 to `pub(crate)`: 52 items, 48 methods, 5 modules, 2 fields.
  - The modules: `runtime::{bytes, half_join, join, reduce}` and `backend::corgi`.
- 12 to private: 10 items, 2 fields.
- 16 to `pub(super)`, inside modules that were already private: 12 items, 1 method, 3 fields.
- Deleted: `ColTimes::less_equal_cross`, which has had no callers since TimelyDataflow#955.
- Not visibility:
  - `half_join::Run::new` is now `#[cfg(test)]`, since only `tactic.rs`'s tests call it.
  - `Server::snapshot_local` takes `&self` rather than `&mut self`. Once it was crate-only,
    clippy noticed it only clones a trace.
  - Doc links to items that became crate-only are now plain code spans, in `lambda.rs`,
    `backend/mod.rs`, and `runtime/{mod, container, exchange, frame}.rs`.

Kept public on purpose:
- `runtime::col_times` stays a public module. Its `ColTimes` is the time column of the public
  `CorgiChunk` and `CorgiContainer`, so the type escapes whether or not its module is named.
- Kept for the open TimelyDataflow#1002/TimelyDataflow#1004 (self optimizer, demand rules), which use them:
  - `projection`'s `demand_graph`, `pushdown`, `DemandGraph`'s fields and `closure`;
  - `shapes`' `ScopeShapes::of`, `linear_shapes`, and the fields of `CollShape` and
    `ScopeShapes`;
  - the scope tree's fields.
  TimelyDataflow#1004 compiles on top of this commit with no warnings. It needs one change that it needed
  already: `ir::register` became `lambda::register` in TimelyDataflow#1013.
- The scope tree (`scope_ir`) and `CollShape` are plain data, so all of their fields are public,
  including three that only the crate reads (`Var::name`, `CollShape::time`, `CollShape::diff`).

What escapes each module:
- ir: `Diff`, `Reducer`, `LinearOp`, and `Lambda` re-exported. `Time` and `KEYWORDS` are
  crate-only.
- lambda: `Lambda` (no public methods), `Function`, `register`, `lookup`.
- scope_ir: `Ref`, `Source`, `RowShape`, `Import`, `Export`, `Var`, `Bind`, `Node`, `Item`,
  `Scope`, `Program`, all with public fields; `Program::{optimize, dump, op_count}`.
- parse: `pipe::parse`, `Stmt`, `Expr`.
- lower: `lower_tree`.
- shapes: `infer`, `CollShape`, `ScopeShapes` (with `of`), `ItemShapes`, `Problems`,
  `linear_shapes`.
- explain: `explain`, `explain_with`, `Options` (`debug_inspects`), `clone_identity`.
- projection: `pushdown`, `demand_graph`, `DemandGraph` (`seeds`, `edges`, `facts`, `closure`).
- backend: `LabelEvent` (`first`, `end`, `label`) and `LabelEventBuilder`. `Backend`,
  `render_tree` and `Rendered` are crate-only.
- runtime: the modules `chunk`, `col_times`, `container`, `exchange`, `feed`, `frame`.
  - chunk: `CorgiChunk::{times, from_columns}`.
  - col_times: `ColTimes::{len, is_empty, get, to_vec, raw_lanes}`, and the
    traits `Lanes`, `ColTime`, `LaneSummary` that its signatures need.
  - container: `CorgiContainer` (all four fields), and `Updates` (`keys`, `vals`, `diffs`;
    `len`, `is_empty`, `select`, `consolidate`, `rows`).
  - exchange: `GatherPact`, plus `GatherDistributor`, which its signature needs.
  - feed: `FeedDecoder::{new, push, push_line, len, is_empty, finish}`.
  - frame: `encode`, `decode`, `decode_feed`.
- diag: `register`, `Diagnostics` (`unbalanced_records`; `size`, `records_by_program`).
- server: `Server`, `Published` (`import_containers`), `ProgramInfo` (all fields), `Command`,
  `HostContainer`, `RowShape`, and the re-exports `evaluate`, `gen_field_seeded`,
  `host_dataflow`, `host_time`, `HostTime`, `OuterTime`.
  - Server's methods: `new`, `epoch`, `install`, `drop_program`, `tick`, `feed`, `feed_columns`,
    `load`, `loads_from_trace`, `snapshot`, `peek`, `take_changes`, `bind`, `unbind`,
    `binding_info`, `published`, `trace_shape`, `trace_info`, `program_info`,
    `set_arranged_imports`, `set_export_taps`, `set_diagnostics`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019XsakwFGwtESwZ1gSYwG4o
@frankmcsherry
frankmcsherry merged commit 881b725 into TimelyDataflow:master-next Oct 24, 2026
7 checks passed
@frankmcsherry
frankmcsherry deleted the ddir-pub-facade branch October 24, 2026 04:22
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.

1 participant