Skip to content

Commit 6a8e47a

Browse files
committed
Adopt journal, ledger, and trail as internal terminology
1 parent 9837429 commit 6a8e47a

24 files changed

Lines changed: 211 additions & 211 deletions

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ where the fields are
290290
- `()` the value of the step or state, if any, in this case Unitus.
291291

292292
Results are written to the @./.store/ directory, and serve both as the
293-
permanent record of a step having been completed and also as a trace allowing
293+
permanent record of a step having been completed and also as a journal allowing
294294
the procedure to be resumed if interrupted. The line format is serialized by
295295
@src/runner/state.rs, which is authoritative.
296296

src/engraving/checks/ledger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ fn an_orphaned_scope_does_not_adopt_what_opens_after_it() {
310310
fn a_resumed_scope_keeps_the_serial_it_was_entered_at() {
311311
// A scope opened after an orphan is found again on the next walk, so
312312
// resuming does not write a second `Begin` for it. It did, and each resume
313-
// then mis-parented the next, ratcheting a duplicate spine onto the trail
313+
// then mis-parented the next, ratcheting a duplicate spine onto the journal
314314
// one pair of records at a time.
315315
let ledger = fold(vec![
316316
record(1, "/task:", State::Begin(Vec::new())),

src/engraving/checks/navigation.rs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::engraving::{InvokeTarget, Motion, Position, Record, RunId, Serial, State, Trail};
1+
use crate::engraving::{InvokeTarget, Journal, Motion, Position, Record, RunId, Serial, State};
22

33
fn record(serial: u32, path: &str, state: State) -> Record {
44
Record {
@@ -10,7 +10,7 @@ fn record(serial: u32, path: &str, state: State) -> Record {
1010
}
1111
}
1212

13-
// A step invoking a procedure, which the trail writes at a path beside the
13+
// A step invoking a procedure, which the journal writes at a path beside the
1414
// step rather than beneath it.
1515
fn calling() -> Vec<Record> {
1616
vec![
@@ -40,42 +40,42 @@ fn calling() -> Vec<Record> {
4040
#[test]
4141
fn a_callee_is_enclosed_by_its_call_site() {
4242
let records = calling();
43-
let trail = Trail::new(&records);
43+
let journal = Journal::new(&records);
4444

4545
assert_eq!(
46-
trail.step(Position::At(4), Motion::Left),
46+
journal.step(Position::At(4), Motion::Left),
4747
Some(Position::At(2))
4848
);
4949
assert_eq!(
50-
trail.step(Position::At(3), Motion::Right),
50+
journal.step(Position::At(3), Motion::Right),
5151
Some(Position::At(4))
5252
);
53-
assert_eq!(trail.step(Position::At(4), Motion::PageUp), None);
54-
assert_eq!(trail.step(Position::At(4), Motion::PageDown), None);
53+
assert_eq!(journal.step(Position::At(4), Motion::PageUp), None);
54+
assert_eq!(journal.step(Position::At(4), Motion::PageDown), None);
5555
}
5656

5757
/// Down off the last record reaches the prompt the run is waiting at, and a
5858
/// run that walked to its end has no prompt to reach.
5959
#[test]
6060
fn down_off_the_end_leaves_review() {
6161
let records = calling();
62-
let trail = Trail::new(&records);
62+
let journal = Journal::new(&records);
6363
assert_eq!(
64-
trail.step(Position::At(7), Motion::Down),
64+
journal.step(Position::At(7), Motion::Down),
6565
Some(Position::Live)
6666
);
6767
assert_eq!(
68-
trail.step(Position::Live, Motion::Up),
68+
journal.step(Position::Live, Motion::Up),
6969
Some(Position::At(7))
7070
);
71-
assert_eq!(trail.step(Position::Live, Motion::Down), None);
71+
assert_eq!(journal.step(Position::Live, Motion::Down), None);
7272

7373
let mut ended = calling();
7474
ended.push(record(0, "/", State::Finish));
75-
let trail = Trail::new(&ended);
76-
assert_eq!(trail.last(), Some(Position::At(7)));
77-
assert_eq!(trail.step(Position::At(7), Motion::Down), None);
78-
assert_eq!(trail.step(Position::At(0), Motion::Up), None);
75+
let journal = Journal::new(&ended);
76+
assert_eq!(journal.last(), Some(Position::At(7)));
77+
assert_eq!(journal.step(Position::At(7), Motion::Down), None);
78+
assert_eq!(journal.step(Position::At(0), Motion::Up), None);
7979
}
8080

8181
/// `Stop` and `Resume` bracket a session, not the walk. Review opens on the
@@ -88,24 +88,24 @@ fn a_session_boundary_is_not_a_position() {
8888
records.insert(6, record(0, "/", State::Stop));
8989
records.push(record(0, "/", State::Stop));
9090
records.push(record(0, "/", State::Resume));
91-
let trail = Trail::new(&records);
91+
let journal = Journal::new(&records);
9292

93-
assert_eq!(trail.last(), Some(Position::At(9)));
93+
assert_eq!(journal.last(), Some(Position::At(9)));
9494
assert_eq!(
95-
trail.step(Position::Live, Motion::Up),
95+
journal.step(Position::Live, Motion::Up),
9696
Some(Position::At(9))
9797
);
9898
// 5 and 8 are the records either side of the interruption.
9999
assert_eq!(
100-
trail.step(Position::At(8), Motion::Up),
100+
journal.step(Position::At(8), Motion::Up),
101101
Some(Position::At(5))
102102
);
103103
assert_eq!(
104-
trail.step(Position::At(5), Motion::Down),
104+
journal.step(Position::At(5), Motion::Down),
105105
Some(Position::At(8))
106106
);
107107
assert_eq!(
108-
trail.step(Position::At(9), Motion::Down),
108+
journal.step(Position::At(9), Motion::Down),
109109
Some(Position::Live)
110110
);
111111
}
@@ -139,19 +139,19 @@ fn redispatched() -> Vec<Record> {
139139
#[test]
140140
fn a_redispatched_call_is_one_place_to_stand() {
141141
// Two sessions reaching the same call wrote the dispatch line twice, and
142-
// pressing Up walked both showing the same thing each time. The trail keeps
142+
// pressing Up walked both showing the same thing each time. The journal keeps
143143
// them; the cursor stops on the last. A second call in the same step writes
144144
// a different line at the same address, and stands on its own.
145145
let records = redispatched();
146-
let trail = Trail::new(&records);
146+
let journal = Journal::new(&records);
147147

148-
let at = trail
148+
let at = journal
149149
.last()
150150
.expect("a position to open on");
151151
assert_eq!(at, Position::At(6));
152-
assert_eq!(trail.step(at, Motion::Up), Some(Position::At(5)));
152+
assert_eq!(journal.step(at, Motion::Up), Some(Position::At(5)));
153153
assert_eq!(
154-
trail.step(Position::At(5), Motion::Up),
154+
journal.step(Position::At(5), Motion::Up),
155155
Some(Position::At(1))
156156
);
157157
}
@@ -172,11 +172,11 @@ fn two_invocations_of_one_procedure_both_stand() {
172172
record(5, "/task:/check:", State::Done(None)),
173173
record(4, "/task:/2", State::Done(None)),
174174
];
175-
let trail = Trail::new(&records);
175+
let journal = Journal::new(&records);
176176

177177
let mut at = Position::At(8);
178178
for expected in [7, 6, 5, 4, 3, 2, 1, 0] {
179-
at = trail
179+
at = journal
180180
.step(at, Motion::Up)
181181
.expect("every record stands as its own position");
182182
assert_eq!(at, Position::At(expected));
@@ -198,15 +198,15 @@ fn an_amended_answer_is_the_only_one_review_reaches() {
198198
record(3, "/task:/1", State::Begin(Vec::new())),
199199
record(3, "/task:/1", State::Done(None)),
200200
];
201-
let trail = Trail::new(&records);
201+
let journal = Journal::new(&records);
202202

203-
let at = trail
203+
let at = journal
204204
.last()
205205
.expect("a position to open on");
206206
assert_eq!(at, Position::At(5));
207-
assert_eq!(trail.step(at, Motion::Up), Some(Position::At(4)));
207+
assert_eq!(journal.step(at, Motion::Up), Some(Position::At(4)));
208208
assert_eq!(
209-
trail.step(Position::At(4), Motion::Up),
209+
journal.step(Position::At(4), Motion::Up),
210210
Some(Position::At(0))
211211
);
212212
}
@@ -228,14 +228,14 @@ fn a_revoked_scope_takes_what_it_held_with_it() {
228228
record(5, "/task:/check:/1", State::Done(None)),
229229
record(4, "/task:/check:", State::Done(None)),
230230
];
231-
let trail = Trail::new(&records);
231+
let journal = Journal::new(&records);
232232

233233
let mut at = Position::At(9);
234234
for expected in [8, 7, 6, 0] {
235-
at = trail
235+
at = journal
236236
.step(at, Motion::Up)
237237
.expect("the standing execution walks back to the root");
238238
assert_eq!(at, Position::At(expected));
239239
}
240-
assert_eq!(trail.step(at, Motion::Up), None);
240+
assert_eq!(journal.step(at, Motion::Up), None);
241241
}

src/engraving/checks/record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ fn create_and_open_round_trips_libraries() {
179179
assert_eq!(libraries, selected);
180180
}
181181

182-
// One record line, for building a trail a test then writes to disk.
182+
// One record line, for building a journal a test then writes to disk.
183183
fn line(serial: u32, path: &str, state: State) -> String {
184184
format_record(&Record {
185185
recorded: format!("2026-05-14T12:00:{:02}Z", serial),

src/engraving/ledger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Ledger {
4848
}
4949
}
5050

51-
/// Whether the trail already states this and still truly: the recorded
51+
/// Whether the journal already states this and still truly: the recorded
5252
/// line stands, so there is nothing here to record.
5353
pub fn carries(&self, record: &Record) -> bool {
5454
match &record.state {

src/engraving/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub enum StoreError {
2020
}
2121

2222
pub use ledger::{Entry, Ledger};
23-
pub use navigation::{Motion, Position, Trail};
23+
pub use navigation::{Journal, Motion, Position};
2424
pub use record::{
2525
InvokeTarget, Record, RecordError, RunId, Serial, State, Supplied, display_path, parse_records,
2626
};

src/engraving/navigation.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Moving over the records of a trail: where the review cursor can rest and
1+
//! Moving over the records of a journal: where the review cursor can rest and
22
//! what each keystroke reaches. Every record is a position; the tree the
33
//! motions climb is the one the walk took, a callee enclosed by the step that
44
//! invoked it rather than by the path it was written at.
@@ -56,15 +56,15 @@ struct Scope {
5656
outcome: Option<usize>,
5757
}
5858

59-
/// The live tree of a trail, and the motions over it.
60-
pub struct Trail<'i> {
59+
/// The live tree of a journal, and the motions over it.
60+
pub struct Journal<'i> {
6161
records: &'i [Record],
6262
scopes: HashMap<Serial, Scope>,
6363
/// The scope each record was written against.
6464
within: Vec<Serial>,
6565
/// Scopes in the order they opened, which is the order peers stand in.
6666
opened: Vec<Serial>,
67-
/// The records the cursor stops on, in trail order. `Stop`, `Resume` and
67+
/// The records the cursor stops on, in journal order. `Stop`, `Resume` and
6868
/// `Finish` bracket a session rather than state anything the walk did, so
6969
/// they are not positions; `Start` is, being the root's own entry.
7070
order: Vec<usize>,
@@ -73,11 +73,11 @@ pub struct Trail<'i> {
7373
finished: bool,
7474
}
7575

76-
impl<'i> Trail<'i> {
77-
/// Fold a trail into the tree it built. The enclosing scope of each is
76+
impl<'i> Journal<'i> {
77+
/// Fold a journal into the tree it built. The enclosing scope of each is
7878
/// whichever was innermost open when its `Begin` landed, so a procedure is
7979
/// enclosed by the step that invoked it.
80-
pub fn new(records: &'i [Record]) -> Trail<'i> {
80+
pub fn new(records: &'i [Record]) -> Journal<'i> {
8181
let mut scopes: HashMap<Serial, Scope> = HashMap::new();
8282
let mut within = Vec::with_capacity(records.len());
8383
let mut opened = Vec::new();
@@ -226,7 +226,7 @@ impl<'i> Trail<'i> {
226226
order.push(i);
227227
}
228228

229-
Trail {
229+
Journal {
230230
records,
231231
scopes,
232232
within,

src/engraving/record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ fn parse_optional_value(rest: Option<&str>) -> Result<Option<value::Value>, Reco
487487
}
488488

489489
// Single-line PFFTT text form for a runtime `value::Value`, so a completed
490-
// step's result survives in the trail and rehydrates on resume.
490+
// step's result survives in the journal and rehydrates on resume.
491491
//
492492
// Unitus -> ()
493493
// Literali(s) -> "<escaped>"

src/engraving/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl Store {
9494
Ok((run_id, run_dir))
9595
}
9696

97-
/// Read an existing run's trail back into memory, every record in the
97+
/// Read an existing run's journal back into memory, every record in the
9898
/// order it was written.
9999
pub fn read(&self, run_id: RunId) -> Result<Vec<Record>, StoreError> {
100100
let run_dir = self

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ fn main() {
380380
.default_value("interactive")
381381
.action(ArgAction::Set)
382382
.conflicts_with_all(["interactive", "automatic", "quiet"])
383-
.help("How to walk the procedure: interactively, prompting the user at each step; automatically, taking each step's computed value and running to completion or first failure; or quietly, also running automatically but suppressing all progress trace output, so that only the output of external commands is printed to the terminal."),
383+
.help("How to walk the procedure: interactively, prompting the user at each step; automatically, taking each step's computed value and running to completion or first failure; or quietly, also running automatically but suppressing all progress trail output, so that only the output of external commands is printed to the terminal."),
384384
)
385385
.arg(
386386
Arg::new("interactive")
@@ -409,7 +409,7 @@ fn main() {
409409
.value_parser(["pfftt", "native"])
410410
.default_value("pfftt")
411411
.action(ArgAction::Set)
412-
.help("Whether to write the recorded trace to disk in PFFTT format, as is the default, or to instead print a diagnostic trace of the steps as the are completed (for debugging)."),
412+
.help("Whether to write the recorded journal to disk in PFFTT format, as is the default, or to instead print a diagnostic trail of the steps as they are completed (for debugging)."),
413413
)
414414
.arg(
415415
Arg::new("raw-control-chars")
@@ -436,8 +436,8 @@ fn main() {
436436
)
437437
.subcommand(
438438
Command::new("log")
439-
.about("Print the trace recorded for a procedure run.")
440-
.long_about("Print the trace recorded when a Technique procedure was run. \
439+
.about("Print the journal recorded for a procedure run.")
440+
.long_about("Print the journal recorded when a Technique procedure was run. \
441441
Each line is one recorded event: entering a step, executing a command, \
442442
and the result the step settled on. Times are relative to the start of \
443443
the run, which is given in the heading.")
@@ -452,7 +452,7 @@ fn main() {
452452
.value_parser(["console", "json", "pfftt", "native"])
453453
.default_value("console")
454454
.action(ArgAction::Set)
455-
.help("Change the output format. The default is to print a human-readable version of the trace to the terminal. \
455+
.help("Change the output format. The default is to print a human-readable version of the journal to the terminal. \
456456
Other formats include a JSON array, with one object per record line; \
457457
the raw Procedure interchange Format For Transferring Techniques record lines as they are stored on disk; \
458458
or, (for debugging) the internal data structures the records were parsed back into)."),

0 commit comments

Comments
 (0)