Fix stale token winning deduplication race in LevelDB extraction#38
Merged
Fix stale token winning deduplication race in LevelDB extraction#38
Conversation
Changed dedup to first-wins for token values (freshest source) while still allowing team name upgrades from later entries. Sort .ldb files newest-first so fresh tokens are encountered before stale ones.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Summary
.ldbfiles overwrite fresh tokens when the stale entry had a team name but the fresh one didn't. Combined with unsorted.ldbfile ordering, this caused intermittent auth failures after LevelDB compaction.Changes
src/platforms/slack/token-extractor.tsdeduplicateTokens()from last-wins to first-wins for token values. A later entry can only upgradeteamNamefromunknown— the token value from the first (freshest) source is always preserved..ldbfiles by modification time (newest first) so fresh tokens are encountered before stale ones during scanning.statSyncimport for file mtime comparison.src/platforms/slack/token-extractor.test.ts.logtokens take priority over.ldbtokens for the same team.Verified
bun test— 14 pass, 0 fail.bun typecheck— clean.bun lint— clean.Summary by cubic
Fixes a dedup race where stale Slack tokens from old .ldb files could overwrite fresh tokens, causing intermittent auth failures after LevelDB compaction. Fresh tokens now consistently win, with file ordering favoring newest data.
Written for commit 47eae3e. Summary will update on new commits.