ECSS Packet Utilisation — Managing Directories (space-systems/ecss/e7041-managing-directories)
Use when the task is the directory management of ECSS-E-ST-70-41C
clause 6.23.4.5 -- creating, deleting, renaming and moving the
sub-repositories of an on-board file system, where the happy path is
a dictionary insertion and the refusals are the whole subject.
Domain quick reference
- Four requests act on structure rather than content: create a
sub-repository under an existing parent, delete one, rename one in
place, move one under a different parent.
- A delete is refused unless the target holds neither a file nor a
sub-repository. There is no undo on board and no second copy, so
the empty-only rule is the only thing that forces an operator to
look inside before the content goes. A helpful recursive delete
removes the guard entirely.
- The refusal has to say what was inside. "Not empty" sends the
operator back to guess; two files and one sub-repository tells
them what the next request is.
- A rename changes the last segment and keeps the parent. A move
keeps the name and changes the parent. They are not the same
request with different arguments, and each fails in a way the
other cannot.
- Both re-path everything underneath. A subtree that keeps its old
paths after its parent moved is a tree with two answers for one
repository.
- A move into the target's own subtree is the one failure that
corrupts rather than refuses: the subtree detaches from the root
and nothing reaches it again. Catch it before applying, and note
that moving a repository onto itself is the same defect.
- The root repository cannot be deleted, renamed or moved. It is the
anchor every path is expressed against.
- Maximum depth is declared and enforced at the request. A create or
a move that would exceed it is refused now, not discovered later by
a path too long for the field that carries it.
- A move checks the depth of the deepest repository in the subtree,
not of the repository being moved. Moving a shallow parent can push
a grandchild past the cap.
- Name collisions span both kinds. A new sub-repository may not take
the name of a file in the same parent, nor of a sibling.
Workflow
- Validate every segment and normalise every path before comparing
anything; two spellings of one path are one repository.
- Validate the tree: every non-root repository has its parent
present, no duplicate file names, nothing past the declared depth.
- For a create, resolve the parent, reject a name already used by a
file or a sibling, then check the resulting depth and path length.
- For a delete, refuse the root, refuse an unknown path, then refuse
a non-empty target and report its file and sub-repository counts.
- For a rename, refuse the root, accept a rename to the same name as
a no-op, reject a sibling collision, and re-path the subtree.
- For a move, refuse the root, resolve the destination parent,
reject a destination inside the target's own subtree, reject a
name collision, and only then check the deepest descendant against
the depth cap.
- Apply a plan step by step against the tree each step produced, and
report applied and refused counts and the deepest depth reached.
Pitfalls
- Recursively deleting to make a delete succeed. The refusal was the
safety feature and the content is not recoverable.
- Reporting "not empty" without the counts. The operator reissues
blind and the second refusal teaches nothing new.
- Treating a move as a rename with a path in it. The two collision
checks are against different parents.
- Moving a subtree without re-pathing it. Half the tree answers to a
parent that no longer exists.
- Allowing a move into the target's own subtree. The subtree is
detached and nothing addresses it afterwards.
- Checking the depth of the moved repository instead of its deepest
descendant. The cap is breached one level down.
- Testing containment on a raw string prefix. A sibling whose name
begins with the target's name is dragged along.
- Applying a plan against the original tree each step. Later steps
are then decided against a state that never existed.
Behavior contract (gate 3)
The segment and path mechanics, whole-segment containment, tree and
parent validation, depth enforcement, create with file and sibling
collision checks, empty-only delete with its counts, root protection,
rename versus move with subtree re-pathing, the move-into-own-subtree
refusal, the deepest-descendant depth check and the step-by-step plan
report are exercised by the gate 3 contract test:
scripts/test_e7041_managing_directories.py against
scripts/e7041_managing_directories_logic.py (stdlib unittest,
offline). Run: python3 scripts/test_e7041_managing_directories.py
Compliance
- ECSS standards are freely downloadable (ESA); cite the source and
paraphrase per standards-map.yaml.
- compliance: STANDARDS-REF, gated: false.
1---2name: e7041-managing-directories3description: "Perform and adjudicate the four requests that change the shape of an on-board repository tree under ECSS-E-ST-70-41C clause 6.23.4.5. Use when a create, delete, rename or move against a spacecraft file system was refused and the operator needs the reason rather than a retry: refusing a delete of anything holding a file or a sub-repository because nothing on board is recoverable, separating a rename that changes the last segment from a move that changes the parent, re-pathing the whole subtree under either, catching a move into a target's own subtree before it detaches it, and enforcing the declared depth at the request. Trigger: ecss, e-st-70-41c, pus-file-management, on-board-repository-tree, create-sub-repository, delete-non-empty-repository, move-repository-subtree, repository-depth-limit."4license: Apache-2.05compliance: STANDARDS-REF6standards:7 - id: ecss8 reference-only: true9gated: false10domain: space-systems11pack: space-systems12compatibility: "agentskills.io SKILL.md; any SKILL.md host (Claude Code, Hermes, OpenClaw)"13metadata:14 source: https://skillmd.com/skills/ashfordeou/e7041-managing-directories15 domain: space-systems16 subdomain: ecss17 tags: [ecss, e-st-70-41-file-management-scope, e7041-managing-directories, on-board-repository-tree, create-sub-repository, delete-non-empty-repository, move-repository-subtree, repository-depth-limit]18 version: 0.1.019 author: Aero Agent Skills20---2122# ECSS Packet Utilisation — Managing Directories (space-systems/ecss/e7041-managing-directories)2324Use when the task is the directory management of ECSS-E-ST-70-41C25clause 6.23.4.5 -- creating, deleting, renaming and moving the26sub-repositories of an on-board file system, where the happy path is27a dictionary insertion and the refusals are the whole subject.2829## Domain quick reference3031- Four requests act on structure rather than content: create a32 sub-repository under an existing parent, delete one, rename one in33 place, move one under a different parent.34- A delete is refused unless the target holds neither a file nor a35 sub-repository. There is no undo on board and no second copy, so36 the empty-only rule is the only thing that forces an operator to37 look inside before the content goes. A helpful recursive delete38 removes the guard entirely.39- The refusal has to say what was inside. "Not empty" sends the40 operator back to guess; two files and one sub-repository tells41 them what the next request is.42- A rename changes the last segment and keeps the parent. A move43 keeps the name and changes the parent. They are not the same44 request with different arguments, and each fails in a way the45 other cannot.46- Both re-path everything underneath. A subtree that keeps its old47 paths after its parent moved is a tree with two answers for one48 repository.49- A move into the target's own subtree is the one failure that50 corrupts rather than refuses: the subtree detaches from the root51 and nothing reaches it again. Catch it before applying, and note52 that moving a repository onto itself is the same defect.53- The root repository cannot be deleted, renamed or moved. It is the54 anchor every path is expressed against.55- Maximum depth is declared and enforced at the request. A create or56 a move that would exceed it is refused now, not discovered later by57 a path too long for the field that carries it.58- A move checks the depth of the deepest repository in the subtree,59 not of the repository being moved. Moving a shallow parent can push60 a grandchild past the cap.61- Name collisions span both kinds. A new sub-repository may not take62 the name of a file in the same parent, nor of a sibling.6364## Workflow65661. Validate every segment and normalise every path before comparing67 anything; two spellings of one path are one repository.682. Validate the tree: every non-root repository has its parent69 present, no duplicate file names, nothing past the declared depth.703. For a create, resolve the parent, reject a name already used by a71 file or a sibling, then check the resulting depth and path length.724. For a delete, refuse the root, refuse an unknown path, then refuse73 a non-empty target and report its file and sub-repository counts.745. For a rename, refuse the root, accept a rename to the same name as75 a no-op, reject a sibling collision, and re-path the subtree.766. For a move, refuse the root, resolve the destination parent,77 reject a destination inside the target's own subtree, reject a78 name collision, and only then check the deepest descendant against79 the depth cap.807. Apply a plan step by step against the tree each step produced, and81 report applied and refused counts and the deepest depth reached.8283## Pitfalls8485- Recursively deleting to make a delete succeed. The refusal was the86 safety feature and the content is not recoverable.87- Reporting "not empty" without the counts. The operator reissues88 blind and the second refusal teaches nothing new.89- Treating a move as a rename with a path in it. The two collision90 checks are against different parents.91- Moving a subtree without re-pathing it. Half the tree answers to a92 parent that no longer exists.93- Allowing a move into the target's own subtree. The subtree is94 detached and nothing addresses it afterwards.95- Checking the depth of the moved repository instead of its deepest96 descendant. The cap is breached one level down.97- Testing containment on a raw string prefix. A sibling whose name98 begins with the target's name is dragged along.99- Applying a plan against the original tree each step. Later steps100 are then decided against a state that never existed.101102## Behavior contract (gate 3)103104The segment and path mechanics, whole-segment containment, tree and105parent validation, depth enforcement, create with file and sibling106collision checks, empty-only delete with its counts, root protection,107rename versus move with subtree re-pathing, the move-into-own-subtree108refusal, the deepest-descendant depth check and the step-by-step plan109report are exercised by the gate 3 contract test:110scripts/test_e7041_managing_directories.py against111scripts/e7041_managing_directories_logic.py (stdlib unittest,112offline). Run: python3 scripts/test_e7041_managing_directories.py113114## Compliance115116- ECSS standards are freely downloadable (ESA); cite the source and117 paraphrase per standards-map.yaml.118- compliance: STANDARDS-REF, gated: false.