master
8 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6fc294b24b |
fix(database/migration_runner): add check_same_thread=False to get_current_revision() SQLite engine
CI / lint (push) Successful in 47s
CI / quality (push) Successful in 57s
CI / typecheck (push) Successful in 1m15s
CI / helm (push) Successful in 28s
CI / build (push) Successful in 41s
CI / security (push) Successful in 2m0s
CI / e2e_tests (push) Successful in 3m24s
CI / push-validation (push) Successful in 19s
CI / integration_tests (push) Successful in 4m4s
CI / unit_tests (push) Successful in 4m13s
CI / docker (push) Successful in 2m4s
CI / benchmark-regression (push) Has been skipped
CI / coverage (push) Successful in 12m41s
CI / status-check (push) Successful in 5s
CI / benchmark-publish (push) Successful in 1h17m37s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 1m12s
CI / integration_tests (pull_request) Failing after 4m47s
CI / push-validation (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 39s
CI / security (pull_request) Successful in 1m1s
CI / typecheck (pull_request) Successful in 1m17s
CI / helm (pull_request) Successful in 37s
CI / build (pull_request) Successful in 40s
CI / quality (pull_request) Successful in 59s
CI / e2e_tests (pull_request) Successful in 3m54s
CI / unit_tests (pull_request) Successful in 4m25s
CI / status-check (pull_request) Has been cancelled
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
MigrationRunner.get_current_revision() was creating a SQLite engine without
connect_args={'check_same_thread': False}, causing ProgrammingError when called
from a different thread than the one that created the engine. This is now
consistent with init_or_upgrade() which correctly passes check_same_thread=False
for all SQLite engines.
Added a Behave scenario to verify that get_current_revision() passes
check_same_thread=False when creating a SQLite engine.
ISSUES CLOSED: #10952
|
||
|
|
49ed394d11 |
fix(migration): reject migrations on prompt failure instead of auto-approving
Fixed MigrationRunner._default_prompt_for_migration silently auto-approving destructive database migrations when the interactive prompt raised any exception. The bare 'except Exception' handler was swallowing all errors and returning True (auto-approve), which could apply destructive schema migrations to production databases without user consent when stdin is broken, typer is unavailable, or any other prompt failure occurs. Changes: - Narrow exception handler from 'except Exception' to 'except (OSError, EOFError)' to only catch genuine non-interactive environment signals - Re-raise KeyboardInterrupt so Ctrl-C always works - Return False (reject) instead of True (auto-approve) on prompt failure - Log at WARNING level instead of DEBUG so the rejection is visible - Non-interactive environments (stdin not a TTY) now also return False by default - Updated docstring to document the new safe-default behavior - Added BDD regression tests for all new code paths - Added TDD feature file tdd_migration_prompt_auto_approve_7503.feature ISSUES CLOSED: #7503 |
||
|
|
0c5b140d29 |
fix(database): include alembic files in package distribution
CI / push-validation (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 38s
CI / build (pull_request) Successful in 48s
CI / quality (pull_request) Successful in 54s
CI / security (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 57s
CI / e2e_tests (pull_request) Successful in 4m48s
CI / unit_tests (pull_request) Successful in 8m5s
CI / integration_tests (pull_request) Successful in 9m23s
CI / docker (pull_request) Successful in 1m23s
CI / coverage (pull_request) Successful in 12m29s
CI / benchmark-regression (push) Failing after 0s
CI / benchmark-publish (push) Failing after 0s
CI / status-check (pull_request) Successful in 1s
CI / push-validation (push) Successful in 12s
CI / helm (push) Successful in 29s
CI / build (push) Successful in 3m23s
CI / lint (push) Successful in 3m38s
CI / quality (push) Successful in 3m40s
CI / security (push) Successful in 4m3s
CI / typecheck (push) Successful in 4m5s
CI / e2e_tests (push) Successful in 6m42s
CI / unit_tests (push) Successful in 10m7s
CI / integration_tests (push) Successful in 10m13s
CI / docker (push) Successful in 1m46s
CI / coverage (push) Successful in 10m58s
CI / status-check (push) Successful in 2s
Move alembic configuration and migration files from repository root into the Python package structure to ensure they are included in the wheel distribution. This fix resolves the FileNotFoundError when running `agents init` in Docker containers or any environment using the built wheel distribution. Changes: - Move alembic/ directory from repo root to src/cleveragents/infrastructure/database/migrations/ - Move alembic.ini to the same new location and update script_location setting - Update MigrationRunner._find_alembic_ini() to search from the new canonical location within the package - Update create_template_db.py to point to the new alembic.ini location - Update documentation references to reflect new migration file locations - Create __init__.py for migrations package - The env.py file is imported when running tests that verify all modules can be imported without errors. However, context.config is only available when alembic is actually running migrations, not during normal module imports. This caused an AttributeError when the test tried to import the migrations.env module. - Fix by using getattr() with a default value to safely access context.config, and guard all code that uses config with None checks. This allows the module to be safely imported while still functioning correctly during migrations. Testing: - Verified MigrationRunner can locate alembic.ini in new location - Tested agents init succeeds in creating project with database - Template database creation works correctly - All migration tests should pass without changes Alembic files now follow standard Python packaging conventions, making them automatically included in wheel distributions without special configuration. ISSUES CLOSED: #4180 |
||
|
|
399939a6db |
refactor(db): migrate from create_all() to Alembic-managed schema migrations
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 33s
CI / security (pull_request) Successful in 54s
CI / unit_tests (pull_request) Successful in 3m21s
CI / integration_tests (pull_request) Successful in 3m41s
CI / e2e_tests (pull_request) Successful in 3m56s
CI / coverage (pull_request) Successful in 7m38s
CI / docker (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / typecheck (pull_request) Successful in 44s
CI / lint (push) Successful in 13s
CI / build (push) Successful in 18s
CI / quality (push) Successful in 28s
CI / security (push) Successful in 40s
CI / typecheck (push) Successful in 1m0s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 4m12s
CI / unit_tests (push) Successful in 5m28s
CI / coverage (push) Successful in 4m27s
CI / integration_tests (push) Successful in 5m50s
CI / docker (push) Successful in 55s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (pull_request) Successful in 37m42s
Complete the Alembic migration infrastructure by adding CLI commands, improving stamp logic, and adding comprehensive lifecycle tests. Key changes: - Added agents db CLI command group (db.py) with 5 subcommands: migrate (autogenerate), upgrade, downgrade, current, history. All delegate to MigrationRunner which wraps Alembic command API. - Registered the db command group in main.py CLI registration. - Fixed legacy database stamp logic in MigrationRunner to stamp at "head" instead of "001_initial_schema" when pre-Alembic tables are detected. This avoids migration failures when create_all-produced tables already exist (migrations would try to CREATE TABLE and fail with "table already exists"). - Added commit() after stamp to ensure alembic_version is persisted before subsequent operations on the same in-memory database. - Added FakeConnection.commit() method to the mock test infrastructure to support the new commit call in the stamp path. - Added Behave feature (db_migration_lifecycle.feature) with 8 scenarios covering: forward migration, rollback, round-trip, CLI upgrade/current/downgrade, legacy stamp logic, and init_database schema validation. - Added vulture whitelist entries for new CLI commands. Note: init_database() still uses Base.metadata.create_all() as the primary schema creation path. Full migration to Alembic-only init is deferred until ORM model constraints are reconciled with migration scripts (action_arguments UniqueConstraint mismatch). ISSUES CLOSED: #941 |
||
|
|
7430b6e743
|
Feat: Added basic scaffolding for actors | ||
|
|
34a29d7cc8
|
Feat: Adding Actors support to database | ||
|
|
496f565a57
|
Chore: Completed stage 1.5 | ||
|
|
af5093c881
|
Chore: Got code coverage up to 98% |