126-a-derived-file-stays-in-its-directory
A derived file stays in its directory
`compile` and `index` name each per-spec shard `<id>.json` after the spec's frontmatter `id`, and `attest --spec` names its attestation the same way. None of the three checked that the id was a file name before joining it to a directory. A corpus declaring `id: "../../../package"` made `compile` overwrite the repository's `package.json` with shard JSON, an absolute id wrote wherever it pointed, and `index` and `attest --spec` did the same while exiting 0. `V-012` reported the id, but after the write rather than instead of it. These are verbs documented as safe to run against a stranger's branch. Every file name derived from a spec id is now checked before anything is written, pruned or created: a name that is not one plain file name refuses the whole write with exit 3 and leaves the tree as it was.
Read the full pinned specification ↗Relationships
depended on by
Claimed units
- establishes
{ "kind": "file", "path": "crates/spec-spine-cli/tests/derived_paths.rs" } - extends
{ "nature": "additive", "spec": "022-index-sharding", "unit": { "kind": "file", "path": "crates/spec-spine-core/src/shard.rs" } } - extends
{ "nature": "additive", "spec": "039-per-spec-attestation", "unit": { "kind": "file", "path": "crates/spec-spine-cli/src/cmd_attest.rs" } } - extends
{ "nature": "corrective", "spec": "039-per-spec-attestation", "unit": { "kind": "file", "path": "crates/spec-spine-cli/src/verify_attestation.rs" } } - extends
{ "nature": "corrective", "spec": "001-compile-registry", "unit": { "kind": "file", "path": "crates/spec-spine-cli/src/cmd_compile.rs" } } - extends
{ "nature": "corrective", "spec": "004-codebase-index", "unit": { "kind": "file", "path": "crates/spec-spine-cli/src/cmd_index.rs" } }
Source headings
- 126: A derived file stays in its directory
- 1. Purpose
- 1.1 Measured, on `main` at `95ef76df` (0.24.0)
- 1.2 Why it matters
- 2. Territory
- 3. Behavior
- 3.1 A plain file name
- 3.2 The shard writer checks every name before it touches the directory
- 3.3 The per-spec attestation checks its name before it is written
- 3.4 What the refusal says
- 4. Out of scope
- 5. Resolved decisions
- Verification
Frozen anchors
No frozen anchors declared.