Repository navigation
Conversation
Port of BrowserOS trios/agent-server/apps/server/src/api/routes/queen-needs-you.ts at c25e1b0278a6. createQueenNeedsYouRoute and outstandingEscalations keep their names as plumbing; their decisions (database URL fallback and the empty-string 503, Math.round tenths, falsy reason -> null, 400/200-char bounds, summary fields, Boolean(needs_you), count ?? 0) are pure helpers with 7 tests whose values were printed by the original's expressions under node. Negative controls: 3 flipped expectations fail 3; naive floor(y+0.5) rounding fails 1. Closes #5026 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
duplicate-bodies flagged the test helper as a copy of gen_w367.t27's slices_equal. Tests now compare with std.mem.eql; any non-test use is folded into the loop that needed it. Criteria and negative control re-run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
This was referenced Oct 5, 2026
Contributor
PR DashboardGenerated at: 2026-10-05 16:28:54 UTC
Summary
Seal Status
|
This was referenced Oct 5, 2026
Owner
Author
|
Superseded by #6557: the same final spec in a single commit that carries |
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.
Closes #5026
Ports
trios/agent-server/apps/server/src/api/routes/queen-needs-you.ts(gHashTag/BrowserOS @ c25e1b0278a6, fetched from the API and identical to the issue's quote) tospecs/port/browseros/trios/agent-server/apps/server/src/api/routes/queen-needs-you.t27. This one file is the whole change.What is ported
createQueenNeedsYouRoute(Hono, pg pool, logger) andoutstandingEscalations(one count query) are I/O. They keep their names withundefined;bodies that no test calls. Every decision they make is a pure, tested helper:resolve_database_url+url_usable:QUEEN_LEASE_DATABASE_URL ?? DATABASE_URL, thenif (!url)gives 503.??keeps"", which is then refused.hours_waiting:Math.round(Number(age_hours ?? 0) * 10) / 10, implemented as ECMA-262 Math.round (halves toward +Infinity). The naivefloor(y+0.5)gets0.049999999999999996wrong, and a test pins that case.reason_of: a falsy note givesnull, otherwise its first 400 chars.attempts_of:send_backs ?? 0.waiting_ofmaps one row.summarize:waitingCount,oldestHours(row 0, because the SQL orders oldest first) or 0,needsYou.headline_of:String(headline ?? '').slice(0, 200).report_needs_you:Boolean(needs_you).outstanding_from:Number(rows[0]?.n ?? 0).UNAVAILABLE, 503,REASON_MAXandREPORT_LIMITare kept as constants too.Every expected value in the tests was printed by the original's own expressions under node 22.
Acceptance criteria (run on the t27c lab, master t27c @ e7afb32)
Negative controls:
pg://b->pg://a,400->401,6->7) givestests 7, pass 4, FAIL 3, naming exactly those three tests;floor(y + 0.5)givesFAIL 1(hours_waiting_rounds_like_math_round).The tests compare strings with
std.mem.eqland do not copy a local helper (duplicate-bodies).Files:
queen-needs-you.t27(.t27). Nothing generated is committed.🤖 Generated with Claude Code