Skip to content

test: add public API snapshot guard#166

Open
akmhatey-ai wants to merge 1 commit into
dgenio:mainfrom
akmhatey-ai:test/140-public-api-snapshot
Open

test: add public API snapshot guard#166
akmhatey-ai wants to merge 1 commit into
dgenio:mainfrom
akmhatey-ai:test/140-public-api-snapshot

Conversation

@akmhatey-ai
Copy link
Copy Markdown

Summary

Adds a public API snapshot guard for chainweaver.__all__, exported class/function signatures, and exported Pydantic model fields. Prepared with AI assistance and verified locally.

Changes

  • Add tests/public_api_snapshot.py and tests/test_public_api_snapshot.py.
  • Add the initial deterministic fixture at tests/fixtures/public_api.json.
  • Add tests/scripts/regen_public_api.py for intentional public API changes.
  • Add the regeneration step to the review checklist.

Testing

  • Linting passes (ruff check chainweaver/ tests/ examples/)
  • Formatting check passes (ruff format --check chainweaver/ tests/ examples/)
  • Type checking passes (python -m mypy chainweaver/ tests/)
  • All existing tests pass (python -m pytest tests/ -v)
  • New tests added for new functionality

Additional validation:

  • python tests/scripts/regen_public_api.py ran in 500.43 ms locally and produced a stable fixture hash on repeat regeneration.
  • Smoke check confirmed the snapshot changes when a public symbol is removed, a public class signature changes, or a Pydantic model field changes.
  • git diff --cached --check
  • git diff --cached | gitleaks detect --pipe --redact --verbose --no-color

Related Issues

Closes #140

Checklist

  • Code follows project conventions (see AGENTS.md and docs/agent-context/)
  • Public API changes are documented
  • No secrets or credentials included

Limitations: this intentionally does not snapshot docstrings, matching the issue scope.

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.

Public-API snapshot test: golden file of __all__ + class/function signatures

1 participant