docir — design documents Graph

Documents / Issues / issue-4952ce77d19d

A document's type cannot be changed after it is created

docir update patches every other frontmatter field but not type, so retyping a corpus means hand-editing the markdown the CLI exists to own.

issue-4952ce77d19dissueresolved#blocking#cli#schema
View as Markdown◉ View in graph

A document is written with a type and keeps it forever. docir update can change the title, description, status, tags, edges, owner, governed globs and body — everything the frontmatter carries except the one field that decides which grammar all the others are checked against.

Why it matters

Types are not a detail a corpus gets right on the first day. A store that started on the bundled software profile and grew its own vocabulary has to rename decision to whatever it actually calls one, and a corpus of any size means hundreds of documents.

With no --type, the only route is editing the markdown by hand — the single thing the write path exists to prevent. Hand editing writes a type: the schema may not declare, in a file whose directory now disagrees with it, and nothing validates either until the next reindex.

What it is not

It is not a bulk operation. One document at a time through the CLI, driven by docir query --type <old>, keeps every write validated; a bulk retype verb would have to guess at the status mapping, which is the reasoning that killed a bulk import.

How it shipped

docir update <id> --type <new> retypes a document, and the id never changes — which is the whole point, since every related edge in the corpus already names it.

Four properties make it safe to run across hundreds of documents:

  • The file moves, the filename does not. The directory names the type, so leaving the file where it was would make the layout disagree with the frontmatter on every document a corpus-wide rename touches. relocate moves it and keeps the name.
  • A retype is not a status transition. There is no edge between two types' status graphs to break, so nothing is reported as overridden. A status the target type does not declare is refused rather than silently reset.
  • Existing edges are re-validated, because the target type may allow a narrower set.
  • It is not a content change, so it does not move updated or revoke a verification.

Still one document at a time, driven by docir query --type <old>, exactly as What it is not argued. Rename a document type is the procedure for the schema half — freeing the prefix the old name holds.

To amend: Re-verify: