mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-12-01 11:37:48 +08:00
* test: strengthen observable white-box contracts across LangBot Consolidate duplicate probes while preserving distinct behavior, replace structural checks with request and side-effect evidence, and document the developer QA asset map. No production or CI changes. * test(qa): broaden observable assertions across the monorepo * test(qa): stabilize sandbox save and HTTP artifact delivery checks * test(general-parsers): restore async telemetry scope checks
45 lines
2.3 KiB
Python
45 lines
2.3 KiB
Python
"""Challenge lifecycle retrieval oracles and keep the optional suite isolated."""
|
|
|
|
import unittest
|
|
|
|
from tools.entrypoints.regression_ci import SUITE_BUDGETS, suite_profile
|
|
from tools.regression.regression_state import document_absent, document_visible
|
|
from tools.entrypoints.regression_suite import validate
|
|
|
|
|
|
class StateLifecycleTest(unittest.TestCase):
|
|
def test_document_identity_and_content_are_both_required(self):
|
|
document = {'engine_document_id': 'original-file'}
|
|
original = {'metadata': {'file_id': 'original-file'}, 'content': [{'text': 'original-marker'}]}
|
|
self.assertTrue(document_visible([original], document, 'original-marker'))
|
|
self.assertFalse(document_visible([], document, 'original-marker'))
|
|
for changed in (
|
|
{'metadata': {'file_id': 'other-file'}, 'content': original['content']},
|
|
{'metadata': original['metadata'], 'content': [{'text': 'other-marker'}]},
|
|
):
|
|
with self.subTest(changed=changed):
|
|
self.assertFalse(document_visible([changed], document, 'original-marker'))
|
|
self.assertFalse(document_absent([changed], document, 'original-marker'))
|
|
self.assertFalse(document_absent([original], document, 'original-marker'))
|
|
self.assertTrue(document_absent([], document, 'original-marker'))
|
|
|
|
def test_state_profile_does_not_change_smoke_or_daily_cases(self):
|
|
normal_profiles = ('smoke', 'daily')
|
|
before = {name: suite_profile(name, 'test')[0] for name in normal_profiles}
|
|
state, _ = suite_profile('state', 'state')
|
|
validate(state)
|
|
after = {name: suite_profile(name, 'test')[0] for name in normal_profiles}
|
|
self.assertEqual(after, before)
|
|
self.assertEqual([case['name'] for case in state['cases']], ['durable_state_lifecycle'])
|
|
self.assertEqual(state['coverage_suite'], 'state')
|
|
self.assertNotIn('execution', state)
|
|
self.assertNotIn('scenario_groups', state)
|
|
self.assertEqual(SUITE_BUDGETS['state'], 300)
|
|
self.assertTrue(all(not resource.get('documents') for resource in state['resources']))
|
|
for profile in after.values():
|
|
self.assertNotIn('durable_state_lifecycle', {case['name'] for case in profile['cases']})
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|