Plan
Index the nodes a model holds, free what a retirement leaves needed by nothing, add pins, and check that the sliding window stops growing.
The held index (skoro-core)#
- Add
held,pinnedandsparedtoModel, withhold,releaseandkeeps, and clone them inClone for Model. Add the helpersnamed(term)andnamed_by(proposal), and hold and release through them inTermHandle::bind,TermHandle::sampler(releasing a replaced sampler),Draft::add_proposal(releasing a replaced proposal), the bindings ofRetirement::replace, andremove(the terms of and the proposals it drops). Tests:held_index_matches_the_terms.
Freeing (skoro-core)#
- Record the nodes a draft inserts in
Draft::created, through aDraft::insertthatmapped,constantandquantitycall. AddSnapshot::nodes. - Make
removereturn its candidates, addfree, and call it at the end ofRetirement::replacewith the candidates anddraft.created, before publishing. Extend the documentation ofRetirement::replace,Writer::retireand theretiremodule to say what is freed. Moveato the removed nodes in the existing test. Tests:retirement_reads_the_blanket_and_removes_what_it_names,freed_nodes_are_what_nothing_needs,nothing_left_refers_to_a_removed_node,kalman_replacement_matches_quadrature,part_of_a_tick_matches_the_joint_normal,shared_constant_stays_while_a_term_reads_it,sampler_inputs_are_held,replacement_reusing_a_retired_constant_keeps_it,unused_values_of_the_replacement_scope_are_freed,steady_window_holds_a_constant_number_of_nodes.
Pins (skoro-core)#
- Add
scope::pinandscope::unpin, re-exported fromskoro::scope, andSnapshot::is_pinned. Havefreespare pinned nodes intospared,Retirement::replacerelease the spared nodes no longer pinned into the candidates, andremovedrop the pins and spared entries of removed nodes. Say inUnknownNode’s documentation and message that a retirement may have freed the node and that pinning keeps it. Tests:pinned_constant_survives_a_retirement_that_leaves_it_unused,unpinned_node_is_freed_at_the_next_retirement,pin_on_a_node_reached_from_a_retired_quantity_does_not_keep_it,pins_belong_to_their_branch,pin_refusals.
The example (skoro)#
- Report the window’s node count in
sliding_window, and check that the largest count after tick is at most 1.5 times the largest from tick to .
Done when#
bin/wf check
cargo fmt --all --check && cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo run --release -p skoro --example pose_graph
cargo run --release -p skoro --example sliding_window
cd site && pnpm buildall pass, sliding_window reports a node count that no longer grows with the ticks, and the
public-interface test (crates/skoro/tests/public_interface.rs) is updated if it lists the
functions of skoro::scope or the methods of Snapshot.