Correct latest-label tiebreak, harden NDJSON/CLI, honest summary wording#1
Merged
Conversation
… honest summary Audit fixes on the export/flatten core (all with tests; 18 -> 27). - _latest_label: when any label lacks a created_at, the old max() let a timestamped label beat a missing-timestamp one lexicographically — it could return the annotator's label over the reviewer's. Use created_at when every label has one; otherwise fall back to export order (last = newest). - read_export_file: a malformed NDJSON line now raises with its line number instead of a bare JSONDecodeError traceback. - CLI --status: validate against WORKFLOW_STATUSES and fail at the boundary with a helpful message instead of passing a typo to the Labelbox API. - Summary: the CLI printed "<n> reached unlabelled", but the count includes never-reached ToLabel rows; print "<n> without labels" and fix the field comment. Field name unchanged (rename would break the public API). - Lock the documented FeatureRow contract with tests: relationship annotations, the classification/geometry "unknown" fallbacks, and the missing-API-key error.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
An audit pass over the export/flatten core. All behaviour-preserving except the latest-label fix (a real edge-case bug) and the CLI summary wording. Tests go 18 → 27; ruff + mypy strict clean.
Correctness
_latest_labelusedmax(labels, key=created_at), where a label withoutcreated_atsorts as""and always loses to a timestamped one — so a reviewer's label exported without a timestamp could be silently overridden by the annotator's. Now: if every label has acreated_at, newest wins as before; if any is missing, fall back to export order (last = newest). Rare in practice (Labelbox usually populatescreated_at), but it's the exact failure the function exists to prevent.Hardening
read_export_filereports the line number on a malformed NDJSON line instead of a bareJSONDecodeError.--statusagainstWORKFLOW_STATUSESand fails at the boundary with a clear message rather than forwarding a typo to the API.Honest output
"<n> reached unlabelled", but that count includes never-reachedToLabelrows (rows no annotator ever opened). It now prints"<n> without labels"; the field comment is corrected to match.Tests
Lock the documented
FeatureRowcontract: relationship annotations, the classification/geometry"unknown"fallbacks, and the missing-API-key error — all previously unexercised.Open questions (your call — not changed here)
Summary.n_reached_unlabelledis misnamed (it counts all rows without labels, not just reached ones). Renaming ton_without_labelsis the honest fix but a breaking API change for a published package — deferred to a major version.created_atdifferently (e.g. drop such labels, or surface a warning), say so — it's a semantic choice.