Skip to content

fix: a file that the file source cannot read is a problem of its rows, not a 500 - #257

Merged
SimonHeybrock merged 1 commit into
mainfrom
219-file-source-raises
Nov 20, 2026
Merged

SimonHeybrock merged 1 commit into
mainfrom
219-file-source-raises

Conversation

@SimonHeybrock

@SimonHeybrock SimonHeybrock commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

fix: the batch page answered 500 and showed nothing when the file source raised while a file of a row was resolved (defect 9 of #219). A mount that goes away or a catalogue that times out does this.

The workspace now treats a file that its file source cannot read as it treats a file it does not know: it refuses the value. A FileSource that cannot answer raises OSError from resolve or metadata; the contract in protocol.py says so.

# the mount is gone while the page reads the batch
states = batch.state()
[(e.loc, e.msg) for e in states['1'].problems]   # [(('sample',), 'file uuid:run-1 cannot be read: the mount is gone')]
states['1'].text, states['2'].text               # 'incomplete', 'ready': a row that names another file is untouched
batch.state()['1'].text                          # 'ready', once the source reads the file again
  • Only the rows that name the file have the problem; they read incomplete with the reason at the cell.
  • A refusal is not kept, so the next read tries again and the row recovers.
  • A step of Follow reduces the other rows and tries the row again at the next step.
  • A row with a result keeps reading done if its cell names the file as its record holds it.

Why in the workspace and not in the batch. client.resolve checks the cells of all rows in one call, so the batch cannot tell which value failed. The workspace already turns an unknown file into a refusal at the parameter that names it, and the same path gives everything above. The cost is a change of Client.submit: for such a file it raises SubmitError with the reason at the parameter, where it raised OSError. A submit that is refused writes no record, so a failure of the file system that passes does not leave a failed row behind (compare #68).

Only OSError is caught (TimeoutError, ConnectionError and the errors of a mount are subclasses). Anything else a file source raises is a defect and is still raised; a test pins this.

Not covered: a files.csv that cannot be parsed (csv.Error) still answers 500, and one without a file column reads as "unknown file". FileSource.path raising is not caught.

🤖 Generated with Claude Code

When the file source raised while the workspace resolved a file, such as
a mount gone or a catalogue that timed out, the exception went through
Client.resolve and Batch.state to the page: GET api/state and an edit
answered 500, and the page showed nothing.

The workspace now turns an OSError of the file source's resolve or
metadata into a refusal of the file, as it does for an unknown file.
So the refusal touches only the request, or the row of a batch, that
names the file: the row reads incomplete with the reason at its cell,
a step of Follow reduces the other rows and tries the row again at the
next step, and a refusal is not kept, so the next state resolves the
cell again. Any other exception of the file source is a defect and is
still raised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SimonHeybrock SimonHeybrock self-assigned this Nov 20, 2026
@SimonHeybrock
SimonHeybrock merged commit 93897c7 into main Nov 20, 2026
2 checks passed
@SimonHeybrock
SimonHeybrock deleted the 219-file-source-raises branch November 20, 2026 15:03
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.

1 participant