-
Notifications
You must be signed in to change notification settings - Fork 0
fix(audit): bind history to query and credential lifetimes #3345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Chris0Jeky
wants to merge
11
commits into
main
Choose a base branch
from
audit/3344-audit-read-ownership
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+473
−47
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5fc20fa
test(audit): reproduce stale history ownership races
Chris0Jeky d727e05
fix(audit): bind history to query and credential lifetimes
Chris0Jeky 555d7f0
test(audit): preserve loaded history across token refresh
Chris0Jeky 3f5044d
fix(audit): preserve history across token refresh
Chris0Jeky 01604a5
docs(audit): distinguish refresh invalidation from identity reset
Chris0Jeky 4a4d6b8
test(audit): retry empty initial history after token refresh
Chris0Jeky 1494d1c
fix(audit): retry empty active history after token refresh
Chris0Jeky 9a32510
docs(audit): record empty-read retry contract
Chris0Jeky f1b55ff
fix(audit): join token-refresh history retries
Chris0Jeky 1e291cc
fix(audit): let token refresh successors settle reads
Chris0Jeky 4783c8a
fix(audit): settle superseded read owners
Chris0Jeky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Activity history request ownership | ||
|
|
||
| Status: corrective draft for #3344 / PR #3345. Base: `307c3b8b50bec1cb0bfaea3e570a942bcb1d4451`. | ||
|
|
||
| ## Reproduced defects | ||
|
|
||
| Board, entity and user history requests replace one `auditStore.entries` surface. The original store allowed every response, failure, toast and `finally` to commit, so route changes could restore older queries, report obsolete failures or clear current loading. | ||
|
|
||
| The first lifecycle correction treated token refresh as full identity reset and cleared loaded history. The preservation correction then exposed a second boundary: an empty initial history read was retired during refresh and the unchanged route did not refetch. | ||
|
|
||
| ## Contract | ||
|
|
||
| - One current request owner exists across board, entity and user query kinds. | ||
| - A newer query retires the previous owner's permission to commit UI state. | ||
| - User identity, authentication or demo-session replacement advances the epoch, retires work and clears history. | ||
| - Token-only rotation preserves settled history, suppresses old-token UI settlement and restarts the active query only while history is still empty. | ||
| - The retry retains the exact board/entity/user parameters and limit captured by the active query. | ||
| - Stale work still resolves or rejects to its original caller, but cannot write entries, error, toast, loading or final state. | ||
| - A current failure retains the previous result list and preserves the public error/toast/rejection behavior. | ||
| - Limit clamping, endpoints, route behavior, demo behavior and the public store API remain unchanged. | ||
|
|
||
| The three request bodies use one private helper so ownership and failure rules cannot drift. This is client-state integrity, not transport cancellation or a server authorization claim. | ||
|
|
||
| ## Test-first evidence | ||
|
|
||
| Initial test-only head `3980e1e3e234a251cd89cad270b8d0ab86c3e5f2` produced five intended ownership failures against unchanged `main`. | ||
|
|
||
| Review-regression head `93c20b679888394200354d80040e7f3c7dd5c353` ran the canonical Node 24 frontend suite on Ubuntu and Windows. Lint, typecheck, production build and PWA validation passed on both platforms. Ubuntu JUnit recorded **7,156 tests, exactly 2 failures, 0 errors**, both loaded-history preservation cases. | ||
|
|
||
| Issue #3352 added test-only head `85cf369ddd11dfe0a91052eb1523efbddf904a7c`, covering token rotation during an empty initial board-history read. A dependency-free runner transpiled and executed the actual production module: | ||
|
|
||
| - before the retry correction: the API was called once and loading became false after rotation; | ||
| - after the correction: the API was called twice, old-token settlement was suppressed and the fresh-token result populated history. | ||
|
|
||
| Hosted exact-head qualification remains authoritative; the supplemental runner does not replace it. | ||
|
|
||
| ## Remaining gates | ||
|
|
||
| Current production correction: `110edf3029450dc261b4feee30d6c78dd6e00405` before this documentation commit. | ||
|
|
||
| Exact final-head lint, typecheck, production build, complete Vitest on Ubuntu and Windows, Required CI, Extended, Self-Test and fresh-context review remain required. Review should focus on exact query capture, no retry after route clear and no retry loops. | ||
|
|
||
| No merge, release or deployment qualification is claimed. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When query B starts while query A is still pending, this assignment discards the only reference capable of resolving A's
successorReady. If a token rotation or session reset then advancescredentialEpoch, only B is signalled; when A's transport later settles, A entersawaitSuccessor()and waits forever on its unresolved promise. Thus the public action for A never resolves or rejects in this overlap-plus-credential-change scenario, contrary to the documented stale-work contract; retire the previous owner when replacing it or retain all owners that may need signalling.Useful? React with 👍 / 👎.