Skip to content

refactor(api)!: drop _mock suffix from plugin proxy names#56

Merged
elijahr merged 2 commits intomainfrom
drop-mock-suffix
Apr 20, 2026
Merged

refactor(api)!: drop _mock suffix from plugin proxy names#56
elijahr merged 2 commits intomainfrom
drop-mock-suffix

Conversation

@elijahr
Copy link
Copy Markdown
Contributor

@elijahr elijahr commented Apr 20, 2026

Summary

  • All 26 plugin proxy singletons on the bigfoot module are renamed to drop the _mock suffix. Canonical names are now un-suffixed: bigfoot.subprocess, bigfoot.db, bigfoot.redis, bigfoot.mongo, bigfoot.popen, bigfoot.log, etc. bigfoot.http was already un-suffixed and is unchanged.
  • Old _mock names (bigfoot.subprocess_mock, etc.) are retained as deprecated backward-compat aliases wired through a module-level __getattr__ in src/bigfoot/__init__.py. First access to any alias emits DeprecationWarning with message "bigfoot.<old> is deprecated; use bigfoot.<new> instead." and stacklevel=2. Subsequent accesses are silent.
  • Aliases exist in __init__.py only — every test, doc, example, plugin hint string, and README has been migrated to the canonical names. Nothing else in the repo references the _mock names except the deprecation shim itself and the tests that intentionally exercise it.
  • Version bump 0.19.2 → 0.20.0. CHANGELOG entry added with ### Changed + ### Deprecated sections.

What changed

  • src/bigfoot/__init__.py — canonical proxy assignments; _DEPRECATED_PROXY_ALIASES dict + module-level __getattr__ emit warnings
  • src/bigfoot/__init__.pyi — mirrored type stubs (canonical declarations + deprecated aliases, both declared for type-checker compat)
  • src/bigfoot/plugins/*.py — hint strings (format_mock_hint, format_assert_hint, format_unmocked_hint) now emit canonical names
  • tests/unit/test_init.py — new parametrized deprecation-alias tests covering: identity between alias and canonical, first-access emits warning with exact message + stacklevel=2, no re-warn on second access, unknown attribute still raises standard AttributeError. Uses a fixture to snapshot/restore _warned_aliases so state leaks don't mask behavior.
  • All other tests/unit/test_*_plugin.py files migrated mechanically
  • docs/guides/*.md (30 files) + docs/reference/index.md migrated
  • examples/*/test_app.py and example README.md files (31 total) migrated
  • README.md code samples migrated
  • CHANGELOG.md 0.20.0 entry
  • pyproject.toml version bump

Verification

  • Full test suite: 1809 passed in tests/, 31 passed in examples/ (1840 total)
  • Code review: ready-to-merge, no critical or important findings
  • Green-mirage audit of new deprecation-alias tests: clean (4 functions × parametrize = 10 cases; 5/5 mutations killed)
  • Grep sweep: no bigfoot.X_mock references survive outside __init__.py/__init__.pyi/the deprecation-alias test block/CHANGELOG history entries

Follow-up (not in this PR)

  • docs/guides/stateful-plugins.md documents an "Auto-assertion" behavior that contradicts the project's anti-auto-assert rule. Pre-existing, flagged by a review subagent during the migration sweep. Worth a separate cleanup PR.

elijahr added 2 commits April 20, 2026 03:36
Rename all 26 plugin proxy singletons on the `bigfoot` module to drop the
`_mock` suffix. Canonical API is now un-suffixed:

  bigfoot.subprocess, bigfoot.db, bigfoot.redis, bigfoot.mongo,
  bigfoot.popen, bigfoot.smtp, bigfoot.socket, bigfoot.dns,
  bigfoot.memcache, bigfoot.celery, bigfoot.log, bigfoot.boto3,
  bigfoot.async_subprocess, bigfoot.async_websocket, bigfoot.sync_websocket,
  bigfoot.psycopg2, bigfoot.asyncpg, bigfoot.elasticsearch, bigfoot.jwt,
  bigfoot.crypto, bigfoot.file_io, bigfoot.pika, bigfoot.ssh,
  bigfoot.grpc, bigfoot.mcp, bigfoot.native

`bigfoot.http` was already un-suffixed and is unchanged.

The old `_mock`-suffixed names are retained as deprecated backward-compat
aliases via a module-level `__getattr__` hook in `src/bigfoot/__init__.py`.
First access to any alias emits `DeprecationWarning` with message
"bigfoot.<old> is deprecated; use bigfoot.<new> instead." and `stacklevel=2`.
Subsequent accesses of the same alias are silent. The alias map is the
sole reference to the old names anywhere in the codebase — every test,
doc, example, plugin hint string, and README has been migrated.

Changes:
- src/bigfoot/__init__.py: canonical proxy assignments + deprecation shim
- src/bigfoot/__init__.pyi: mirrored type stubs (canonical + aliases)
- src/bigfoot/plugins/*.py: hint strings emit canonical names
- tests/: full migration + new deprecation-alias tests (4 functions,
  10 parametrized cases) covering identity, first-access warning,
  no re-warn on second access, and unknown-attribute AttributeError
- docs/: 30 guide files migrated to canonical names
- examples/: 31 files migrated to canonical names
- README.md: code samples migrated
- CHANGELOG.md: 0.20.0 entry with Changed + Deprecated sections
- pyproject.toml: version 0.19.2 -> 0.20.0
Ruff ANN401 fires because the public contract for module-level
__getattr__ is Any. Matches the project's existing noqa style in
_mock_plugin.py.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request renames all 26 plugin proxy attributes on the bigfoot module to remove the _mock suffix, establishing un-suffixed names like bigfoot.db and bigfoot.subprocess as canonical. Backward compatibility is preserved through deprecated aliases that trigger a DeprecationWarning on first access. The update is comprehensive, covering the core module, type stubs, documentation, examples, and internal error hints, and includes a version bump to 0.20.0. I have no feedback to provide as there are no review comments to address.

@elijahr elijahr merged commit 2f72f46 into main Apr 20, 2026
13 checks passed
@elijahr elijahr deleted the drop-mock-suffix branch April 20, 2026 19:11
elijahr added a commit that referenced this pull request Apr 27, 2026
Resolves the 90-file conflict between this branch's bigfoot ->
tripwire rename and PR #56's drop of the _mock suffix from plugin
proxy attribute names. The merged form takes both changes:
tripwire.subprocess.mock_run(...) instead of either
bigfoot.subprocess.mock_run(...) (main) or
tripwire.subprocess_mock.mock_run(...) (this branch).

CHANGELOG 0.20.0 section now includes both PR #56's _mock-drop
entry and this branch's rename + 10 design proposal entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant