Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/scripts/check_plugin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ def caller_breaks(path: str, old: griffe.Object, new: griffe.Object, reshaped: s
else:
found += [f"{path}.{name}: no longer in __all__"
for name in sorted(set(before or ()) - set(after or ())) if name in new.members]
for breakage in griffe.find_breaking_changes(old, new):
if _benign(breakage, old, new) or breakage.obj.path in reshaped:
scope = (old.parent, new.parent) if old.is_function else (old, new)
for breakage in griffe.find_breaking_changes(*scope):
if (old.is_function and breakage.obj.path != old.path) or _benign(breakage, old, new) \
or breakage.obj.path in reshaped:
continue
found.append(_describe(breakage, public))
return found
Expand Down
15 changes: 13 additions & 2 deletions tst/unit/test_check_plugin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ def settings(package, config=None):
"internal.py": '''
def compute(x):
return x
''',
"runner/store.py": '''
def count_runs(task_id=None):
return 0


def prune_runs(days=30):
return 0
''',
}

Expand Down Expand Up @@ -188,11 +196,13 @@ def _check(tmp_path: Path, edits: list[tuple[str, str, str]], title: str | None
"agent_env.plugins.ENVS: Attribute value was changed"),
([(ARTIFACT, "Field(default=0,", "Field(default=1,")],
"agent_env.artifact.artifact.Artifact.version: Attribute value was changed"),
([("runner/store.py", "def count_runs(task_id=None):", "def count_runs(task_id):")],
"agent_env.runner.store.count_runs(task_id): Parameter is now required"),
Comment thread
greptile-apps[bot] marked this conversation as resolved.
], ids=["method-removed", "parameter-renamed", "required-parameter-added", "default-changed", "class-attribute-changed",
"base-removed", "abstract-method-added", "method-became-abstract", "method-became-required",
"hook-parameter-added", "async-to-sync", "classmethod-to-staticmethod", "required-private-method-changed",
"dataclass-field-removed", "dropped-from-all", "export-removed", "settings-signature-changed",
"group-name-changed", "field-default-changed"])
"group-name-changed", "field-default-changed", "used-function-signature-changed"])
def test_reports_a_break(tmp_path, edits, reported):
result = _check(tmp_path, edits)

Expand All @@ -213,9 +223,10 @@ def test_reports_a_break(tmp_path, edits, reported):
[(CONTEXT, " agent_model: str | None = None\n",
" agent_harness: str | None = None\n agent_model: str | None = None\n")],
[(ARTIFACT, 'Field(description="Unique id")', 'Field(description="The artifact\'s id")')],
[("runner/store.py", "def prune_runs(days=30):", "def prune_runs(days):")],
], ids=["docstring", "new-optional-method", "private-rename", "internal-module", "parameter-swallowed-by-kwargs",
"annotation-gains-a-value", "instance-attribute-expression", "default-to-equal-literal",
"dataclass-field-inserted", "field-description"])
"dataclass-field-inserted", "field-description", "unused-sibling-of-a-used-function"])
def test_passes_a_compatible_change(tmp_path, edits):
result = _check(tmp_path, edits)

Expand Down
Loading