<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Илья Ваганов</title>
    <description>The latest articles on DEV Community by Илья Ваганов (@darkvoice).</description>
    <link>https://dev.to/darkvoice</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4194575%2F6d4d85c0-74b3-44ab-8661-eaf1888e3484.jpg</url>
      <title>DEV Community: Илья Ваганов</title>
      <link>https://dev.to/darkvoice</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darkvoice"/>
    <language>en</language>
    <item>
      <title>Reviewing a two-file Python recovery protocol after a crash or lost acknowledgement</title>
      <dc:creator>Илья Ваганов</dc:creator>
      <pubDate>Mon, 19 Oct 2026 17:16:16 +0000</pubDate>
      <link>https://dev.to/darkvoice/reviewing-a-two-file-python-recovery-protocol-after-a-crash-or-lost-acknowledgement-70p</link>
      <guid>https://dev.to/darkvoice/reviewing-a-two-file-python-recovery-protocol-after-a-crash-or-lost-acknowledgement-70p</guid>
      <description>&lt;p&gt;&lt;strong&gt;AI disclosure — Fully Autonomous:&lt;/strong&gt; this example and this draft were generated primarily by an AI coding&lt;br&gt;
assistant for the repository owner. Validation so far is automated; independent&lt;br&gt;
human review has not yet been received. This is an intentionally small counter&lt;br&gt;
example, not a production persistence library or a complete AI agent.&lt;/p&gt;

&lt;p&gt;The question is about a narrow recovery boundary: a write can become visible even&lt;br&gt;
when its caller never receives an acknowledgement. Retrying by restoring the old&lt;br&gt;
state would then lose a committed update. The example uses only generated integer&lt;br&gt;
events, the Python standard library and disposable test directories.&lt;/p&gt;

&lt;p&gt;Fixed revision:&lt;br&gt;
&lt;a href="https://github.com/DarkVoice087/agent-state-recovery-review/tree/8188f5054d7e8f3fcdefb6995c712dda59b50ec3" rel="noopener noreferrer"&gt;https://github.com/DarkVoice087/agent-state-recovery-review/tree/8188f5054d7e8f3fcdefb6995c712dda59b50ec3&lt;/a&gt;&lt;br&gt;
Implementation:&lt;br&gt;
&lt;a href="https://github.com/DarkVoice087/agent-state-recovery-review/blob/8188f5054d7e8f3fcdefb6995c712dda59b50ec3/state_store.py" rel="noopener noreferrer"&gt;https://github.com/DarkVoice087/agent-state-recovery-review/blob/8188f5054d7e8f3fcdefb6995c712dda59b50ec3/state_store.py&lt;/a&gt;&lt;br&gt;
Tests:&lt;br&gt;
&lt;a href="https://github.com/DarkVoice087/agent-state-recovery-review/blob/8188f5054d7e8f3fcdefb6995c712dda59b50ec3/tests/test_recovery.py" rel="noopener noreferrer"&gt;https://github.com/DarkVoice087/agent-state-recovery-review/blob/8188f5054d7e8f3fcdefb6995c712dda59b50ec3/tests/test_recovery.py&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The protocol is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Replay the journal and validate its checkpoint before preparing a new snapshot.&lt;/li&gt;
&lt;li&gt;Acquire cooperative OS locks in trusted-file then bundle-file order.&lt;/li&gt;
&lt;li&gt;Persist pending(old_hash, new_hash) in a separately configured trusted directory.&lt;/li&gt;
&lt;li&gt;Flush/fsync a temporary bundle and replace the target in the same directory.&lt;/li&gt;
&lt;li&gt;Confirm the new hash in the trusted file.&lt;/li&gt;
&lt;li&gt;On recovery, accept only the authorized old/new bundle. Unknown data keeps the
pending intent open and blocks the next dependent save. Missing trust never
self-authorizes an existing bundle.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The useful review target is a counterexample, rather than a general approval:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can any untested interruption or I/O-error window make recovery accept an
unauthorized bundle, discard a visible committed prefix, or clear an unresolved
intent? Please include the first write and a lost recovery-confirmation ACK.&lt;/li&gt;
&lt;li&gt;Can a stale cooperating writer or the Windows/POSIX lock behavior break the
prefix-extension check? What minimal additional negative test would expose it?&lt;/li&gt;
&lt;li&gt;Are the documented process-crash guarantees too strong on either OS? Which
additional filesystem/OS guarantees would be needed for a power-loss claim?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nine unittest methods pass, including eight actual child-process crash points,&lt;br&gt;
an independent 200-event prefix check, corrupt/rolled-back state, unknown data,&lt;br&gt;
missing trust, lost acknowledgements, I/O failures and another process's lock.&lt;br&gt;
CI passed on Windows/Ubuntu with Python 3.12/3.13:&lt;br&gt;
&lt;a href="https://github.com/DarkVoice087/agent-state-recovery-review/actions/runs/39203969671" rel="noopener noreferrer"&gt;https://github.com/DarkVoice087/agent-state-recovery-review/actions/runs/39203969671&lt;/a&gt;&lt;br&gt;
Run: python -B -m unittest discover -v&lt;/p&gt;

&lt;p&gt;Known limits: no power-loss certification, Windows directory fsync, ACL installer,&lt;br&gt;
adversarial path-race certification, protection against an administrator rolling&lt;br&gt;
back both files, multi-host coordination or exactly-once external side effects.&lt;br&gt;
This is not evidence that custom JSON storage is preferable to SQLite; database&lt;br&gt;
transactions and a separately protected rollback anchor solve different concerns.&lt;br&gt;
The repository is public for review; a reuse license has not been selected.&lt;/p&gt;

&lt;p&gt;Please reply with the fixed revision, OS/Python/filesystem if relevant, the failure&lt;br&gt;
sequence, expected versus observed state, and a minimal synthetic reproduction or&lt;br&gt;
test. The repository's review issue template can also be used:&lt;br&gt;
&lt;a href="https://github.com/DarkVoice087/agent-state-recovery-review/issues/new/choose" rel="noopener noreferrer"&gt;https://github.com/DarkVoice087/agent-state-recovery-review/issues/new/choose&lt;/a&gt;&lt;br&gt;
Synthetic inputs only; please do not attach production state or credentials.&lt;/p&gt;

</description>
      <category>python</category>
      <category>testing</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
