commit 3c33dd747f6804a227d0fb3e7e4edd664c09355b
parent 9f831d0a31c78b4b3af9c22df5e8cb06909cfa64
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 18 Nov 2026 11:03:34 -0500
plans, operating, changelog: x-trending slice 4 as built -- from a trending page to a published topic
OPERATING.md gains the recipe: organise (rename, move, merge), publish in
two steps, what the published channel holds and that nothing fetches it,
publishing again, the three-part proof, and the accounts with Archive this
account. plans/x-trending.md records the rulings, what was built, how the
pins now tell the library from the published channel, what was found on
the way and what is left. editor/CHANGELOG.md, Unreleased.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
3 files changed, 161 insertions(+), 3 deletions(-)
diff --git a/OPERATING.md b/OPERATING.md
@@ -795,6 +795,76 @@ pnpm ops watch-trending --json '{"slug":"trending","topic":"kettle-festival","o
- **A restart.** A tick left queued when the editor stops is cancelled; the scan starts another at its next pass,
jar permitting. `ARCHILYZER_IDLE_BOOT` does not arm the scan at all.
+### From a trending page to a published topic
+
+A library is private until a person publishes one of its topics. The whole path, each step an editor action with its
+`pnpm ops` twin; umtool's **Posts library** (`/tools/library`) is the operator's form of the same actions.
+
+```sh
+pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trending/1900000000000000001","topic":"Kettle festival"}' --wait
+pnpm ops get trending trending --topic kettle-festival
+pnpm ops organise-trending --json '{"slug":"trending","op":"rename","topic":"kettle-festival","title":"Kettle festival 2026"}'
+pnpm ops organise-trending --json '{"slug":"trending","op":"move","to":"kettle-festival","ids":["1900000000000001001"]}'
+pnpm ops organise-trending --json '{"slug":"trending","op":"merge","into":"kettle-festival","from":["teapots"],"by":"operator"}'
+pnpm ops judge-trending --json '{"slug":"trending","by":"operator","set":[{"id":"1900000000000001001","state":"keep"}]}'
+pnpm ops publish-trending --json '{"slug":"trending","topic":"kettle-festival","dryRun":true}'
+pnpm ops publish-trending --json '{"slug":"trending","topic":"kettle-festival","confirm":"<the dry run's confirm>","by":"operator"}'
+pnpm ops get trending trending --accounts
+pnpm ops x-search-lead --json '{"slug":"trending","handle":"example","action":"archive","dryRun":true}'
+```
+
+- **Organise** (`organise-trending`; `"by"` is `agent` unless told, and is recorded).
+ - `rename` changes a topic's name. Its id stays, so its watch, its posts, their judgements and a queued read are
+ untouched. A name another topic answers to is refused.
+ - `move` puts posts (`"ids"`), or every post of one thread (`"thread"`, its root post's id), into the topic `"to"`
+ (an id or a name; `"create": true` makes a topic of that name, with no trending page, when there is none).
+ Judgements and captures are untouched, and a later read never moves a post back. It is safe beside a read or a
+ capture and is not refused for one.
+ - `merge` puts every post, page and read of the `"from"` topics into `"into"`, and they are gone. **There is no
+ unmerge, so a merge is the operator's**: an agent's is refused. It is refused too while a read or a reparse of
+ the library is queued or running (a queued watch tick names its topic). The merged topics' ids keep meaning the
+ topic that stays. Judgements are untouched. **One watch stands**: the target's live watch with its own terms;
+ when the target has none, the first merged topic's moves to it. The answer's sentence says which.
+- **Publish** (`publish-trending`), in two steps, the second the operator's.
+ - `"dryRun": true` writes nothing and says exactly what would be written: `channel` (the slug) and whether it is
+ made (`creates`), the `posts` to add (`ids`), the `files` and `bytes` to copy, `textOnly` (kept posts with no
+ capture yet) and `noLongerKept`. It answers `confirm`. An agent may ask for it.
+ - The publish carries that `confirm` and `"by": "operator"`. If anything it would write changed in between (a
+ post kept or dropped, a capture finished, a post moved) it is refused and nothing is written. Refused while a
+ read, a reparse or a capture of the library is queued or running.
+ - **What is published**: the topic's posts whose judgement in force is keep **by the operator**, their own or
+ their thread's. An agent's keep is a suggestion and is not published; nor is a post marked later, dropped or
+ undecided.
+ - **Where**: an ordinary posts channel. Its slug is a slug of the topic's name unless the first publish names one
+ (`"channel"`); it is fixed after that, so renaming the topic does not fork it. The channel is **on no site**:
+ adding it to one is a separate step (`pnpm ops site-config`, /sites). `social.x.visibility` applies to it as to
+ any X channel.
+ - **What the channel holds**: the posts, their captured screenshots and media, and what X said of them
+ (deleted). Nothing of the library: no judgement, note, read, watch or "gone from the page" mark, and no mention
+ of the library. The files are **copies**: the library keeps its own, a purge of the library does not reach the
+ channel, and deleting the channel does not reach the library.
+ - **Nothing fetches the channel.** It has no account: `fetch-posts`, `capture-posts`, the availability check and
+ an X run refuse it with one sentence, Sync all and an X run's list leave it out, and Configure says what it is.
+ - **Publishing again** adds newly kept posts, and the files of a post whose capture came later. It removes
+ nothing: a post published before and since dropped is listed in `noLongerKept` and stays in the channel. To
+ take a post out, remove it from the channel yourself.
+ - **A channel of that slug that this publish did not make is never added to.** The library records what it
+ published (`trending/published.json`); a channel is this publish's when that record names it, it still has no
+ source of its own, and it holds no post the record does not name. Otherwise the publish is refused: name
+ another slug at a first publish, or remove that channel. A published channel that was deleted is made again
+ by the next publish; one that was renamed is left alone, and the next publish makes a new channel under the
+ recorded slug.
+- **Accounts** (`get trending <slug> --accounts`, the MCP's `x_trending_accounts`): who wrote the library's posts,
+ with posts, kept, topics and the X channels that already archive each. `x-search-lead` with `"action":
+ "archive"` makes `<handle>-x` for an account that wrote a post the library holds: an X channel on no site that
+ names nothing of the library. **From a library it asks X nothing**: the first fetch is started only with
+ `"fetch": true`, or later with `fetch-posts`. After that the channel is an account channel like any other,
+ synced by the scheduler when its interval says so.
+- **In umtool**: a topic's panel has **Rename**, **Merge…** (behind a confirm that says it cannot be undone) and
+ **Publish kept posts…** (the dry run, then **Publish**); the bar has **Move to**; **Accounts** lists the accounts
+ with **Archive this account…**. `umtool library rename | move | merge | publish | accounts | archive` are the same
+ from a shell; `merge` and `publish` want `--by operator`.
+
## Transcribe
```sh
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,21 @@
# Changelog
## [Unreleased]
+- **A trending library's topics can be organised, and a topic published.**
+ - **Rename** a topic, **move** posts between topics, **merge** topics into one: `pnpm ops organise-trending`, and
+ on umtool's Posts library page. A merge cannot be undone, so it is the operator's and asks twice; it waits
+ while a read of the library is queued or running. When both topics are watched, the target's watch stands.
+ - **Publish kept posts…** on a topic, or `pnpm ops publish-trending`: the posts the operator kept become an
+ ordinary posts channel, **on no site**. The first press (a dry run) says exactly what would be written: the
+ slug, posts, files and bytes. The second is the operator's. An agent's keep is not published.
+ - The published channel names nothing of the library: no judgement, note, read or watch. Its files are copies,
+ so purging the library and deleting the channel do not affect each other. Nothing fetches it.
+ - Publishing again adds newly kept posts and removes none: a post since dropped is reported and stays.
+ - **Accounts** of a library (`pnpm ops get trending <slug> --accounts`, the MCP's `x_trending_accounts`, the
+ page's Accounts panel), and **Archive this account…**: `<handle>-x` on no site. From a library it asks X
+ nothing; the first fetch is a separate step.
+ - `umtool library rename | move | merge | publish | accounts | archive` are the same from a shell. `merge` and
+ `publish` want `--by operator`.
- **The Posts library: a trending library is browsed and judged in umtool.**
- **`/tools/library`** in umtool (Tools → posts library): topics on the left with their post, unjudged and new
counts and what each watch is doing; each post drawn as the archive's viewer draws one, with its captured
diff --git a/plans/x-trending.md b/plans/x-trending.md
@@ -220,10 +220,83 @@ again by the watch; keeping the post asks again.
another hand's entry); the bar says so. A bulk press over more than 500 posts whose later chunk fails says
how many were written and returns the undo of those.
-## Slice 4: topics and publishing
+## Slice 4, as built: topics, publishing, accounts (lane `lane/x-trending-publish`)
-Rename, merge, move a post between topics; publish a topic's kept posts into an ordinary posts channel;
-break out a user.
+**Rulings (orchestrator, 18 Nov; the operator may overturn, each is one place in the code).**
+
+1. Rename and move are an agent's or the operator's and record who. **Merge is the operator's**: there is no unmerge.
+2. Two live watches on a merge: the target's stands with its own terms; the sentence says so.
+3. The channel's slug is derived from the topic's title at the first publish (the New channel form's slugify), may be
+ named in the ask, and is then fixed in the library's record.
+4. The published channel carries no mark. "Made by this publish" is the library's record and the channel's content.
+5. A kept post with no capture is published as its words (`textOnly`); a later publish adds its files.
+6. Archiving an account from a library asks X nothing by default (`fetch: false`).
+7. The published posts' availability entries go to the channel.
+8. The published channel makes no request anywhere.
+9. A publish is refused while a read, a reparse or a capture of the library is queued or running.
+
+**As built.**
+
+- **Organise** (`common/lib/xTrending/organise.ts`, `organise-trending`). `store.ts` stays the one writer of
+ `topics.json` and `membership.json` (`mutateXTrendingTopics`, `mutateXTrendingMembership`). A topic gains
+ `aliases` (the ids merged into it; `resolveXTrendingTopic` is the one rule for "which topic an ask names", used
+ by a read, the listing and every organise step) and `organised` (its last rename or merge); a member gains
+ `moved`. A merge writes the membership, the watches, then the topics, inside the topics file's lock, in an order
+ a second run completes. It asks the job registry for a read or a reparse of the library before and inside the
+ lock. A move is safe beside a read (a read never moves a placed post) and is not refused for one.
+- **Publish** (`common/controller/publishXTrending.ts`, `publish-trending`). Two steps held by a digest of the
+ library, the topic, the slug, the exact posts and the exact files; the set is read again inside the media
+ index's lock. Posts are rebuilt from an explicit allowlist: `POST_FIELDS satisfies Record<keyof Post, boolean>`
+ makes a new field of `Post` a compile error until it is decided, and it is not copied until then; `slug` and
+ `channelSlug` are the channel's. A capture is the files its record names and a record rebuilt from an allowlist,
+ without `mediaOwed`, `error` and `threadError`. The channel is made with `createChannel`, the posts written with
+ `writePosts`, the availability with `writePostAvailability`.
+- **Copies, never links.** `copyFile` with `COPYFILE_FICLONE` to a temp name, checked against its source, renamed.
+ The purge frees a blob only when nothing else links to it, so a hardlink into the channel would keep every blob
+ and make the purge's count untrue. Pinned: no published inode is a library inode and each has one name; a purge
+ after a publish frees exactly what it frees without one; deleting either side leaves the other whole.
+- **"Made by this publish"** is `trending/published.json` (`common/lib/xTrending/published.ts`: topic id → slug,
+ times, post ids), written BEFORE the posts, and a three-part proof asked of a channel that exists: the record
+ names the slug; the channel still has the source-less shape; it holds no post the record does not name.
+- **A posts channel with no source** (`common/lib/sourcelessPosts.ts`): an X posts channel with no url, handle,
+ fetcher, search, page or marker. `platform: "twitter"` keeps `social.x.visibility` applying to it. One
+ predicate, asked by `fetchPosts`, `capturePosts`, `checkPostAvailability`, the X run (its list and a direct
+ ask), Sync all's skip reason and Configure; `common/controller/sourcelessPosts.test.ts` pins that no fetcher is
+ called and no binary run.
+- **Accounts** (`common/lib/xTrending/accounts.ts`, `GET /api/ops/trending?accounts=1`, the MCP's
+ `x_trending_accounts`). `planArchiveXLead` takes a library, for an account that wrote a post it holds; the
+ editor's archive action starts no fetch from a library unless asked.
+- **umtool**: `/api/library/{organise,publish,archive}` are the page's only, stamped the operator's
+ (`lib/library/presses.mjs`); `GET /api/library/accounts`; `umtool library rename | move | merge | publish |
+ accounts | archive`. After a merge umtool's Mark seen state follows (`seen.mjs mergeSeen`: the earliest of the
+ merged topics' marks stands; a topic that stays and was never marked stays unmarked).
+- **The pins, as they now distinguish.** The library stays behind every door (the four pins of slices 1 to 3 are
+ unchanged in what they refuse). The published channel is an ordinary channel:
+ `common/controller/publishXTrending.test.ts` pins that it holds exactly the operator's keeps and that no file of
+ it carries the library's slug, a note, a read id, a judgement, a hand, a watch or a gone mark. The MCP's sweep
+ allows the listing key `accounts` and refuses any source naming the organise or publish routes. umtool's sweep
+ names the three new editor asks as the only ways out of a library, the lead action as "archive" only, and that no
+ site is named to the editor from the page.
+
+**Found on the way.**
+
+- A stored library post carries the library's slug in `slug` and `channelSlug`: a copy of the record would have
+ named the library in every published post.
+- A source-less X posts channel did not exist. Configure asked it for an account handle, `fetch-posts` answered "No
+ post fetcher", and an X run listed it. The only other multi-author X channel, an X search channel, is barred from
+ every site; a published topic is the first a site may carry.
+- `common/controller/xTrendingGuards.test.ts` used that source-less shape as its example of an X posts channel; the
+ example now carries an account.
+- umtool's slice-3 e2e line "no button says publish" now says there is exactly one, the topic's.
+
+**Left.**
+
+- A published post is not removed by a later drop (ruled: reported, never deleted). There is no "unpublish".
+- `renameChannel` of a published channel is not followed by the library's record: the next publish makes a new
+ channel under the recorded slug and leaves the renamed one alone.
+- A channel made by "Archive this account" has a URL, so the sync scheduler treats it like any account channel once
+ its interval comes round. The press itself asks X nothing.
+- The library's settings still have no form.
## Open