You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: write the format down, and check that the document stays true
docs/FORMAT.md is a byte-level description of the on-disk format: region layout,
superblock fields, inode record, bitmap bit order, block addressing, directory
entries, the maximum file size implied by the three pointer levels, and the
constraints a writer has to satisfy. It ends with a 40-line Python reader that
parses an image without any of this crate.
Writing the format down is worth more than another command: it makes the
repository a reference for the layout rather than only a tool that happens to
read it, and it lets someone writing a parser in another language check their
work against something other than the C-adjacent code they are porting.
A document that describes behaviour is a claim, and claims rot. The CI job now
extracts that Python reader from the markdown, runs it against the demo image,
and diffs its output against `easyfs ls`. If the format description and the
implementation drift apart, the build fails instead of shipping a document that
lies — which is exactly the mistake made earlier in this project, where a README
described a FUSE mount that never existed.
Machine-readable output, so a build step does not have to parse prose:
- `ls --json` — array of name, inode, type, size
- `stat --json` — the geometry object
- `check --json` — ok flag, findings with severity/code/path/message, counters
- `file --json` — size, is_elf, the identification fields, the problem if any
- `diff --json` — array of path, change, before_size, after_size
- `ls --inode` — inode numbers in the text listing
`check` keeps exiting non-zero on an error in both modes, so it gates a pipeline
and leaves a record at the same time. CI validates every JSON output with
`python3 -m json.tool`.