Preserve isolated local drafts across navigation and reload

This commit is contained in:
aiagent
2026-10-19 22:47:17 -07:00
parent 9d69629bc8
commit 6a36a49290
16 changed files with 174 additions and 38 deletions
+22
View File
@@ -240,6 +240,28 @@ class WorkflowHTTPTests(unittest.TestCase):
setUp=fixtures.DecisionHTTPTests.setUp
tearDown=fixtures.DecisionHTTPTests.tearDown
request=fixtures.DecisionHTTPTests.request
def test_old_page_submission_without_revision_is_rejected_before_write(self):
self.request('/api/decisions','POST',definition())
old=answer();old.pop('expected_revision')
self.assertEqual(self.request('/api/decisions/choice/respond','POST',old)[0],400)
self.assertIsNone(self.server.store.decision_get('choice')['response'])
self.assertFalse(any(e['kind']=='submission' for e in self.server.store.decision_history('choice')['history']))
first=self.request('/api/decisions/choice/respond','POST',answer())
retry=self.request('/api/decisions/choice/respond','POST',answer())
self.assertEqual(first,retry)
self.assertEqual(first[0],200)
self.assertEqual(sum(e['kind']=='submission' for e in self.server.store.decision_history('choice')['history']),1)
def test_state_reports_current_page_asset_without_changing_decisions(self):
root=Path(self.tmp.name)/'frontend';root.mkdir()
self.server.web_root=root
(root/'index.html').write_text('<script type="module" crossorigin src="/assets/index-first.js"></script>')
self.assertEqual(self.request('/api/state')[1]['frontend_entrypoint'],'/assets/index-first.js')
(root/'index.html').write_text('<script type="module" src="/assets/index-next.js"></script>')
self.assertEqual(self.request('/api/state')[1]['frontend_entrypoint'],'/assets/index-next.js')
(root/'index.html').unlink()
self.assertIsNone(self.request('/api/state')[1]['frontend_entrypoint'])
def test_limited_credential_route_matrix_and_closed_writes(self):
store=self.server.store
store.decision(definition());bind(store)