Add atomic sequential ID reservation#214
Open
iamcxa wants to merge 1 commit into
Open
Conversation
Collaborator
|
thanks! this is a real problem, but I think the approach in the PR is somewhat kludgy. we probably want to have atomic entity creation (eg create with STDIN as body) for assigning id. |
Contributor
Author
|
I think your feedback points to a cleaner shape than the current reservation lifecycle. Proposed pivot for this PR: status --create --slug <slug> --body-file <path|->Semantics:
Two design questions before I rewrite the PR:
I would keep |
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.
Problem
Sequential
status --next-idis a read-only scan. In parallel sessions, two creators can receive the same next numeric ID, draft different entities, and only discover the collision after links, titles, and workflow state already depend on the duplicate.Changes
status --reserve-id --slug <slug>for sequential workflows. It acquires a workflow-local lock, scans current active and archived entities, writes an inlinestatus: reservedstub, commits that stub, and only then prints the reserved ID.--promote-id,--release-id, and--stale-reservations.--next-idas a read-only compatibility path.--reserve-idinstead of delayed manual creation after--next-id.--next-id.Verification
uv run pytest tests/test_status_script.py -k 'reserve_id_concurrent or reserve_id_writes_committed_stub or reserve_id_sees_existing_reserved_stub' -q3 passed, 187 deselecteduv run pytest tests/test_status_script.py -k 'reserve_id or release_reserved_id or promote_reserved_id or stale_reserved_id or archive or set' -q70 passed, 120 deselecteduv run pytest tests/test_status_script.py tests/test_agent_content.py -k 'next_id_read_only_compat or reserve_id_guidance or creation_uses_reserve_id or reserve_id_for_sequential_creation' -q2 passed, 239 deselectedunset CLAUDECODE && uv run pytest tests/test_status_script.py tests/test_status_validate.py tests/test_agent_content.py -q252 passed, 15 subtests passedgit diff --check upstream/main...HEADmake testis not available in this checkout: there is notesttarget.Notes
This keeps reservations in the existing entity namespace rather than introducing a second reservation directory. The reserved stub is repo-visible immediately, so later scans skip the claimed ID.
Entity: #80 upstream atomic sequential ID reservation