Repository navigation
DDIR: lib.rs as the public facade, and every pub narrowed to what escapes - #1017
Merged
frankmcsherry merged 1 commit intoOct 24, 2026
Merged
Conversation
…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
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.
lib.rsnow 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 nowpub(crate)or private, and#![warn(unreachable_pub)]keeps it that way. Every path used outside the crate is unchanged.Changes
All visibility, unless noted:
pub(crate): 52 items, 48 methods, 5 modules and 2 fields. The modules areruntime::{bytes, half_join, join, reduce}andbackend::corgi.pub(super)inside modules that were already private.ColTimes::less_equal_cross, which has had no callers since dogs3 half join: ship each output with the unit's capabilities #955.half_join::Run::newis#[cfg(test)], since only tests call it.Server::snapshot_localtakes&self; clippy noticed once it was crate-only.The commit message lists what escapes each module.
Kept public on purpose
runtime::col_times: itsColTimesis the time column of the publicCorgiChunkandCorgiContainer.projection'sdemand_graphitems,ScopeShapes::of,linear_shapes, and the shape and scope-tree fields. DDIR: express field demand rules relationally (stacked on #1002) #1004 compiles on top of this with no warnings, apart from their::register→lambda::registerchange it already needed from DDIR: the expression language's seam is lambda.rs, moved out of the runtime #1013.CollShapeare plain data, so all their fields stay public.Checks
cargo check -p interactive -p ddir-server --all-targets: no warnings.cargo test -p interactive -p ddir-server: 200 passed, 6 ignored.cargo doc -p interactive --no-deps: 4 warnings, down from 8 on master-next.authored/check.py --fixture --workers 4: 41 of 41 answers match.🤖 Generated with Claude Code
https://claude.ai/code/session_019XsakwFGwtESwZ1gSYwG4o