test(cli): add failing tests for session create DI container error (#570) #595

Merged
brent.edwards merged 3 commits from feature/m3-fix-session-create-error into master 2026-03-10 23:08:21 +00:00

3 Commits

Author SHA1 Message Date
brent.edwards 142895e34d Merge remote-tracking branch 'origin/master' into feature/m3-fix-session-create-error
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 18s
CI / quality (pull_request) Successful in 21s
CI / typecheck (pull_request) Successful in 39s
CI / security (pull_request) Successful in 39s
CI / unit_tests (pull_request) Successful in 4m22s
CI / integration_tests (pull_request) Successful in 5m2s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m9s
CI / benchmark-regression (pull_request) Successful in 34m47s
# Conflicts:
#	CHANGELOG.md
2026-03-10 22:56:43 +00:00
brent.edwards 4fff7f67c5 fix(test): use scoped_session to prevent GC-induced data loss in r2cov
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 16s
CI / lint (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m35s
CI / docker (pull_request) Successful in 39s
CI / integration_tests (pull_request) Successful in 3m22s
CI / coverage (pull_request) Successful in 6m4s
CI / benchmark-regression (pull_request) Has been cancelled
SQLite in-memory engines use SingletonThreadPool, giving every Session
the same underlying connection.  Repository methods create a new
Session via the factory, flush, then return — letting the Session go
out of scope.  Under high memory pressure (e.g. 32 parallel behave
workers) Python's garbage collector closes these orphaned Sessions,
issuing an implicit ROLLBACK on the shared connection and wiping
flushed-but-uncommitted rows written by other Sessions.

Replace the plain sessionmaker with scoped_session in the r2cov
Background step so that every factory() call returns the same Session
instance.  A single long-lived Session per scenario eliminates the
premature close/rollback window entirely.

Verified: 3 consecutive green runs with --processes 32 (10 099
scenarios, 0 failures each).

Refs: #570
2026-03-10 22:27:37 +00:00
Brent E. Edwards d0689573e0 test(cli): add failing tests for session create DI container error
CI / lint (pull_request) Successful in 13s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 18s
CI / build (pull_request) Successful in 32s
CI / security (pull_request) Successful in 48s
CI / typecheck (pull_request) Successful in 55s
CI / unit_tests (pull_request) Failing after 2m41s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 3m25s
CI / coverage (pull_request) Successful in 5m56s
CI / benchmark-regression (pull_request) Successful in 33m35s
Add TDD regression tests for bug #570 where `_get_session_service()`
calls `container.db()` but the DI `Container` class has no `db`
provider, raising `AttributeError`.  Same root cause as bug #554.

Includes 4 Behave BDD scenarios tagged `@tdd_bug @tdd_bug_570
@tdd_expected_fail`, Robot Framework integration smoke tests with
`--format plain`, and ASV service-layer benchmarks.  Tests exercise the
real DI path by resetting `_service = None` and using a file-based
SQLite database.

Implements the `@tdd_expected_fail` inversion infrastructure:
- Behave: `after_scenario` hook in `features/environment.py` inverts
  pass/fail for scenarios tagged `@tdd_expected_fail`
- Robot: `robot/tdd_expected_fail_listener.py` listener (API v3)
  performs the same inversion for Robot test cases
- `noxfile.py`: registers the listener via `--listener` in both the
  `integration_tests` and `slow_integration_tests` sessions

Migrates 18 existing TDD scenarios across 5 feature files from the old
`@tdd @bugNNN` convention to the standardised `@tdd_bug @tdd_bug_NNN`
tags per CONTRIBUTING.md § TDD Bug Test Tags.

Refs: #570
2026-03-10 21:39:31 +00:00