Skip to content

conformance: the two IO divergences the shutdown-flush work left behind - #52

Merged
tannevaled merged 1 commit into
mainfrom
io-divergence-rows
Nov 16, 2026
Merged

tannevaled merged 1 commit into
mainfrom
io-divergence-rows

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What this changes

Two rows in the "how it differs from MRI" table on the conformance page, both about IO, both with the same root as the File#stat row they sit under: a stream is buffered by path and holds no descriptor.

Why now

ruby#948 merged today and closed ruby#643 — a file written and not closed now reaches disk at interpreter teardown, like MRI's ruby_cleanup does through its object-space finalizer. Measured over 16 differential cases against MRI 4.0.7: 0 diverge. The companion change in the interpreter's own README landed in that PR; per "every user-visible change updates README, landing, docs", this is the docs half.

What the fix did not make go away is two residual divergences, and this page listed neither:

IO#pwrite's bytes are not on disk until a flush, where MRI's rb_io_pwrite calls pwrite(2) and they are there the moment it returns. No longer lost — teardown flushes them — so only the immediacy differs ruby#949
An unflushed file whose directory is removed before the program ends loses its bytes: teardown re-opens the path to flush it and gets ENOENT. MRI, holding a descriptor to an unlinked file, still writes them same root as ruby#635

The second row is a cost the fix accepted, not an oversight

The first version of the teardown flush re-raised that Errno, and two existing tests went red — Dir.mktmpdir removes the directory under them, so the re-open could not succeed. An error path added to teardown has nobody left to rescue it, which makes it the one place where "a silent failure is worse than a loud one" is false; MRI's own shutdown ignores a failing fflush for exactly that reason. Writing the consequence down on this page is the whole point of the row — the alternative is a user discovering it.

Gates

Run in this worktree, not recalled:

  • gofmt -l . — prints nothing
  • go test ./... — green, 6 packages (includes tools/wired, the test that fails when a guard is called by no workflow)
  • go run ./tools/conformancefigure --root content/en — 5 total claim(s), 2 version claim(s) and 6 stubbed-helper mention(s) checked against the gate's 23672 at Ruby 4.0.9

No figure, no example answer and no method name changed, so docexample, numericsurface and upstreamlinks have nothing new to judge; CI runs them regardless.

Dispositions

Refs go-embedded-ruby/ruby#643, go-embedded-ruby/ruby#949, go-embedded-ruby/ruby#635

All three stay as they are. ruby#643 is already closed by ruby#948; ruby#949 and ruby#635 stay open on purpose — they are the two divergences this page now states, and documenting a gap does not close it.

🤖 Generated with Claude Code

ruby#948 merged today and closed ruby#643: a file written and not closed
reaches disk at interpreter teardown, like MRI's. Measured over 16
differential cases against MRI 4.0.7, 0 diverge.

What it did NOT make go away is two residual divergences, and this page
listed neither. Both have the same root as the `File#stat` row above
them: a stream is buffered by PATH and holds no descriptor.

- `IO#pwrite`'s bytes are not on disk until a flush, where MRI's
  `rb_io_pwrite` calls `pwrite(2)` and they are there the moment it
  returns. They are no longer LOST — teardown flushes them — so only
  the immediacy differs. ruby#949.

- An unflushed file whose DIRECTORY is removed before the program ends
  loses its bytes, because teardown re-opens the path to flush it and
  gets `ENOENT`. MRI, holding a descriptor to an unlinked file, still
  writes them. Teardown reports nothing, as MRI's shutdown ignores a
  failing `fflush`. Same root as ruby#635.

⛔ The second one is a COST the fix accepted, not an oversight: the
first version of the flush re-raised that `Errno`, which turned two
EXISTING tests red (`Dir.mktmpdir` removes the directory under them).
An error path added to teardown has nobody left to rescue it, so it has
to fail silently — the one place where "a silent failure is worse than
a loud one" is false. Stating it here is the whole point of the row.

Gates run locally: gofmt clean, `go test ./...` green (6 packages),
`conformancefigure --root content/en` reads 5 claims / 2 version claims
at Ruby 4.0.9. No figure, example or method name changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit efe6f73 into main Nov 16, 2026
2 checks passed
@tannevaled
tannevaled deleted the io-divergence-rows branch November 16, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The VM closes no IO at interpreter shutdown, where MRI closes every one

1 participant