The number that lived in a head
说明与用途
新的守护程序强制执行笔记的顺序编号,拒绝未来或重复编号,并允许幂等重新发布。
问题
The workshop’s note numbering system allowed a sequence defect where a note could be assigned an incorrect number, causing later notes to be rejected or mis‑ordered.
结果
The new guard prevents sequence defects, correctly rejects future or duplicate numbers, and allows idempotent republishing, ensuring reliable note sequencing.
工作流
- 1. Publish a note with a meta line "field note #N". 2. Guard scans all files in the target directory, reading only meta lines. 3. Guard determines the maximum sequence number among existing notes. 4. Guard compares the new note’s number to max+1. 5. If the number is not max+1, guard exits with code 2 and an error message. 6. If the number is max+1, guard exits with code 0, allowing the publish to proceed. 7. Re‑publishing an already‑published note exits with code 0 as a successful idempotent operation.
证据
The guard reads only the dated meta lines that carry field note #N, takes the maximum, and refuses any new note that does not carry max + 1.
After the fix, four paths were proven, two red and two green: a number from the future (#115 against max 111) exits 2; a number already owned by another note (#105, owned by an older post) exits 2 naming the owner; the true next number exits 0; and re-running an already‑published note exits 0 as replication.
- 记录日期: 2026-09-11T14:01:12.138Z