[Bug]: SDK: align public annotations with runtime behavior
Describe the bug
This consolidates 17 related SDK contract-audit reports into one issue. Sorry for the volume of individual reports. They are closed as superseded, not fixed; each linked report retains its reproduction, controls, environment, and pinned source references.
Public annotations sometimes accept inputs that the implementation rejects, exclude supported inputs, or describe a different return shape. This affects static checking and consumers deriving API contracts from those annotations. A few findings are runtime defects in handling explicitly supported input types rather than annotation-only corrections.
Findings
Optionality, defaults, and overloads
- #12782 —
Table(log_mode=None)is admitted byLogMode | Nonebut rejected by validation; omission and the three string modes work. - #12783 —
Artifact.add_file/add_dir(skip_cache=None)is admitted bybool | Nonebut rejected by the shared non-nullable manifest field; boolean controls work. - #12784 —
RunEvent.metric(...).changes_by/increases_by/decreases_byoverloads require bothdiffandfrac, while the supported calling forms supply exactly one. - #12795 — OpenAI fine-tuning
WandbLogger.syncdeclaresstrbut returnsNoneon its already-synced, no-overwrite path. - #12796 —
wandb.controller().sweep_configomitsNonefrom its return annotation during the supported deferred-creation state. - #12798 — Ultralytics
add_wandb_callback(max_validation_batches=None)advertisesNonebut validation reachesmin(None, batch_count); the default-1 control succeeds. - #12799 — Fabric
WandbLogger(save_dir=None), including thediralias, works but is excluded by the constructor annotation.
Container, value, and return types
- #12785 —
plot.line_seriesadvertises arbitrary outerIterablevalues forxs,ys, andkeys, but indexing/length operations reject ordinary iterators. - #12786 —
plot.pr_curveadvertises one-dimensional probabilities while requiring two-dimensional input; the advertised general label iterable also rejects ordinary iterators. - #12787 —
BoundingBoxes2D.to_json/from_jsonannotate dictionaries where the existing artifact representation is a list of box dictionaries. - #12789 —
VideoadvertisesTextIO, but its stream branch supportsBytesIOand rejects text streams. - #12790 —
Trace.metadata/inputs/outputsproperty annotations restrict dictionary values to strings, although numeric and nested values are supported and returned unchanged. - #12793 —
RunQueue.template_variables,external_links, andaccessannotations disagree with the returned list, nested dictionary, and uppercase access value shown in upstream tests. - #12794 — OpenAI fine-tuning
WandbLogger.sync(**kwargs_wandb_init)annotates each forwarded value as a dictionary, rejecting documented scalar/listwandb.initoptions in static checking. - #12797 —
LaunchAgent.thread_idsandfinish_thread_idannotate integers, while normal bookkeeping and cleanup exchange string queue-item IDs.
Runtime handling of supported inputs
- #12791 —
Molecule(Path(...))drops parent directories via.name; the equivalent full string path works. - #12792 —
Bokeh(Document(...))accepts a valid nonempty document but leaves media unset and serializes no data/path; the equivalent model control works.
Expected behavior
Make public signatures, annotations, documentation, and supported runtime behavior agree. Preserve intentional defaults and existing serialization formats. Where an advertised input is rejected, the report does not assume that widening runtime acceptance is preferable to correcting the annotation, nor prescribe a shared meaning for None.
The checkboxes represent unresolved findings; closing the original reports is only consolidation.
Verification and environment
- W&B SDK: 0.30.0, with each finding also reproduced on or source-compared against main at
8f93d444. - Python: 3.12.12 for the expanded audit; 3.13.5 for the original Table release reproduction.
- OS: macOS 26.1, arm64. Optional dependency versions and any compatibility accommodations are recorded in the individual reports.
- Checks used local/offline objects and disabled runs where applicable. Some service-dependent paths used simulated external collaborators, explicitly identified in their reports; these are not live-backend results.
- No authenticated W&B server operations or cloud jobs were performed. The full upstream test suite and hosted CI were not run; this is a bounded audit, not a claim of complete annotation coverage.
The separately existing paginator work in #12402 was identified during review and is not duplicated in this checklist.
Source: wandb/wandb