agora.fleet.runtime_postconditions
Postcondition factories that execute subprocesses to catch runtime bugs.
These sit alongside the static postcondition helpers in the project runner
scripts. Each factory returns a Predicate so it
plugs into Specification.postconditions unchanged.
The checks all expect the ctx dict to carry work_dir. That matches the
contract the runner populates for every other postcondition.
Functions
|
|
Catch module-scope statements placed after |
|
|
|
|
The module at |
Every |
|
|
Every non-blank non-comment line of |
- agora.fleet.runtime_postconditions.postcond_bot_calls_tree_sync(rel='bot.py')[source]
bot.pymust referencetree.syncsomewhere.This is a cheap string match rather than an AST probe: slash commands that are never sync’d to Discord never appear to the client, so the bot looks connected but does nothing. Catching it before the run ships saves a full end-to-end manual test.
- agora.fleet.runtime_postconditions.postcond_no_code_after_main_block(rel)[source]
Catch module-scope statements placed after
if __name__ == '__main__':.Run 13 shipped a bug where
build_roll’s handler landed AFTER thebot.run(TOKEN)line — tests (which import with non-__main____name__) saw /roll registered; production (which hits the __main__ block and blocks inbot.run) never registered it.Detected via AST: find the module-scope
if __name__ == '__main__':node and flag every subsequent top-level statement as unreachable at runtime.
- agora.fleet.runtime_postconditions.postcond_pytest_passes(rel='.', *, timeout=60.0)[source]
pytest relmust exit 0 inside work_dir.
- agora.fleet.runtime_postconditions.postcond_python_imports(rel, *, timeout=15.0)[source]
The module at
relmust import without raising.
- agora.fleet.runtime_postconditions.postcond_readme_only_references_existing_commands(readme='README.md', bot='bot.py')[source]
Every
/xxxcommand mentioned in the README must exist inbot.py.Catches the LLM hallucinating features it didn’t read about (the run-2 README advertised a
/helpcommand nobody ever wrote).