1515//! an error, never a warning.
1616//!
1717//! The identity is the hash of the raw bytes as they sit on disk. Because each
18- //! version imports its predecessors by filename, and each filename carries a
18+ //! version imports its parents by filename, and each filename carries a
1919//! hash of content, the lineage is walkable from the bytes alone: the parents of
2020//! a version are the versions whose hash-prefix appears in its import
21- //! specifiers. A prefix that resolves to no local file is a missing predecessor
21+ //! specifiers. A prefix that resolves to no local file is a missing parent
2222//! (an orphan), repaired by waiting.
2323
2424use crate :: event:: Event ;
@@ -34,9 +34,9 @@ pub struct Admitted {
3434 pub hash : String ,
3535 pub path : PathBuf ,
3636 pub plan : String ,
37- /// A reading aid: one past the longest predecessor . Never a key.
37+ /// A reading aid: one past the longest parent . Never a key.
3838 pub seq : u64 ,
39- /// Predecessor references: a full hash when the predecessor is present, or
39+ /// Parent references: a full hash when the parent is present, or
4040 /// the raw 12-hex prefix when it has not arrived (an orphan edge).
4141 pub parents : Vec < String > ,
4242}
@@ -186,7 +186,7 @@ pub fn load_plan(root: &Path, plan: &str) -> Result<PlanStore, String> {
186186 }
187187 }
188188
189- // Resolve import-prefixes to full predecessor hashes among the siblings.
189+ // Resolve import-prefixes to full parent hashes among the siblings.
190190 let by_prefix: std:: collections:: HashMap < & str , & str > = raws
191191 . iter ( )
192192 . map ( |r| ( & r. hash [ ..crate :: model:: HASH_PREFIX_LEN ] , r. hash . as_str ( ) ) )
@@ -290,7 +290,7 @@ fn admit_version(path: &Path, expected_plan: &str) -> Result<Raw, String> {
290290 }
291291
292292 let source = std:: str:: from_utf8 ( & bytes) . map_err ( |e| format ! ( "not valid UTF-8: {e}" ) ) ?;
293- let import_prefixes = predecessor_prefixes ( source, path, expected_plan) ?;
293+ let import_prefixes = parent_prefixes ( source, path, expected_plan) ?;
294294
295295 Ok ( Raw {
296296 hash : actual,
@@ -301,23 +301,19 @@ fn admit_version(path: &Path, expected_plan: &str) -> Result<Raw, String> {
301301 } )
302302}
303303
304- /// The hash-prefixes of the *predecessor * version files a module imports, read
305- /// statically. A predecessor is a version of the SAME plan; a version of another
304+ /// The hash-prefixes of the *parent * version files a module imports, read
305+ /// statically. A parent is a version of the SAME plan; a version of another
306306/// plan is a cross-plan reference (CMP.API-R05), not a parent, and is excluded
307- /// from the lineage so it never shows as an orphan predecessor edge.
308- fn predecessor_prefixes (
309- source : & str ,
310- path : & Path ,
311- expected_plan : & str ,
312- ) -> Result < Vec < String > , String > {
307+ /// from the lineage so it never shows as an orphan parent edge.
308+ fn parent_prefixes ( source : & str , path : & Path , expected_plan : & str ) -> Result < Vec < String > , String > {
313309 let specs = crate :: eval:: import_specifiers ( source, path)
314310 . map_err ( |e| format ! ( "cannot read imports: {}" , e. message( ) ) ) ?;
315311 let mut out = Vec :: new ( ) ;
316312 for spec in specs {
317- // A predecessor import is a relative path to a version file.
313+ // A parent import is a relative path to a version file.
318314 let file = spec. rsplit ( '/' ) . next ( ) . unwrap_or ( & spec) ;
319315 if let Some ( ( _seq, prefix) ) = parse_filename ( file) {
320- // Only a same-plan version is a predecessor . A cross-plan reference
316+ // Only a same-plan version is a parent . A cross-plan reference
321317 // (target plan differs) is not part of this plan's lineage.
322318 match crate :: eval:: import_target_plan ( path, & spec) {
323319 Some ( other) if other != expected_plan => continue ,
@@ -335,8 +331,8 @@ fn predecessor_prefixes(
335331/// rejected — never reinterpreted into the Plan it was filed under — on the same
336332/// terms as a version whose content hash disagrees with its own filename.
337333///
338- /// The origin is derived by walking resolved predecessor pointers within the
339- /// store (no evaluation, no extra IO) to the predecessor -less ancestor. When the
334+ /// The origin is derived by walking resolved parent pointers within the
335+ /// store (no evaluation, no extra IO) to the parent -less ancestor. When the
340336/// walk reaches an ancestor that is absent locally the version is an orphan, not
341337/// a misfiling: its Plan cannot yet be confirmed, so it is left alone.
342338fn reject_misfiled ( store : & mut PlanStore , plan : & str ) {
@@ -388,27 +384,27 @@ fn reject_misfiled(store: &mut PlanStore, plan: &str) {
388384/// Derive a version's PlanId from its authored bytes (decision 0017).
389385///
390386/// A Plan's identity is the content hash of its origin — the single
391- /// predecessor -less version. An origin (a module that imports no predecessor ) is
387+ /// parent -less version. An origin (a module that imports no parent ) is
392388/// its own PlanId: the hash of its bytes, the same hash its version filename
393- /// carries. A revision inherits its Plan from its predecessor : its origin is
394- /// found by walking the predecessor imports back to the predecessor -less version,
389+ /// carries. A revision inherits its Plan from its parent : its origin is
390+ /// found by walking the parent imports back to the parent -less version,
395391/// and hashing that. The operator names nothing; identity is derived, and the
396392/// prefix width matches the version filenames' for consistency.
397393pub fn derive_planid ( path : & Path , source : & [ u8 ] ) -> Result < String , String > {
398394 let src = std:: str:: from_utf8 ( source)
399395 . map_err ( |e| format ! ( "{}: not valid UTF-8: {e}" , path. display( ) ) ) ?;
400- let origin_bytes = match sibling_predecessor_paths ( path, src) ?. into_iter ( ) . next ( ) {
396+ let origin_bytes = match sibling_parent_paths ( path, src) ?. into_iter ( ) . next ( ) {
401397 None => source. to_vec ( ) ,
402398 Some ( pred) => walk_to_origin ( & pred) ?,
403399 } ;
404400 Ok ( crate :: sha256:: sha256_hex ( & origin_bytes) [ ..crate :: model:: HASH_PREFIX_LEN ] . to_string ( ) )
405401}
406402
407- /// The resolved paths of the *predecessor * version files a module imports — the
403+ /// The resolved paths of the *parent * version files a module imports — the
408404/// same-plan siblings, sitting in the importer's own directory. A cross-plan
409- /// reference resolves elsewhere and is not a predecessor , so it is excluded, as
405+ /// reference resolves elsewhere and is not a parent , so it is excluded, as
410406/// is the `compass` prelude (which is not a version reference).
411- fn sibling_predecessor_paths ( path : & Path , source : & str ) -> Result < Vec < PathBuf > , String > {
407+ fn sibling_parent_paths ( path : & Path , source : & str ) -> Result < Vec < PathBuf > , String > {
412408 let dir = path. parent ( ) . unwrap_or_else ( || Path :: new ( "." ) ) ;
413409 let specs = crate :: eval:: import_specifiers ( source, path)
414410 . map_err ( |e| format ! ( "cannot read imports: {}" , e. message( ) ) ) ?;
@@ -427,28 +423,26 @@ fn sibling_predecessor_paths(path: &Path, source: &str) -> Result<Vec<PathBuf>,
427423 Ok ( out)
428424}
429425
430- /// Walk a predecessor chain to its origin and return the origin's raw bytes.
431- /// Any predecessor of a version shares that version's origin, so following one
432- /// predecessor at each step suffices.
426+ /// Walk a parent chain to its origin and return the origin's raw bytes.
427+ /// Any parent of a version shares that version's origin, so following one
428+ /// parent at each step suffices.
433429fn walk_to_origin ( pred : & Path ) -> Result < Vec < u8 > , String > {
434430 let mut current = pred. to_path_buf ( ) ;
435431 let mut seen = std:: collections:: HashSet :: new ( ) ;
436432 loop {
437433 if !seen. insert ( current. clone ( ) ) {
438- return Err (
439- "predecessor lineage forms a cycle; a plan's identity cannot be derived" . into ( ) ,
440- ) ;
434+ return Err ( "parent lineage forms a cycle; a plan's identity cannot be derived" . into ( ) ) ;
441435 }
442436 let bytes = fs:: read ( & current) . map_err ( |_| {
443437 format ! (
444- "predecessor {} has not arrived: a plan's identity is its origin, which cannot be \
438+ "parent {} has not arrived: a plan's identity is its origin, which cannot be \
445439 derived until the origin is present (decision 0017)",
446440 current. display( )
447441 )
448442 } ) ?;
449443 let src = std:: str:: from_utf8 ( & bytes)
450444 . map_err ( |e| format ! ( "{}: not valid UTF-8: {e}" , current. display( ) ) ) ?;
451- match sibling_predecessor_paths ( & current, src) ?. into_iter ( ) . next ( ) {
445+ match sibling_parent_paths ( & current, src) ?. into_iter ( ) . next ( ) {
452446 None => return Ok ( bytes) ,
453447 Some ( next) => current = next,
454448 }
0 commit comments