honcho/tests/alembic
doria e3d345b961
API/SDK updates: configurability, more parameters. Unified test harness (#283)
* feat: add better params to working representation fetch in SDKs, return messages when added

* fix: working representation routes now accepting all parameters properly, with tests

* feat: add metadata/config fields to SDK objects where viable

* fix: tests

* feat: refactor SDKs to use representation config; [TEMP STAINLESS BUILD] update API

* feat: add representation object to sdks

* fix: use stainless sdk on branch

* fix: update TypeScript SDK tsconfig to use node16 module resolution

* fix: add isolatedModules = true to tsconfig

* fix: lol

* chore: coderabbit review

* feat: make delete session real

* feat: add observations routes with delete endpoints for documents. make session deletion real.

* chore: type cleanup

* fix: tests

* chore: coderabbit review

* fix: namespace by workspace

* feat: add ability to customize messages_per_summary at both workspace and session level

* chore: tests for summary config

* chore: coderabbit cleanup

* feat: make session and workspace config totally customizeable

* feat: add search by peer knowledge (#250)

* feat: search by peer perspective

* fix: enforce workspace in filters, make messages distinct in join

* fix: batch and merge migration steps

* fix: add refresh, add config to workspace, add refresh function, make fields readonly

* fix: search distinct

* fix: merge migrations

* fix: merge migrations

* fix: batch deletions, improve comments, limit consolidate dream to 100 docs at a time, auth on observations routes

* chore: review

* chore: coderabbit

* chore: review

* chore: broken comment

* feat: add set peer card route to API

* feat: create advanced configuration parameters with message>session>workspace hierarchy

* [wip] build unified testing harness

* chore: lint

* fix: cache invalidation, naming things, etc

* feat: longmem tests

* chore: peer config refactor

* feat: consolidate dream working, refactor representation

* fix: Various CR Comment Fixes

* feat: Allow configurable Redis port for harness instances and update cleanup methods to be asynchronous.

* fix: version bump, api/sdk updates

* fix: observation endpoints, deletion queue, sdk observation implementation

* chore: Fix migration order

* fix: Use published stainless sdks

* chore: (docs) update api-reference

* fix: (docs) update based on api and sdk changes

* fix: Code Rabbit Comments

* fix: Code Rabbit Final Nits

* fix: dream scheduler

* fix: SDK model type consistency

---------

Co-authored-by: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com>
2025-12-03 16:49:30 -05:00
..
revisions API/SDK updates: configurability, more parameters. Unified test harness (#283) 2025-12-03 16:49:30 -05:00
README.md feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00
__init__.py feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00
conftest.py feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00
registry.py feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00
scaffold.py feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00
test_pipeline.py feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00
verifier.py feat: introduce alembic migration verification (#238) 2025-10-23 16:24:35 -04:00

README.md

These tests validate Alembic migrations end-to-end for structure, order, and correctness. They ensure reversibility, expected schema and data, and integration with the registry and pipeline. The key components are the verifier, the test pipeline, the registry, and the revisions under test.

Verifier

  • The verifier runs checks when specific revisions are applied and reverted.
  • It validates the schema after upgrade, verifies data migrations such as defaults, backfills, and transforms, and confirms reversibility after downgrade.
  • Assertions are grouped per-revision or feature, and helpers use the SQLAlchemy inspector to introspect the database.

Test Pipeline

  • The pipeline orchestrates the database lifecycle by creating a database, applying upgrades and downgrades, running verifications, and tearing down resources.
  • It typically starts from base, upgrades to the revision immediately before a target revision, seeds the DB, runs the target migration, and then validates the schema + data
  • It relies on shared fixtures such as engine, connection, and alembic_config, and it ensures isolation per test

Registry

  • The registry declares revisions and test metadata used to drive scenarios.
  • It defines ordering and selection, attaches verifier callbacks to specific revisions or ranges, and centralizes per revision expectations.

Revisions

  • Revisions are the migration scripts under alembic/revisions.
  • Each revision should provide functions decorated with register_before_upgrade() and register_after_upgrade(). These are used to validate schemas and data before and after a migration is run

Running the Tests

  • Tests can be run all together pytest tests/alembic or individually pytest tests/alembic -k "revision_number". For example, to run the test against a1b2c3d4e5f6_initial_schema.py, you would run the command pytest tests/alembic -k "a1b2c3d4e5f6"