Title: agent: Improve test discovery for refactored callsites with different error semantics · Issue #1817 · usethis-python/usethis-python · GitHub
Open Graph Title: agent: Improve test discovery for refactored callsites with different error semantics · Issue #1817 · usethis-python/usethis-python
X Title: agent: Improve test discovery for refactored callsites with different error semantics · Issue #1817 · usethis-python/usethis-python
Description: What When the agent refactored _file/pyproject_toml/deps.py to use validated_get (which returns a default on both missing keys AND invalid types), it changed the error semantics: the original code raised PyprojectTOMLDepsError on invalid...
Open Graph Description: What When the agent refactored _file/pyproject_toml/deps.py to use validated_get (which returns a default on both missing keys AND invalid types), it changed the error semantics: the original code ...
X Description: What When the agent refactored _file/pyproject_toml/deps.py to use validated_get (which returns a default on both missing keys AND invalid types), it changed the error semantics: the original code ...
Opengraph URL: https://github.com/usethis-python/usethis-python/issues/1817
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"agent: Improve test discovery for refactored callsites with different error semantics","articleBody":"## What\n\nWhen the agent refactored `_file/pyproject_toml/deps.py` to use `validated_get` (which returns a default on both missing keys AND invalid types), it changed the error semantics: the original code raised `PyprojectTOMLDepsError` on invalid types but returned a default on missing keys. The agent only ran the module's own tests (`tests/usethis/_file/`) and the wrapper tests, missing the 21 failures in downstream callers (`tests/usethis/test_deps.py`, `tests/usethis/test_init.py`).\n\n## Where\n\n- `src/usethis/_file/pyproject_toml/deps.py` — `get_project_deps()` and `get_dep_groups()` were converted from `validate_or_raise` (raises on invalid type) to `validated_get` (returns default on invalid type), silently changing behaviour.\n- `tests/usethis/test_deps.py` — 21 tests that exercise the error-raising path through `_deps.py` → `_file/pyproject_toml/deps.py`.\n- `tests/usethis/test_init.py` — additional tests that depend on correct backend dispatch through these paths.\n\n## Why it matters\n\nThe agent validated changes by running only the directly-related test files, not the transitive callers. When a refactoring changes error semantics (e.g. swallowing errors that were previously raised), the breakage manifests in downstream tests, not in the module's own tests.\n\n## Lesson\n\nWhen replacing a function that has **different behaviour for missing-key vs invalid-type** (return default vs raise error) with a wrapper that treats both the same way (`validated_get`), the agent must:\n\n1. Identify all transitive callers of the changed function (e.g. `_deps.py` calls `_file/pyproject_toml/deps.py`).\n2. Run the tests for those transitive callers, not just the direct module tests.\n3. Specifically check whether the original code distinguished between 'missing' and 'invalid' error paths before collapsing them into a single default-returning wrapper.\n\n## Suggested improvement\n\nImprove the `usethis-python-test-affected-find` skill to emphasize how to discover all potentially affected tests whenever a function's error semantics change, rather than relying on the agent's manual judgement about which test files are relevant.","author":{"url":"https://github.com/nathanjmcdougall","@type":"Person","name":"nathanjmcdougall"},"datePublished":"2026-04-04T17:33:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1817/usethis-python/issues/1817"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f76f9b31-a80a-d710-2347-600c142e69cd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF9C:174B86:DB25DD:1293BF7:6A4D5BEE |
| html-safe-nonce | 4a4aa5e260421de9cc46f1093b151665ccc8fd13e705ee5ab7e77447daeb1ae4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjlDOjE3NEI4NjpEQjI1REQ6MTI5M0JGNzo2QTRENUJFRSIsInZpc2l0b3JfaWQiOiIzMjE4Nzc4NDU0ODIxMjY0MzY2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6dd3342477ec76e09cd0c26f4e24fe80e63a10516f23c83c968f2b6e526bd133 |
| hovercard-subject-tag | issue:4205422389 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/usethis-python/usethis-python/1817/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d65d99d4170f6e6126ef71a5b764c23ff930340f839760186444624d73ae20ed/usethis-python/usethis-python/issues/1817 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d65d99d4170f6e6126ef71a5b764c23ff930340f839760186444624d73ae20ed/usethis-python/usethis-python/issues/1817 |
| og:image:alt | What When the agent refactored _file/pyproject_toml/deps.py to use validated_get (which returns a default on both missing keys AND invalid types), it changed the error semantics: the original code ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nathanjmcdougall |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2a1443ff9733a3016431263ea73c93d8fe00c195eb4a7670ac30e7848f045441 |
| turbo-cache-control | no-preview |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3bdd3157ea1f0fd738d408eceeead721acf1dc3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width