Awesome Reviewers

Reviewer · API

Preserve API backward compatibility

Treat public function signatures and serialized output shapes (e.g., `to_dict`/`to_json`/`to_yaml` keys) as part of the stable API contract, even when the removed data was a placeholder or unused internally. Removing parameters from exported functions, or dropping keys from a serialization payload, can break external callers or downstream consumers...

Instruction

Treat public function signatures and serialized output shapes (e.g., to_dict/to_json/to_yaml keys) as part of the stable API contract, even when the removed data was a placeholder or unused internally. Removing parameters from exported functions, or dropping keys from a serialization payload, can break external callers or downstream consumers (dashboards, telemetry pipelines, state-restore logic) that depend on the documented shape.

When such a change is necessary:

  • Keep removed parameters as deprecated keyword-only arguments (ignored, with a warning) rather than deleting them outright, or clearly flag the change as breaking in the PR/release notes.
  • Add a regression test that asserts the full output shape (e.g., the complete key set of to_dict() for a fully constructed object) so future changes to the contract are caught in review rather than discovered by consumers.
  • Explicitly document any contract change, since “no in-repo caller uses this” does not account for external packages or published API consumers.

Additionally, when calling methods that subclasses may override (e.g., a mixin’s to_dict(strict) invoked polymorphically on nested attributes), always pass arguments by keyword rather than positionally:

# Fragile: silently binds to the wrong parameter if a subclass changes signature
return attr_value.to_dict(strict)

# Safe: raises a clear TypeError on mismatch instead of producing wrong output
return attr_value.to_dict(strict=strict)

This ensures that any incompatibility in an overridden interface fails loudly and immediately, rather than silently corrupting data for consumers of the API.