#!/usr/bin/env python3 """Explicit short TTL and dependency failure checks; always restore baseline.""" import os from pathlib import Path from run_experiments import compose, runner, wait_instances ROOT = Path(__file__).resolve().parents[1] def main(): try: env = dict(os.environ, SESSION_TTL_SECONDS='2') compose('up', '-d', '--no-deps', 'api', env=env) wait_instances(2) text = runner('python', 'student-tests/session_expiry.py') (ROOT / 'evidence/session-expiry.txt').write_text(text, encoding='utf-8') print(text) finally: compose('up', '-d', '--no-deps', 'api') wait_instances(2) try: compose('stop', 'db') text = runner('python', 'student-tests/dependency_health.py') (ROOT / 'evidence/dependency-health.txt').write_text(text, encoding='utf-8') print(text) finally: compose('start', 'db') wait_instances(2) if __name__ == '__main__': main()