Skip to content

fix(cli): report annotation validation errors; bump to 0.7.0#15

Merged
mhusbynflow merged 3 commits into
masterfrom
mhusbynflow/mhusbyn/flow/samples-py-review
Jun 9, 2026
Merged

fix(cli): report annotation validation errors; bump to 0.7.0#15
mhusbynflow merged 3 commits into
masterfrom
mhusbynflow/mhusbyn/flow/samples-py-review

Conversation

@mhusbynflow

Copy link
Copy Markdown
Collaborator

What

Follow-up to the merged Phase 5 PR (#13), containing the work that wasn't in that merge plus a version bump.

  • Surface annotation validation detailAnnotationValidationError carries the per-row problems in .errors, but the CLI's central error renderer only printed the summary error.message ("Annotation has N validation error(s)"). Running samples upload-multiplexed against a sheet the server rejects therefore showed the count but not what was wrong. _dispatch now passes .errors to Output.emit_error, which renders them one-per-line in human mode and under an errors key in the --json error document. The {row, message} formatting is unified into a shared format_issue helper (also used by the multiplexed-upload warnings).
  • Bump version to 0.7.0 — releases the new samples annotation-template / samples upload-multiplexed commands and this fix. Also gives uvx/pip a fresh cache key (a cached 0.6.0 build was masking the fix during local testing).

Verification

  • Test-first: two new tests (human + --json) assert the validation detail is surfaced.
  • 236 passed across tests/unit.
  • Built the 0.7.0 wheel and confirmed the fix is in the packaged flowbio/cli/_main.py; uvx --refresh --from . flowbio --version now reports 0.7.0.

Human-mode output now

Error: Annotation has 2 validation error(s)
  row 1: Invalid scientist
  row 3: Unknown organism

🤖 Generated with Claude Code

mhusbynflow and others added 2 commits June 9, 2026 16:10
`AnnotationValidationError` carries the per-row problems in its `.errors`
list, but the CLI's central error renderer only printed `error.message` — the
summary "Annotation has N validation error(s)". A user running
`samples upload-multiplexed` against a sheet the server rejects therefore saw
the count but not what was actually wrong.

`_dispatch` now passes those errors to `Output.emit_error`, which renders them
one per line in human mode and under an `errors` key in the `--json` error
document. The `{row, message}` formatting is unified into a shared
`format_issue` helper reused by the multiplexed-upload warning output.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Releases the new `samples annotation-template` and `samples upload-multiplexed`
CLI commands and the annotation validation-error reporting. The bump also gives
`uvx`/pip a fresh cache key so the new code is picked up rather than a cached
0.6.0 build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread flowbio/cli/_output.py
print(f" {format_issue(detail)}", file=self.stderr)


def format_issue(issue: JsonValue) -> str:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a private function I'm guessing?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we can move it back to _samples.py?

Comment thread flowbio/cli/_output.py
Comment on lines +68 to +82
:param details: Per-item detail behind a summary message (e.g. the
individual annotation validation errors). Listed under ``errors`` in
``--json`` mode and one per line in human mode.
"""
if self.json_mode:
document: dict[str, JsonValue] = {"message": message}
if status_code is not None:
document["status_code"] = int(status_code)
if details:
document["errors"] = details
print(json.dumps(document), file=self.stderr)
else:
print(f"Error: {message}", file=self.stderr)
for detail in details or []:
print(f" {format_issue(detail)}", file=self.stderr)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't added tests for this

Backfills the coverage flagged in review: a direct test of the `details`
parameter added to `Output.emit_error` (rendered one-per-line in human mode and
under an `errors` key in `--json`), and unit tests for the public `format_issue`
helper including its fall-back for issue dicts without a `message` key.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mhusbynflow mhusbynflow merged commit b90ee1f into master Jun 9, 2026
4 checks passed
@mhusbynflow mhusbynflow deleted the mhusbynflow/mhusbyn/flow/samples-py-review branch June 9, 2026 15:27
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