session-server: keep restart auto-create, but make delete stick#35
Open
DavidBellamy wants to merge 1 commit into
Open
session-server: keep restart auto-create, but make delete stick#35DavidBellamy wants to merge 1 commit into
DavidBellamy wants to merge 1 commit into
Conversation
PR radixark#888 added auto-create-on-missing for router-restart tolerance, but it also resurrected explicitly deleted sessions: a chat or GET for a deleted id silently created a fresh one, so "delete" no longer held. That left four session tests asserting the old "deleted -> 404" contract failing. Tombstone explicitly deleted ids (bounded to the most recent 10k): a deleted id now returns 404 on both the chat and GET paths, while an id the server has never seen still auto-creates, so restart tolerance is preserved. Update test_get_session_not_found -> test_get_unknown_session_returns_empty (asserts the intended empty-200 for a never-seen id) and add test_get_deleted_session_returns_404 for the tombstone behavior.
d8ee8e4 to
f2ebcd4
Compare
|
Looks good! A couple of questions:
|
|
@nightlessbaron I think we should merge this, but want to make sure you saw this on the off-chance that this has implications for the request abort issues you were noticing. |
Collaborator
Author
|
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.
What
PR radixark#888 ("auto-create sessions on first access for restart tolerance") made the session server auto-create a session whenever it gets a request for an id it does not have. That gives useful router-restart tolerance, but it also resurrects explicitly deleted sessions: a chat or GET for a deleted id silently creates a fresh one, so
DELETEno longer holds. It also left several session tests failing, since they assert the old "deleted -> 404" contract.This keeps the restart tolerance but restores delete semantics by tombstoning explicitly deleted ids:
remove_sessionrecords the id in a bounded set (the most recent 10k deletes).get_or_create_sessionand theGET /sessions/{id}route return 404 for a tombstoned (deleted) id, instead of recreating it or returning empty.Tests
test_delete_can_proceed_while_chat_is_mid_proxy,test_chat_during_delete_returns_404,test_chat_after_delete_returns_404,test_rapid_create_chat_delete_cycles) now pass unchanged.test_get_session_not_foundbecomestest_get_unknown_session_returns_empty: asserts the intended empty-200 for a never-seen id.test_get_deleted_session_returns_404for the tombstone behavior.Verified in the miles container: full session suite (
test_sessions.py,test_session_pretokenized_e2e.py,test_session_race_conditions.py) is green (56 passed), with the race file green on a repeat run.