Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 9d4267540dcb74cd494eb7d9ee42f29187753e82
parent 9941856cb6a9c6efff6a8d6f75c557e7938c15d5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 20 Oct 2026 19:04:02 -0400

plans: release 38 lane S — the record (x-search.md, as shipped)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Aplans/release-38/x-search.md | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 111 insertions(+), 0 deletions(-)

diff --git a/plans/release-38/x-search.md b/plans/release-38/x-search.md @@ -0,0 +1,111 @@ +# Release 38 lane S `r38/x-search` (an X search channel: a saved query across accounts) — as shipped + +Operator, 2026-10-20: "Are you able to do an X search query to try to find leads from various accounts?" Plan of +record: `plans/release-38/research-cases-and-assist.md` (stage 8, Leads, for X); the lane brief narrowed it to an X +search channel. No model anywhere; every step is a button, an ops action and (the read) an MCP tool. + +## What + +- **The channel kind** (`common/lib/xSearch/config.ts`, a client-safe leaf): `config.xSearch = {query, since?, + until?, windowMonths?, lang?, exclude?}` on an X posts channel (platform `twitter`, `sourceKind: "social"`, + `postFetcher: "x-gallery-dl"`, `url` the search page rebuilt from the query, no `socialHandle`). In the one set + of coercions (`lib/channelConfig.ts`, `channelConfigSchema.ts`), CHANNEL.md regenerated. Query validation passes + X's operators through and refuses an empty, two-line, over-long or open-quoted query and one carrying `since:`, + `until:`, `max_id:` or their kin (outside quotes, any case). A pasted `x.com/search?q=` URL's one `since:`/`until:` + day each are lifted into the channel's dates. +- **Creation**: the New channel form's Platform gains **X search (posts from any account)** (`"x-search"`, not a + platform — the parser maps it to `twitter` + `xSearch`); pasting a search URL selects it. `XSearchFields` (query, + since, until, window months, language; the hidden authors carried in a hidden field). The Sites section says "An + X search channel is never put on a site." instead of the membership picker. `pnpm ops create-channel` takes the + URL, or `platform: "x-search"` with the `xSearch*` fields; channel-config round-trips them. Fetch details on a + search URL answers without a request. +- **Never on a site, at three doors**: `createChannelFromForm` / `updateChannelAction` refuse memberships for a + search channel before writing anything, and `writeSite` (`lib/site.ts`, every site writer) refuses a site whose + members or cited channels include one. Its posts follow `social.x.visibility` unchanged (platform `twitter`). +- **The fetch** (`common/controller/fetchXSearch.ts`, from `fetchPosts`): one walk per run, planned by + `common/lib/xSearch/walk.ts` — a walk in progress, else the first walk (until/tomorrow → since), else the new days + (→ a day below `coveredUntil`), else the earlier days (when `since` moved back), else nothing. The walk is + gallery-dl's search, shared with the older walk: `xGalleryDlFetcher.ts` `walkSearchWindows` (the older walk's + loop, factored out unchanged) under `fetchOlderViaSearch` and the new `fetchSearchViaWindows` + (`SocialFetcher.fetchSearch`). Same windows, 45–120 s between them, 4–10 s per request, `ratelimit=wait`, the + 3-hour budget, mid-window checkpoints at `max_id:`, the same login and guest refusal. A floor walks every window + down to it; no floor ends after 4 empty windows. State: `posts-state.json` `search` (`XSearchWalkState`). `full` + restarts the walk; `older` is refused. The run stamps `lastSyncedAt`, so the scheduler paces it. +- **Leads** (`common/lib/xSearch/leads.ts`, `common/controller/xSearchLeads.ts`): accounts ranked by matching posts + (count, reposts, first/last, a sample, `archivedAs` for an account an X channel archives already), hidden ones apart, + capped (100). **Archive this account** plans `<handle>-x` (refusing an archived account or a taken slug) and creates + it through `createChannelFromForm` — no sites, Fetch posts now. **Never archive** / **Restore**: + `xSearch.exclude`, written through `patchChannelConfig`'s new `derive` option (re-read inside the lock). +- **Channel page**: the posts panel shows the query and a "Search walk" line, **Search again from the top** in place + of Re-fetch full history, no Fetch older posts; `XSearchLeadsPanel` below it (table, actions, the hidden list). +- **Ops / CLI / MCP**: `GET /api/ops/channel/<slug>?leads=1[&limit=N]` (`pnpm ops get channel <slug> --leads + [--limit N]`); `POST /api/ops/x-search-lead {slug, handle, action: archive|never|restore, name?, fetch?, + dryRun?}`; MCP `x_search_leads {channel, limit?}` (`mcp/src/xSearchLeads.ts`, read only, through the editor — the + MCP's X/post tools read published sites, and a search channel is never on one, so the tool rides the editor like + `channel_coverage`). COMMANDS.md regenerated. +- **Capture** works on a search channel's posts (the X capture opens a post by its status id; the handle fallback is + the slug). +- **Tests and fakes**: unit — `lib/xSearch/{config,walk,leads}.test.ts`, `controller/fetchXSearch.test.ts` (a fake + gallery-dl answering search URLs by several authors: windows, operator pass-through, resume, new query, new days, + refusals, per-channel dedupe), `controller/xSearchLeads.test.ts` (ranking, exclude, archive plan, the writeSite + refusal), `editor/app/channels/components/parseChannelForm.test.ts` (+3), `editor/app/api/ops/x-search-lead/ + route.test.ts`. e2e — the editor's fake gallery-dl answers a `/search` URL with four posts by three accounts; + `editor/e2e/x-search.spec.ts` drives the form, the walk, the leads, Never archive / Restore and Archive this + account. +- **Docs**: OPERATING.md "X search", CHANNEL.md, COMMANDS.md, FACTS "Release 38 lane S", CHANGELOG. + +## Commits + +| sha | what | +|---|---| +| `402dac87` | common: config.xSearch, the window walk over any query (the older walk's loop shared), the leads, writeSite's refusal, tests | +| `a0636761` | editor: the form's kind, the Leads panel, Archive this account / Never archive, ops route + channel read, CLI, MCP, e2e | +| `2bb3d741` | the site guard skips a Paths with no channel pool (a scratch test's); the CLI's --leads / x-search-lead pinned | +| `b8860428` | docs: OPERATING "X search", CHANNEL.md + COMMANDS.md regenerated, FACTS, CHANGELOG | +| `ce5d7b7f` | the e2e's archive-button locators exact | +| (next) | this record | + +## Gates + +- tsc, the whole workspace (`pnpm -r --no-bail --workspace-concurrency=1 exec tsc --noEmit`): clean. +- common: 4787 at main (`14947e67`; the branch-start run, under load, had 2 failures that did not recur) → 4815 + (4812 pass, 2 skipped, 1 fail — `siteSchema.test.ts`'s scratch Paths through the new writeSite guard, fixed in + `2bb3d741`, the file re-run 38/38 with `xSearchLeads.test.ts`). +28: config 9, walk 5, leads 4, fetchXSearch 6, + xSearchLeads 4. +- editor unit: 357 at main (r37's record; this branch's start run raced the first edits: 341, 4 files not loading) + → 363/363 (+6: parseChannelForm +3, x-search-lead route +3). +- test:scripts: 1316 (1312 + 4 skipped) → 1317 (1313 + 4 skipped; +1, the ops CLI's --leads / x-search-lead). +- mcp: 379 → 381/381 (+2, x_search_leads). +- docs: `docs files` and `docs cli` regenerated (CHANNEL.md, COMMANDS.md); `docs env --check`, `docs files --check`, + `docs cli --check`, `settings example --check` clean. +- editor build: the e2e's stamped `next build` of the editor, 894 s on a loaded machine, compiled clean. +- e2e (detached, through the locks): `x-search.spec.ts` + `social-channel.spec.ts` — social-channel 6/6; x-search + failed at its last step on a locator ("archive leadone" also matched "never archive leadone"; strict mode), every + earlier step green (form, walk, leads, Never archive, Restore); fixed with exact names; the re-run + `x-search.spec.ts` 1/1 (22.8 s; 33.4 s with the server, the stamped build reused). Wall times were nearly all the + session lock and the machine's heavy slot (40 and 49 minutes). + +## Rulings followed + +- The brief's: an X search channel is a posts channel, on no site, private by `social.x.visibility`; the fetch is the + existing gallery-dl search path with since:/until: windows (the older walk's machinery, newest first, resumable, + same pacing and login); X's operators pass through, since:/until: refused; leads ranked with Archive (on no site, + the create-channel path) and Never archive (`xSearch.exclude`); no model; no real X traffic in any test; no live + fetch run. +- The prelude's: synthetic fixtures only; commits end with the Co-Authored-By line alone; every heavy step through + the lock; no push, no merge into main. + +## Decisions made in the lane + +The lane report lists them; the ones a later reader needs: "X search" is a Platform-select choice, not a platform; +a pasted URL's since:/until: are lifted into the dates, typed ones refused; one walk per fetch, newest stretch +first; with a since every window down to it is searched, without one 4 empty windows end the walk; a new query +starts afresh; cross-channel dedupe stays per channel (leads name the X channel that archives an account); Never +archive hides from the leads and does not rewrite the query; never on a site at create, Configure and writeSite; +`<handle>-x` (or `x<handle>-x`) on no site for Archive this account; the MCP tool is read only, through the editor. + +## Left for later + +- The first live search run (the orchestrator's): the walk has only met the fakes. +- A search channel's login is any X channel's: `social.x.cookieSource`, the channel's own cookiesFromBrowser + (Configure) over the global one; a guest run is refused before spawning.