Charge directory creation against a mount's write_bytes_limit

RE
1d ago
+148-44

We can optionally (default off) set write limits on a mount, however we do not currently charge for writing directories.

This prices directories at 4096 bytes charging them towards the same write_bytes_limit.

šŸ¤– Generated with Claude Code


Summary by cubic

Makes mkdir count against a mount's write_bytes_limit so a write budget also bounds how many directories sandboxed code can create.

  • Each directory created, parents included, is charged 4,096 bytes (DIRECTORY_WRITE_BYTES) before anything is created; the charge is committed only after the operation succeeds.
  • Overlay mkdir(parents=True) collects the directories it will record first, so a refused call leaves no partial tree.
  • mkdir on an existing directory is free, and the limit remains optional with unlimited as the default.