feat: OS-released state lock and recovery of interrupted writes (#41) - #54
Merged
Merged
Conversation
Both workspace state folders now use an advisory lock (File::try_lock) held while open: the kernel releases it on exit or kill, so a crash needs no manual cleanup and a live process is never displaced. A leftover temporary snapshot is kept aside as *.new.recovered-<n>, never loaded or deleted, and the UI reports it. Snapshots sync the file and the directory. Decision and measured latency in ADR 0019. Refs #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUyLMVv9GbqWRByEZ7LgEb
|
Up/Down counted characters while the cursor is placed in display cells, so wide characters (e.g. CJK) moved the cursor to a different visual column. Columns are now measured in cells and never land inside a wide character. Follow-up to the Pullfrog review of the merged PR #53. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUyLMVv9GbqWRByEZ7LgEb
The Ubuntu CI read the snapshot before the Enter was saved and hit an IndexError instead of waiting; the directory fsync added in this PR widened that window. The predicate now waits for a first event. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUyLMVv9GbqWRByEZ7LgEb
A fork by another thread keeps a copy of a just-closed descriptor until its exec, so the flock could still look held right after a store closed. Parallel tests failed 7 of 60 runs with "em uso"; acquisition now retries for up to 500 ms (0 of 60). A process that really holds the lock is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUyLMVv9GbqWRByEZ7LgEb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resumo
Refs #41. Decisão registrada no ADR 0019 (
docs/decisions/0019-state-lock-and-recovery.md).workspace.lockeclaude-native.lockusam agoraFile::try_lock(flockem Unix), mantido enquanto o estado está aberto.kill -9. Um crash não exige mais remover arquivos à mão.*.newremanescente vem de uma gravação que parou antes do rename.*.new.recovered-<n>e nunca é carregado nem apagado.sync_allantes do rename. Depois do rename, o diretório também passa porsync_all. Em macOS, osync_allusaF_FULLFSYNC.src/workspace/private.rs, usado peloClaudeStoree peloStoreda demo.Correção de acompanhamento (
e8a9310): vem da revisão do Pullfrog no #53, já integrado. No editor, ↑/↓ agora preservam a coluna em células de exibição, também com caracteres largos. O teste cobre esse caso.Validação
cargo fmt --all -- --check,cargo clippy --locked --all-targets -- -D warnings,cargo test --lockedecargo build --lockedpassaram localmente em Linux.check_bundle.pytambém passaram.flocknão bloqueante, em vez de exigir que o arquivo tenha sumido.check_claude_hidden_pty.py: fazkill -9da Bee, deixa umclaude-native.newparcial e reabre com--resumesem limpeza manual.cargo test --release -- --ignored --nocapture snapshot_latency, Linux, disco virtual):Limitações
flockse for aberta na mesma pasta.Documentos atualizados:
docs/specs/workspace.md,docs/MANUAL_TESTS.md(item 47), ADR 0018 (referência ao ADR 0019), ADR 0019 edocs/EXECUTION.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01MUyLMVv9GbqWRByEZ7LgEb