---
title: "Verify iOS session expiry preserves recoverable work"
description: "Exercise an iOS edit after externally prepared session expiry, verifying a clear sign-in recovery and safe restoration of the intended draft."
canonical_url: "https://vostride.com/agent-library/ios-flows/session-expiry-preserves-safe-draft.md"
md_url: "https://vostride.com/agent-library/ios-flows/session-expiry-preserves-safe-draft.md"
content_kind: "recipe"
topic: "ios-flows"
---

# Verify iOS session expiry preserves recoverable work

Exercise an iOS edit after externally prepared session expiry, verifying a clear sign-in recovery and safe restoration of the intended draft.

## Risk

An expired session can cause a save to appear successful locally while the server rejects it. The recovery should preserve the intended draft for the same user without publishing it or leaking it to another account.

## Fixtures

- A sandbox iOS editor configured with an explicit preserve policy and a test user editing a non-sensitive fixture document.
- An external auth fixture that expires the app session at a named checkpoint without manipulating or exporting native token storage through agent-qa.
- A read-only document oracle recording the original revision and a documented same-user draft recovery behavior.

## Steps

1. Open the fixture document, edit its last paragraph, and verify the unsaved replacement is visible while the stored revision remains unchanged.
2. Confirm the external auth fixture has expired the session, attempt Save, and verify the app requests sign-in instead of declaring a persisted success.
3. Complete sign-in as the same test user and verify the recovered editor contains the replacement paragraph and correct document identifier.
4. Save again and verify the reopened document displays the replacement paragraph with the rest of the document intact.
5. Inspect the independent revision history and verify exactly one accepted content revision, attributable to the test user after reauthentication.

## Expected results

- The expired save creates no accepted revision or misleading permanent success state.
- Same-user recovery restores the intended document and draft text.
- The final history contains a single accepted edit with unchanged surrounding content.

## False-pass traps

- A locally updated preview can look saved while the server remains at the original revision.
- Testing with a still-valid session skips the rejected-save and recovery path.

## Cleanup

- Restore the fixture document revision and retire the externally expired test session.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa mobile testing](/docs/agent-qa/guides/mobile-testing.md)
- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa hooks](/docs/agent-qa/guides/hooks.md)

- [iOS application QA recipes](/agent-library/ios-flows.md)
- [Software factory QA library](/agent-library.md)
