~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0

A feed tile's check for newer posts sees past a pinned one

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:workspace/newer-past-pins

An author feed opened with includePins now shows newer posts. Before, the pinned post came first in the one-post check and hid them. The check now asks for two posts.

Claude Opus 5.5 · medium

What changes

The call a tile makes to tell whether something newer came asks for 2 items where the method takes an integer limit, kept within the lexicon's minimum and maximum and no more than the tile's own limit (peek_limit). It asked for 1 before. The comparison is the same: something is newer when a key isn't among those drawn. The cap matters because a tile of one item would otherwise check two, and the second, never drawn, would count as newer every time.

Why

review.knotless.dev's note on at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/hud/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2ky2yfxkndl pointed this out. With includePins: true, getAuthorFeed puts the pinned post first. A check asking for one post only ever saw that post, which was drawn, so the tile never said anything was new. Asking for one more sees past it, and it doesn't name Bluesky's parameter in code. A second pinned item isn't possible on Bluesky, so 2 is enough.

How it was checked

  • cargo fmt --check, clippy with warnings denied, hud-core's tests (with a new one for peek_limit: 2 for the AppView's 1 to 100, raised to a higher minimum, lowered to a maximum of 1, 1 for a tile of one item, none without an integer limit), the docs and lexicon harnesses.
  • hud serve against the real AppView, getAuthorFeed for pfrazee.com with includePins: true. The check's call had limit: 2 and answered the pinned post and the newest.

Shortcomings

Each check now reads two items instead of one, which costs a little more.

Asked for changes

The pull makes the newer-posts check ask for 2 items instead of the lexicon's minimum (peek_limit), so a post pinned first (getAuthorFeed with includePins) no longer hides a newer one. It also updates docs/views.md and the place.hud.ui description and adds a test. The clamping to the lexicon's bounds looks right, and so does the reasoning about pins.

Bug: tiles opened with limit: 1 would always say something is newer. The peek ignores the tile's own params.limit. If a tile asked for limit: 1, it draws one item, but the peek now returns two. The second was never drawn, so isNewer (web/shared/result.ts, any peeked key not among the drawn ones) is true every time, even when nothing new came. With the old minimum-of-1 peek this couldn't happen. The fix is to cap the peek at the call's own limit when it has one, e.g. min(peek_limit(..), args.params.limit). For a 1-item tile with a pin that means the old behaviour, which is fine. Please add a test case for it.

crates/hud-core/src/tools.rslines 1902 to 1905Outdated
&& let Some(limit) = peek_limit(&def["parameters"]["properties"]["limit"])
{
args["params"]["limit"] = limit.into();
}
review.knotless.dev

This should also be capped by the tile's own args["params"]["limit"] when it has one. Otherwise a tile opened with limit: 1 draws one item, the peek returns two, and the second one (never drawn) makes isNewer true on every check. Something like let limit = args["params"]["limit"].as_u64().map_or(limit, |own| limit.min(own.max(1))); before writing it.

chadtmiller.com

Fixed in 40bfdfdb5f: peek_limit takes the call's own limit and asks for no more than it, with a test for a tile of one item (1) and one of 30 (2).

Approved

This round fixes what I asked for last time. peek_limit now takes the call's own limit (own) and caps the peek at it, so a tile of one item asks for one and a never-drawn second item can't count as newer every time. latest_ui builds the peek from the tile's own call arguments, so args["params"]["limit"] really is the tile's own limit. The new test covers Some(1) → 1 and Some(30) → 2. docs/views.md and the place.hud.ui description now say the peek is capped too. When the tile sets no limit, the peek asks for 2 within the lexicon's bounds, as before. I found nothing else that needs to change.

Merged as 567e60d