Apply the Deterministic packets tools-packet-compile emits: the citation at a stated file and line is replaced by the path git recorded it moving to. Refuses to guess -- a packet whose cited string is not on its line is skipped and reported.
| Tier | tools |
| Role | tooling |
| Path | crates/tools/packet-apply |
| Edition | 2021 |
| Targets | tools-packet-apply, tools_packet_apply |
| Public items | 5 across 0 modules |
| Tests | 10 |
What it is for
Apply the Deterministic packets tools-packet-compile emits.
Compile and apply are separate stages by design (sprint 4.3): the compiler reads a report and emits packets, and never touches the repo. Nothing executed those packets until now, so the deterministic half of every doc-truth run sat compiled and unapplied.
The edit itself is one substitution on one line. Everything interesting is about refusing to make it: a report is a photograph of a tree, and the tree moves. If the cited string is not on the line the packet names, this stage reports the packet skipped and leaves the file alone — it never searches the file for somewhere the edit would fit, because a citation that has shifted is exactly the case where a plausible-looking guess is wrong.
Capabilities
Outcome
Apply the Deterministic packets tools-packet-compile emits.
| Item |
|---|
pub enum Outcome |
fn apply_to_text(text : & str, line : usize, from : & str, to : & str) ->(String, Outcome) |
Repair
Apply the Deterministic packets tools-packet-compile emits.
| Item |
|---|
pub struct Repair |
fn order_repairs(mut repairs : Vec <Repair>) -> Vec <Repair> |
fn repairs_from_packets(packets : & serde_json::Value) -> Vec <Repair> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct Repair | One line rewrite: at file, 1-indexed line, from becomes to. |
pub enum Outcome | What became of one repair. |
fn apply_to_text(text : & str, line : usize, from : & str, to : & str) ->(String, Outcome) | Rewrite one line of text, returning the new text and what happened |
fn order_repairs(mut repairs : Vec <Repair>) -> Vec <Repair> | Order repairs so that, within one line, the longest cited string is replaced first |
fn repairs_from_packets(packets : & serde_json::Value) -> Vec <Repair> | Read Deterministic/LinkRepair packets out of a packets.json value |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | tools |
| Architectural role (taxonomy) | tooling |
| Location | crates/tools/packet-apply |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `tools-packet-compile` | tools | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
anyhow | ^1 | — | no | always |
serde_json | ^1 | — | no | always |
Development. None.
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["tools-packet-apply"] SELF -->|runtime| n_tools_packet_compile["tools-packet-compile"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | tools-packet-apply | `src/main.rs` |
| lib | tools_packet_apply | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 10 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 5 | 0 | 0 |
What the tests establish, by name:
a_file_with_no_trailing_newline_keeps_not_having_one—src/lib.rsa_line_already_reading_the_target_is_not_an_error—src/lib.rsa_line_citing_a_path_and_its_parent_repairs_the_longer_first—src/lib.rsa_line_number_past_the_end_of_the_file_is_reported_not_appended—src/lib.rsa_line_that_does_not_carry_the_citation_is_left_alone—src/lib.rsa_repair_with_no_finding_to_cite_is_not_a_repair—src/lib.rsevery_occurrence_on_the_line_is_rewritten—src/lib.rsonly_deterministic_link_repairs_are_read_out_of_the_packets—src/lib.rsthe_cited_string_on_the_named_line_becomes_the_target—src/lib.rsthe_same_citation_on_another_line_is_not_this_packets_business—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 5 | 5 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 5
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 385 |
| Code lines | 296 |
| Public API items | 5 |
| Public modules | 0 |
| Tests | 10 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 3 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"enum" : 1
"function" : 3
"struct" : 1
pie showData
title Rust source composition
"Code" : 296
"Blank or comment" : 89
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.