-
Notifications
You must be signed in to change notification settings - Fork 10
feat(claims): answer every claim with Agree/Disagree #2541
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
771ace1
feat(claims): answer every claim with Agree/Disagree
jwalkingjew 7869278
fix(claims): stop reading geo-chat's word for the response kind
jwalkingjew d874ffa
fix(debates): name every side from the position, not geo-chat's label
jwalkingjew e816f9f
fix(og): name the share card's speaker sides from the position
jwalkingjew 8978de7
fix(claims): type the wire kind apart, and stop gating the profile tag
jwalkingjew df3898d
chore(claims): drop a type import the switch to ResponseKind left behind
jwalkingjew 0c9aea4
fix(votes): describe an entity by its newest vote row, not its oldest
jwalkingjew de8ee6b
test(claims): cover the two stale-wire guards, and correct their docs
jwalkingjew 2dcd3a8
fix(votes): skip retired rows rather than out-ordering them
jwalkingjew 0616fab
fix(votes): let a page report only the ids it can describe
jwalkingjew b28829d
fix(claims): carry the merged vocabulary into master's new debate sur…
jwalkingjew 3d37ec8
fix(claims): name the scheduled request card's sides from the position
ohohoreilly 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
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
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
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
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
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
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
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
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.
Medium: a claim answered with both vote kinds drops out of the Agreed/Disagreed tab.
This now compares against kind 1 (stance) for every claim, but
voteKindByIdholds the kind of the oldest vote on each entity:getUserEntityVotesByTypebuilds its map withObject.fromEntries(nodes.map(...))over rows orderedVOTED_AT_DESC, so the last (oldest) row wins.use-user-voted-entity-ids.ts(~233-236), later (older) pages overwrite earlier ones too.Scenario: someone clicked Verify on a factual claim before this PR (a kind-2 positive vote, which stays live, since the UI can no longer clear it). After this PR they click Agree on the same claim (a kind-1 positive vote). The by-direction query returns both rows, the older kind 2 wins, this check fails, and the claim disappears from their Agreed tab even though they hold a live stance on it.
Before this PR the claim resolved to kind 2, so it matched and showed. The Verify-then-Agree path is exactly the migration this PR sends every factual-claim responder down.
Suggested fix: when an entity has votes of both kinds, prefer kind 1 (or take the newest row's kind rather than the oldest).
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.
Confirmed and fixed in 16669fe. This is the best find on the PR — a regression we caused, on exactly the path we send every factual-claim responder down.
I verified both halves of the mechanism rather than taking them on trust:
Object.fromEntriesgives a repeated key its last value, rows arriveVOTED_AT_DESC, so the map described each entity by its oldest vote. Anduse-user-voted-entity-idshad the same shape across pages, for an entity whose rows straddle a boundary.I took the "newest row" option rather than "prefer kind 1". Preferring kind 1 special-cases the retired kind and leaves the underlying defect — the map is meant to hold the vote kind for an entity and was holding an arbitrary one. Newest-wins is what every consumer already assumes, and it fixes the migration path as a consequence rather than as a special case.
Two things that came with it:
votedAtByObjectIdhad the identical defect and is built in the same pass now. Read from a different row it can disagree with the kind, and it is the list's sort key — so an entity could sort by one vote and be filtered by another. Worth flagging: this changes the Agreed/Disagreed sort position for a claim holding both kinds. It now sorts by the Agree, which is the vote being displayed. I think that is right, but it is a visible change and I would rather name it than have it turn up.indexVoteRowsByObject, which is also how the repo tends to make this kind of thing assertable.Three tests in
queries.test.ts, on your exact scenario — today's Agree over August's Verify. RestoringObject.fromEntriesmakes the first fail.Swept the class: the only other
Object.fromEntriesover query rows is a static step list with no repeatable keys.