Skip to content

feat(cli): pin and unpin conversations and workspaces; harden a catalogue-lane wait; bump skills - #1625

Merged
huichen merged 6 commits into
mainfrom
pr/huichen
Nov 15, 2026
Merged

huichen merged 6 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

What

dev-huichen brings the desktop app's pinned section to the terminal, hardens the host catalogue-lane test that flaked on Windows, and bumps the skills submodule to the revision that documents pinning.

Commits

  • feat(cli): pin and unpin conversations and workspaces from the terminal — adds future session pin|unpin <session-id>, future session pinned, future workspace pin|unpin <path|id|name> and future workspace list --pinned. The writes go through store::pin_thread / store::pin_workspace, the same calls the app and the remote bridge use, so the catalogue-dirty signal that makes the sidebar and a paired phone re-read is not bypassed. pinned stays an ordering flag rather than activity: neither updated_at nor last_opened_at is rewritten. Archiving still clears a pin, and a pin that the pinned section hides (archived row, or a row inside an archived workspace) is stored with a note naming the restore command. Reads use open_existing, so a machine that never ran the app reports count: 0 instead of creating app.db. archive.rs's shared helpers become pub(super) and its test harness moves to test_store instead of being duplicated.
  • test(host): name the packet a catalogue-lane wait is waiting for — FakeNats::await_publish now reads the broker record and is keyed by what the caller awaits instead of taking the next packet on the subject, so the window and delta lane tests no longer consume a stale duplicate packet (the Windows failure in run 43502377622) or lose a change-driven one to the 256-slot ring under a 100/s heartbeat. A wait that times out now names the newest packet on the subject.
  • chore(skills): bump future-skills to document pinning (#125) — submodule pointer only (b0128a51 → 9a664399).

Verification

Pinned toolchain 1.99.1 (Homebrew 1.96.0 shadowed off PATH), ulimit -n 8192, run in the main checkout at a0175e0d3 with a clean tracked tree:

  • cargo fmt --all -- --check → clean
  • cargo check -p future-cli -p future-host --all-targets → clean (29s)
  • cargo clippy -p future-cli -p future-host --all-targets -- -D warnings → clean (25s)
  • cargo test -p future-host --lib → 2261 passed, 0 failed, 15 ignored (444s)
  • cargo test -p future-cli --lib → 1630 passed, 0 failed (79s)
  • make check-docs → 421 docs OK, 0 pairs pending, provider matrix 13 rows

User-visible changes

  • New terminal commands for the app's pinned section: future session pin|unpin|pinned and future workspace pin|unpin, plus future workspace list --pinned. Before: the pinned section existed only in the desktop app, and a terminal user could neither inspect nor change it. After: both scopes can be pinned, unpinned and listed, with --json / --format toon output, and the app and a paired phone pick the change up on their next read. Revert 42a02d4d5.
  • Archiving still clears a pin, so unpin is not the inverse of archive; a pin on an archived row or inside an archived workspace is stored but hidden, and the command prints the note naming the restore command. No new default, setting, migration or wire field: the commands read and write the existing threads.pinned / workspaces.pinned columns and never create app.db on a read.
  • The host commit is test-only; the skills commit is a submodule pointer.

The desktop app's pinned section had no CLI: `future session list` is a gRPC
call to the Agent, which has no notion of a pin, and nothing read the flag the
app stores on `threads.pinned` / `workspaces.pinned`. So a user could see the
section in the app and had no way to inspect or change it from a terminal.

Adds both scopes, both directions, and both listings:

  future session pin|unpin <session-id>
  future session pinned [--json|--format toon]
  future workspace pin|unpin <path|id|name>
  future workspace list --pinned [--json]

The writes go through `store::pin_thread` / `store::pin_workspace` — the same
calls the app and the remote bridge use — so the catalogue-dirty signal that
tells the app and a paired phone to re-read is not bypassed, and `pinned` stays
an ordering flag rather than becoming an activity event: neither `updated_at`
nor `last_opened_at` is rewritten, which a test asserts at both scopes. The
readings use the store's own queries (`list_pinned_threads` with the app's
`Recent` scope, `list_pinned_workspaces`), so the terminal, the sidebar and the
phone cannot disagree about what is pinned or in which order.

Two consequences of the app's existing rules are reported rather than left to be
discovered: archiving clears the pin (a pinned row on the shelf would hide
behind it), so `unpin` is not the inverse of `archive`; and a pin on an archived
row, or on a row inside an archived workspace, is stored while the section keeps
it out of sight — the note names whichever restore command applies, read from
the row and its workspace. Both are easy to get wrong: the first draft printed
that note on a successful *unpin* of a live row, and inferred the cause instead
of reading it, which only showed up against the real store.

Reads never create the app database (`open_existing` first), so a machine that
never ran the app gets `count: 0` and an empty-state line, or `[]` under
`--json` — not an error, and not a new file. A store `workspace add` created
without a `threads` table lists nothing rather than failing on the missing
table.

The archive module's shared helpers (`parse_target`, `desktop_store`,
`resolve_workspace`, `with_flag`, `pretty`) are now `pub(super)` and its test
harness moved to `test_store`, rather than duplicating either in the new module.
`catalogue_window_lane_sends_the_newest_rows_and_names_the_rest` failed on
Windows (run 43502377622) at

    assertion `left == right` failed: a deleted conversation is named, not
    left to be inferred
      left: Array []
     right: Array [String("sesswindowborn-7856-764")]

The wait had been satisfied — by the wrong packet. It was
`await_publish(&mut tap, &subject, ..)`, which answers with *the next packet on
the subject*: the lane publishes one packet per change, so a second packet on
`p.{pair}.state.sessions` describing the state *before* the deletion (the same
change detected twice, a restarted loop's resync, a second publisher
generation) is taken as the answer, and `removed` reads `[]`. The tap is also a
256-slot ring over a 100/s heartbeat, so the same wait loses a change-driven
packet outright when the reader is descheduled — the reason the bridge test
already reads the broker record instead (#1606).

Both waits now do that: `FakeNats::await_publish` reads the record (nothing is
dropped, and a packet published before the wait began is still found) and is
keyed by `accepts` — the packet that *says* what the caller awaits — not by the
next arrival. The window and delta lane tests ask for `full: true`, for the
packet naming the row that was born, and for the one naming the removal.

The window test also publishes the shift packet once more before deleting: that
one repeated packet is the flake's timing, made deterministic. With the old
wait it is taken and the test fails with the output above, byte for byte; with
the condition-keyed wait it is skipped and the test is green. A wait that times
out now names the newest packet on the subject instead of only the budget.

host: cargo test -p future-host --lib remote → 715 passed, 0 failed
      (the window test 5x, the delta lane 1x, the four await_publish tests)
@huichen
huichen enabled auto-merge (squash) November 15, 2026 21:28
@huichen
huichen merged commit 8192e0f into main Nov 15, 2026
21 checks passed
@huichen
huichen deleted the pr/huichen branch November 15, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant