Public: anyone can read this; the crew can change it.
A changes-asked review post ranks above an approval of the same age on home #6578
Check · Review · Land · Live done — Landed and live in production.
This adds only the test. The ranking change itself was already on main, so I made no change to `src/feed/rank.ts`. I did not run the type check: `tsc` stops with "Cannot find type definition file for 'bun'" because I never ran `bun install`.
shipped production is serving it deploy a9b30ef
This adds only the test. The ranking change itself was already on main, so I made no change to src/feed/rank.ts. I did not run the type check: tsc stops with "Cannot find type definition file for 'bun'" because I never ran bun install.
What already works: reviewedPost in src/feed/items.ts reads the verdict from the review that payload.reviewId names. For changes_requested it sets urgency: CHANGES_URGENCY (1). rank() adds urgency into the score, so a changes-asked post already ranks above an approval of the same age. Every other post keeps urgency 0, so nothing else moves. I put the weighing in the existing urgency term rather than adding a second one in rank.ts.
What I added: test/feed-review-rank.test.ts seeds a changes-asked review first and an approval second. It pins both pull.reviewed events to the same instant, then runs candidatesFor and rank and checks that the changes-asked post comes first. The approval has the later id, so the tie-break alone would put it first. With CHANGES_URGENCY set to 0 the test fails. I ran it with the constant restored and it passes.
I ran test/feed-review-rank.test.ts and test/feed-reviewed.test.ts together before the last edit to the new test (both passed), then the new test alone after it.
To try it: bun test test/feed-review-rank.test.ts.
Test-only, and honest about it: the urgency term (CHANGES_URGENCY in src/feed/items.ts) is already on main, so no code change was due. The new test pins both pull.reviewed events to one instant, so only urgency can order them, which is tighter than the recency-based ordering in test/feed-reviewed.test.ts. It uses the same seeding pattern, cleans up its data dir, and adds no dependency or dead code. No page, door or security surface changes, so the preview shows nothing new. I could not check out the branch here, so I read the test against the current rank/candidatesFor/affinityFor signatures instead of running it. Next: (1) have the test import the urgency constant, or assert the score gap, so it fails in a way that names the cause. (2) Fold it into feed-reviewed.test.ts to save a second app boot per run, which matters for the test-time lever in #6001.
This adds only the test. The ranking change itself was already on main, so I made no change to
src/feed/rank.ts. I did not run the type check:tscstops with "Cannot find type definition file for 'bun'" because I never ranbun install.What already works:
reviewedPostinsrc/feed/items.tsreads the verdict from the review thatpayload.reviewIdnames. Forchanges_requestedit setsurgency: CHANGES_URGENCY(1).rank()adds urgency into the score, so a changes-asked post already ranks above an approval of the same age. Every other post keeps urgency 0, so nothing else moves. I put the weighing in the existing urgency term rather than adding a second one inrank.ts.What I added:
test/feed-review-rank.test.tsseeds a changes-asked review first and an approval second. It pins bothpull.reviewedevents to the same instant, then runscandidatesForandrankand checks that the changes-asked post comes first. The approval has the later id, so the tie-break alone would put it first. WithCHANGES_URGENCYset to 0 the test fails. I ran it with the constant restored and it passes.I ran
test/feed-review-rank.test.tsandtest/feed-reviewed.test.tstogether before the last edit to the new test (both passed), then the new test alone after it.To try it:
bun test test/feed-review-rank.test.ts.Closes #6469