Framework RecipesImplementation, failure path, check

POSIX services: preserve requirements through advanced agent edits

Work through C examples of real application boundaries: Preserve complete POSIX writes when appending an order record; Close a POSIX file descriptor even when synchronization fails. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.

Download the POSIX services rule pack ZIP · Inspect the YAML rules

C

Preserve complete POSIX writes when appending an order record

write may accept fewer bytes than requested or be interrupted before writing. A log append helper must keep the remaining slice and retry interruptions. Treat a zero-byte write as an error rather than spin forever.

Broken edit flagged · corrected edit passes

C

Close a POSIX file descriptor even when synchronization fails

A failure to sync is precisely the path where cleanup is easy to skip. Attempt close independently of the fsync outcome and preserve the first durability error so the caller does not report successful persistence.

Broken edit flagged · corrected edit passes

Use a correction as a saved requirement

Choose the failure you need to prevent, add the scoped rule to your repository, and check both the broken and corrected implementation. Ask your agent to inspect the finding, repair the code and recheck the same rule. Keep framework tests beside the model check.

Perch keeps the requirement beside the code. Reuse the named check during the agent’s next edit and in CI, with cached answers free on unchanged requests.

Official POSIX services documentation · All language and framework recipes