Repository navigation
fix: file helper polish (statuses, early size check, docs, CI skips) - #16
Merged
Merged
Conversation
Align error statuses with dock-js and dock-go (200 for file_command_failed and output_truncated, 0 for file_too_large), restore a cheap early size check in files.write before base64-encoding, document non-UTF-8 names, list on a regular file and symlinked dirs, and fail CI when unit tests skip. Fixes #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default Actions shell is `bash -e` without pipefail, so `pytest | tee unit.log` exited with tee's status and a failing unit test passed CI. Set pipefail in the step. README: the files.write example had "hi\n" split across two lines, and the status note implied dock-js and dock-go have file_not_utf8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
parnexcodes
commented
Oct 11, 2026
parnexcodes
left a comment
Member
Author
There was a problem hiding this comment.
Review: fix: file helper polish (statuses, early size check, docs, CI skips)
Verdict: SHIP (after the fixes in cfa0fe4)
Blocking
.github/workflows/ci.yml:29(fixed in cfa0fe4) -pytest ... | tee unit.logran under the default Actions shell, which the CI log shows as/usr/bin/bash -e {0}(no pipefail), so the step took tee's exit status. Failure: any failing unit test produced a green "Unit tests" step. Reproduced locally with a scratch failing test:bash -e -c 'pytest test_fail.py | tee unit.log; grep ...'exited 0; withset -o pipefailit exits 1. Fix:set -o pipefailat the top of the step. CI on cfa0fe4 shows the step running it, with 75 passed and nothing skipped.
Non-blocking
README.md:30(fixed in cfa0fe4) - this was already broken before the PR: thefiles.writeexample split"hi\n"across two lines, which is a SyntaxError. It is now"hi\n", and every python block in the README compiles.README.md:64(fixed in cfa0fe4) - "dock-js and dock-go match" sat next tofile_not_utf8, which neither of them has. It now says the statuses match for the codes they share and thatfile_not_utf8is Python only.src/usedock/client.pyread/list - dock-js (assertCommandSizein#run) and dock-go (run) also raisefile_too_largefor a read or list whose path pushes the command over 64 KB. Python sends that command anyway, and the API rejects it with its own error. This predates the PR and is outside #11. It is worth a follow-up issue.
Verified
- Statuses: dock-js
src/client.ts#runuses 200 forfile_command_failedandoutput_truncated, andsrc/files.ts assertCommandSizeuses 0 forfile_too_large. dock-gofiles.gorun/checkTruncateduses Status 200 for both and leaves Status unset (0) onfile_too_large. Python now matches: 200/200/0. All three check the exit code before truncation. - Early 48 KB check cannot refuse a write that fits. The fixed template overhead is 86 bytes with an empty path (88 with a one-character path). The largest content that fits in 64 KB is 49086 bytes for either path, which is below the 49152-byte early threshold. Content over 49152 always needs base64 of at least 65540 bytes, which is more than 65536 on its own.
- CI skip grep: it only reads the unit-step log (test_client.py and test_bash_resolver.py). The 6 live-scenario skips (
set DOCK_API_URL, ...) happen in the separate "Scenario tests (offline)" step, which the grep does not read, so they do not fail CI. The CI-only bash test runs underCI=true, so the unit step reports 75 passed and 0 skipped. - Tests cover the new behaviour: a 500 MB input with
base64.b64encodepatched to raise, a non-UTF-8 name decoded to U+FFFD, and status assertions for all three codes.
Checks
ruff check .: passruff format --check .: passmypy: passDOCK_SCENARIOS_DIR=... DOCK_SCENARIOS_REQUIRED=1 pytest -rs(Windows, Git Bash): pass (82 passed, 7 skipped: 1 CI-only, 6 live-API scenarios without credentials)- GitHub CI on cfa0fe4: test (3.9), test (3.13), gitleaks, cla all pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11
What
file_command_failedandoutput_truncatednow carry status 200;file_too_largestays 0 (matches dock-js and dock-go).files.writerejects content over 48 KB before base64-encoding, so a huge input fails fast.files.listcome back with U+FFFD and cannot be passed back; list on a regular file raisesfile_command_failed; symlinked dirs list the target; statuses table text updated. There is no changelog file in this repo, so the README carries the notes.pytest -rsand fails if any test is skipped; the symlink skip becomes a failure underCI.pipefail(the default Actions shell isbash -e, sopytest | teehid a failing pytest), the READMEfiles.writeexample no longer splits"hi\n"across two lines, and the status note saysfile_not_utf8is Python only.Why
Cross-SDK consistency (dock-js#9 review) and a cheap guard against encoding hundreds of MB.
How to verify
ruff check . && ruff format --check . && mypy && DOCK_SCENARIOS_DIR=... DOCK_SCENARIOS_REQUIRED=1 pytest -rs: all pass locally (82 passed, 7 skipped: 1 CI-only, 6 live-API scenarios). New tests: 500 MB input fails fast with base64 patched to raise, non-UTF-8 name listing, status assertions 200/200/0.Risk
Low. Behaviour change:
DockError.statusfor two codes goes from 0 to 200, so callers matching on status 0 for these will change. Follow-up for the dock repo (not touched here): thesdk-scenarios/README.mdtable could state these statuses.🤖 Generated with Claude Code