main
306
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ea01713377 |
feat(core): the tools manifest, and a predicate that says why a re-sync is owed
CODE-HEALTH-SPEC §2 gives the tools directory a manifest.json holding "installed pin set
+ hash; mismatch with shipped pins => re-sync". This is that, plus the check that decides.
`needs_sync` compares the hash *and* looks for the files. A hash comparison alone reports
Fresh for a venv whose ruff.exe an antivirus quarantined — which is exactly the case
PD-HLT-001's shipped copy is about ("Re-sync the tools environment"), so the one state the
code already promises to detect would have been the one it could not see.
`a_quarantined_tool_is_detected_even_though_the_hash_still_matches` holds that.
SyncNeed is an enum, not a bool, for the same reason: doctor and P4's screen have to say
why, and PinsChanged carries both hashes so a Dependabot bump is legible rather than just
"something moved".
ToolsManifest is on-disk only and deliberately not in SCHEMA_TYPES — P2 has no IPC
surface, and a type that crosses the bridge is a contract that has to be kept. Its fields
already serialize camelCase so the rename that would need snapshot::Meta's #[serde(alias)]
treatment never has to happen; a test pins that spelling now.
Absent, unreadable and corrupt manifests all read as NeverSynced. They mean the same thing
to every caller, and distinguishing them would offer the user a choice they cannot act on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
3ff1d58830 |
feat(core): the shipped pin ledger, parsed once and hashed by meaning
CODE-HEALTH-SPEC §2 says the tools venv is built from exact pins shipped with the app. `tools/tools-requirements.txt` has existed since the first scaffold commit and is already Dependabot-wired at /tools; nothing read it. This reads it. Two things are deliberate and easy to get wrong later. The ledger carries four pins and Code Health installs three. `pip-audit` belongs to the post-1.0 Security tab (PRD P1-1), so installing it would make every user's first Health click download a feature they cannot reach — and its closure contains `msgpack`, which publishes no `py3-none-any` fallback and would hard-fail under `--only-binary=:all:` on a new CPython. It stays in the ledger so Dependabot keeps bumping it. `pins()` fails the suite if any HEALTH_TOOLS name stops resolving, so a rename is a cargo test failure rather than a PD-HLT-001 on a user's machine. The hash is over the parsed pin set, never over the file's bytes. `include_str!` bakes in the build machine's working tree and `.gitattributes`' `* text=auto` makes that core.autocrlf-dependent, so a byte hash would differ between two builds of the same commit and every user of one of them would re-sync on first run — a bug that passes every test. `line_endings_do_not_change_the_hash` is that trap turned into a gate. Also settles the M3 "top unknown": there is no TOOLS_PYTHON_MAX. deptry ships cp310-abi3 and the same wheel installs on 3.12 and 3.14, verified by running both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
4f15936f5a |
build(deps): bump nanoid to 3.3.18 to clear GHSA-2v37-7h3g-55p8
`main` is red on `npm audit`. The advisory is `nanoid <3.3.17`, reached through `vite → postcss → nanoid`, and it was published after the last Dependabot run — so #19's green `npm audit` was a stale check, and bumping vite 8.1.5 → 8.2.0 did not move it: 8.2.0 still resolves `postcss@8.5.23` and `nanoid@3.3.16`. Lockfile only, three lines, transitive: 3.3.16 → 3.3.18. `package.json` is untouched, so this is not a dependency decision — it is the same bump `npm audit fix` performs, taken now because the branch it was blocking is already on `main` and SECURITY §7 does not relax `npm audit`. Verified after a clean `npm ci`: 0 vulnerabilities, 96 tests, typecheck and build all pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
4710841caa |
build(deps-dev): Bump the npm-minor-patch group across 1 directory with 5 updates
Bumps the npm-minor-patch group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `19.2.17` | `19.2.18` | | [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) | `19.2.3` | `19.2.4` | | [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) | `6.0.4` | `6.0.5` | | [jsdom](https://github.com/jsdom/jsdom) | `30.0.0` | `30.0.1` | | [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `8.1.5` | `8.2.0` | Updates `@types/react` from 19.2.17 to 19.2.18 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) Updates `@types/react-dom` from 19.2.3 to 19.2.4 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom) Updates `@vitejs/plugin-react` from 6.0.4 to 6.0.5 - [Release notes](https://github.com/vitejs/vite-plugin-react/releases) - [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite-plugin-react/commits/plugin-react@6.0.5/packages/plugin-react) Updates `jsdom` from 30.0.0 to 30.0.1 - [Release notes](https://github.com/jsdom/jsdom/releases) - [Commits](https://github.com/jsdom/jsdom/compare/v30.0.0...v30.0.1) Updates `vite` from 8.1.5 to 8.2.0 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/create-vite@8.2.0/packages/vite) --- updated-dependencies: - dependency-name: "@types/react" dependency-version: 19.2.18 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-patch - dependency-name: "@types/react-dom" dependency-version: 19.2.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-patch - dependency-name: "@vitejs/plugin-react" dependency-version: 6.0.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-patch - dependency-name: jsdom dependency-version: 30.0.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-patch - dependency-name: vite dependency-version: 8.2.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-patch ... Signed-off-by: dependabot[bot] <support@github.com> |
||
|
|
14abe8f5ba |
docs: S7 is done, and M2 with it
The stage record said four items were open; they are not. `engine_info`, the `COMMANDS` drift gate, focus-follows-tab and Search's empty state all landed, so ROADMAP records what shipped rather than what was owed an hour ago. Two things are still deliberately out, and named: the `Enter` primary-action map and folding six `aria-live` regions into one. Both are cross-screen behaviour whose correctness is a screen reader and the VI sweep, not a passing test — landing them blind would be the kind of green suite this repo has learned to distrust. M2 closes here. Every P0 feature except Code Health is in both heads, all seven UI-SPEC click budgets are met by hand count, and `NOT_YET` names the five commands that remain against the slice that owes each. Where to pick up now points at Phase 3, with the two decisions worth not re-deriving and the ten-minute check that retires M3's biggest unknown before any of it is written. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
ccee3151a7 |
feat(app): engine_info, COMMANDS stops being a lie, and focus follows the tab
S7's four remaining items, together.
**`COMMANDS` was never checked against anything.** It is the array the frontend
types its wrappers against, and nothing tied it to what Tauri actually registers
— so for four stages it listed 32 names while 19 were registered, and a wrapper
for any of the other 13 typechecked, shipped, and would have failed at runtime in
front of a user, on a command that looked implemented. Three tests close it, all
reading the source rather than a duplicate list: `generate_handler!` is a macro,
so there is no runtime list to inspect and a hand-maintained copy would be one
more thing to forget. `NOT_YET` is the honest half — five declared-and-owed
commands, each naming the slice that owes it — and a third test fails if an entry
there already exists, so a stale note cannot outlive the work.
**`engine_info`** returns both engines, because Settings shows a version beside
each radio and asking about the configured one leaves the other blank until it is
picked. It takes a `PyEnv` since `Engine::info` does in the trait and both
adapters — pip's version comes from `<python> -m pip --version`, so there is no
env-free answer. `EngineInfo` pays the full wire cost: membership in
`SCHEMA_TYPES`, not the `JsonSchema` derive, is what puts a type in
`generated.ts`, and it was in neither. Goldens 54 → 55.
**Focus follows the tab.** `Ctrl+3` changed the screen and left focus on whatever
was last clicked, so the next Tab resumed inside the screen the user had just
left and a screen reader announced nothing. It now moves to the new screen's
heading; `key={nav}` on `<main>` is what makes the effect fire on every change
rather than only the first.
**Search's idle empty state.** It rendered a bare empty list before anything was
typed — the first thing a user sees on that screen, saying nothing. UI-SPEC §7's
glyph, sentence and hint, and the hint is the one worth having: results come from
the local index, so it works offline.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
33bc2f967e |
docs: record Stage 7, and the four items it leaves open
UI-SPEC §3 gains a definition for `⚠ n`, which its own layout diagram has drawn
since the spec was written and which nothing specified. It counts error rows
currently on screen, not a session tally — the tally reads `⚠ 47` after a batch
where 47 packages failed, stays there, and tells the user nothing the summary in
front of them does not. Flagged as invention, because it is one.
ERROR-CATALOG §4 records that the URL is built once in core and called by both
heads, and that the ring is fed from three places rather than one: a resolve
emits no progress events at all, and a plan that would not resolve is the
commonest thing anyone reports.
I18N §1 is amended rather than left describing seven namespaces the app never
had. i18next's `nsSeparator` is `:`, so a real second namespace means
`t('errors:PD-NET-001')` at every call site — churn across every screen, bought
with lazy loading a bundled desktop app cannot use. One namespace, two files per
locale, and the error codes keep their own file because they are the only keys
whose names are a contract with Rust.
ROADMAP records S7 as **substantially done with four items open**, named rather
than quietly dropped: `engine_info`, the `COMMANDS` drift gate, the `Enter` map
with focus-follows-tab and one live region, and `PdEmptyState` on three surfaces.
Phase 3's first slice needs `engine_info`, so that one is owed either way.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
545394619e |
feat(ui): the log toggle works, and ⚠ n finally means something
UI-SPEC §3's layout has drawn both since the spec was written. The log toggle was plain text — a control that looks like one and does nothing — and `⚠ n` was never defined anywhere, in the spec or in the code. The toggle opens the console drawer, which is the only log surface that exists until M3's logging subsystem, and is disabled when there is no run to show rather than opening an empty drawer. `⚠ n` is **error rows currently on screen**, registered by `PdErrorRow` while it is mounted. A session tally was the obvious alternative and is the wrong one: it would read `⚠ 47` after a batch where 47 packages failed, stay there, and tell the user nothing they cannot already see. This returns to zero when the problems do, so the number and the screen agree. `PdSummarySheet`'s per-package rows opt out — one failed run is one problem, not forty-seven. The definition is an invention; UI-SPEC §3 says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
fbc93e32fa |
feat(ui): high-contrast fallbacks, and a pseudo-locale that does not ship
UI-SPEC §8 says "tokens fall back to system colors" and the stylesheet set two
properties on `body`. Forced-colors does not *ignore* a palette — it overrides
the properties it knows about and leaves the rest, so every token still resolved
and still lost. Every `--color-*` is now rebound to a system keyword, which is
what makes the whole app follow rather than the handful of properties the UA
happens to force.
Two cases the UA cannot rescue on its own. **A tinted background carries meaning
here**: `bg-danger/20` is what distinguishes *Force latest* and *Remove anyway*
from Cancel, and it is erased — leaving a destructive button that looks like the
safe one. They get a border, which survives. **Selection is a background too**,
so a selected row flattens into every other row; an outline survives.
`--color-warn` and `--color-danger` both become `CanvasText` rather than
pretending to a distinction the mode does not have — the copy already says which
is which.
The pseudo-locale is I18N §5's clipping check. It appends rather than
substituting: `{{count}}` placeholders survive untouched, so nothing fails for a
reason unrelated to layout, and the string stays readable so a clipped button is
still identifiable. The closing `⟧` is the tell — if it is missing, the container
clipped.
Dev-only and not a supported locale: Settings never offers it, `resolveLocale`
never returns it, and the parity test never compares against it. Verified by
grepping a production build for it — zero occurrences.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
9e26bee186 |
fix(cli): drop the doc comment urlencode left behind
`urlencode` moved to `pipdock_core::report` with the URL builder; its doc comment did not, and an empty line after a doc comment is a clippy warning — which CI runs as `-D warnings`, so it would have failed there rather than here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
a3f92d1aea |
feat(ui): the error row ERROR-CATALOG §3 specifies
The row was `code · one-liner · Details`. §3 asks for `· [Copy full log] · [Report bug]` as well, and both keys have sat unused in the catalogs since S1. Both read one `report_bug_url` call, which returns both halves. *Report bug* opens the prefilled issue; *Copy full log* puts the complete buffer on the clipboard — the truncation in the URL is only acceptable because the whole thing is available beside it. Neither sends anything, and the row says so rather than leaving the user to guess what a button labelled "Report bug" does. They render only when there is a log to offer. A *Copy full log* that copies nothing is worse than no button: it reports success over an empty clipboard. A failure while fetching the link costs the two buttons and nothing else — an error row that raised an error while offering to report an error is not worth a second error row. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
1b391140a8 |
feat(core): the bug-report URL, built once and shared by both heads
ERROR-CATALOG §4 is the entire telemetry story: a prefilled issue URL the user reviews and submits themselves. `pipdock self report-bug` built one and the GUI needed another — two builders that agree until the day the template gains a field, and the CLI's is the one nobody would notice had drifted. It moves to `pipdock_core::report`, which both now call. `BUG_REPORT_EXCERPT_CHARS` finally has a reader. §4.3's budget is on the *URL*, so the excerpt is tail-biased — a failing install's last twenty lines are the traceback and its first hundred are the resolver listing downloads — and cut at a line boundary so it does not open mid-token and read as corruption. By `char`, not by byte: slicing a String by bytes panics on the first Vietnamese path, which is a test rather than a hypothetical. `LogRing` in `AppState` is what fills it, fed by **three** writers rather than one. The obvious tap is `plan_execute`'s progress forwarder, but the commonest thing anyone reports is a plan that would not resolve — and a resolve emits no progress events at all. So `plan_resolve` also pushes the engine's own output on success and the stderr tail on failure, which is exactly the case worth filing. The three forwarders collapse into one `forward_progress`, which tees into the ring on the way past. `report_bug_url` returns the URL *and* the full log, because §4.3 splits them: GitHub takes the truncated one, the clipboard takes all of it. It parses the code string back through `Code::ALL` rather than trusting what the frontend hands back — an unrecognised code is left off instead of pasted into a public URL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
46c1936650 |
feat(i18n): a one-liner for every catalog code, in both locales
**26 of the 32 codes had no copy at all.** A PEP 668 refusal, an MSVC-missing
build failure and a full disk all rendered as "An unexpected error occurred."
with a code beside them — and silently, because `PdErrorRow` falls back
deliberately rather than leaking `PdError.message`, which is English developer
text. Nothing failed; the app simply had nothing to say about five sixths of what
can go wrong.
The codes move to `locales/{en,vi}/errors.json`, merged into the single `common`
namespace at init. I18N §1 named seven namespaces; the app ships one, because a
real second namespace means `t('errors:PD-NET-001')` at every call site —
i18next's `nsSeparator` is `:` — bought with lazy loading a desktop app that
bundles both catalogs cannot use. The error codes still earn their own *file*:
there are 32, they are the only keys whose names are a contract with Rust rather
than with a screen, and keeping them reviewable is worth one import. §1 is
amended to say so rather than left describing something that was never built.
`i18n.test.ts` now checks them against `codes.json`, generated from `Code::ALL`.
A hand-written list in TypeScript would drift the moment a code was added and go
on passing over an incomplete catalog. It asserts both directions — no code
without copy, no copy without a code — and the ≤ 90-char cap I18N §4 states,
which was aspiration until now. Verified by breaking the catalog deliberately:
both directions fail, then pass again once restored.
Adding a code is now an eight-place change, and CLAUDE.md says which eight.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
907a653cc5 |
chore(ui): vendor Inter and JetBrains Mono
`--font-sans` and `--font-mono` have named these two since the tokens were written, and both fell through to a system fallback the entire time — no face was ever registered, so UI-SPEC §2's typography had never actually shipped. The `@theme` block is unchanged; what was missing is the two `@font-face` rules. Committed as files rather than added as `@fontsource-*` devDependencies. The app runs behind a strict CSP with no external hosts, so a CDN is not an option, and two binaries carry no `npm audit` surface to keep clean forever. `legal/fonts/` holds the verbatim OFL text for each, the release each came from, and the SHA-256 of both files, so a reader can verify what shipped without trusting the note that says it. SIL OFL 1.1 permits the bundling and requires the licence to travel with it, which is what those files are. One variable file for Inter covers 100–900 without extra requests. `font-display: swap` on both: the shell renders in the fallback for the first frame rather than showing nothing, which is the same instinct as §7's "never spinners longer than 300 ms without text". `tokens.test.ts` is unaffected — it computes contrast from the colour tokens, not from anything the typeface changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
8042bdb5f8 |
docs: record Stage 6, and the DATA-FLOW §8 step nothing performs
DATA-FLOW §8 has always listed "dry-run resolve the restore set" between the plan and the snapshot, and **neither head has ever done it**. S6 did not add it, so §8 now says which part is real: `RollbackFlow` diffs, plans, and reports the entries no index can supply — but it does not ask the engine whether each restore spec is still fetchable, so a release yanked since the snapshot surfaces at execute time. Adding it is a network round trip on an interaction budgeted as instant, and it would resolve against the *pre-removal* environment, reporting conflicts the two-phase execution never hits. It needs its own design and belongs with M3's engine work. Until then the preview's promise is precise rather than broad: it lists what *cannot* be restored, not everything that might fail. UI-SPEC §4 records why the env detail is a mode of the Environments tab rather than a ninth sidebar entry (§8 fixes `Ctrl+1..8`), why the trigger label is load-bearing rather than decoration, and why the diff copy names a direction — "added" is ambiguous the moment you read it from the snapshot's side. §5's rollback row gains the real path and the 2-click route from a summary. §6 goes to 14 of 16, `PdSnapshotTimeline` having arrived; `PdEnvSwitcher` is now the only one absent that is not M3's, and nothing needs it. TESTING §2's L1 list gains the partition property, which is the one a rollback preview actually stands on. ROADMAP's Stage 6 table records the four bugs, three of which no test written for them would have found: the uncancellable restore loop, the freeze lines both parsers dropped, `snapshot_list` firing twice, and the rollback that left the timeline empty. CLAUDE.md: Stages 1–6, goldens 52 → 54, and the rule S6 leaves behind — two slices that key on different things need two resets. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
a3ad170c00 |
fix(ui): two bugs the timeline only showed when the app was running
Both found by driving the four clicks, neither reachable by any test written for them. **`snapshot_list` fired twice on open.** Stage 2's double fetch, reintroduced exactly: the `snapshotsFor` guard is only written *after* the await, so React's second development effect run reaches it before the first has answered. Invisible in the UI, because both calls return the same rows — the same reason it went unnoticed for two stages the first time. Now guarded synchronously on `snapshotsLoading`, the way `scan` already guards on `scanning`. **A rollback left the timeline empty.** The summary's `onFinished` refetches the timeline *and* the environment list, and the rescan resolved second — wiping the freshly-loaded snapshots, because the snapshot fields were inside `NO_PACKAGES` and `scan()` clears that whenever the *package* slice is stale. The two slices are keyed to different things: packages to `selected`, the timeline to `openFor`, and those move independently. `NO_SNAPSHOTS` is now its own reset, applied when `openEnv` targets a different environment, so re-opening the one already loaded keeps its timeline and going back from a rollback is instant. Verified after the fix: Open → entry → Rollback… → Roll back is 4 clicks, the preview lists `PD-SNP-002` with the verbatim freeze line before the confirm, the summary offers no undo-of-an-undo, and the timeline still has its three entries when the panel closes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
05ff2c5aa0 |
test(ui): the timeline and the preview, against generated fixtures
Two more IPC fixtures, both generated from the real Rust types rather than hand-written. `snapshot_list.json` carries one of each trigger, with the `Rollback` entry *restoring* the `Plan` entry above it. That arrangement is the whole reason the timeline labels anything: a restore snapshots the current state before restoring, so one rollback moves `latest` twice, and two adjacent entries a minute apart are otherwise indistinguishable — while one is the state the user wants back and the other is the state they are leaving. A fixture with a single trigger could not have proved the labels work. `rollback_preview.json` has all three sections non-empty, including two `unrestorable` lines. A preview fixture without them would let the component test pass whether or not `PD-SNP-002` renders, which is exactly S6's exit criterion. 11 test files, 91 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
da30709f37 |
feat(ui): the summary offers the rollback its copy already promises
`plan.cancelledDetail` has told the user since S3 that "the snapshot below restores the environment exactly as it was", and the sheet printed the id with no way to act on it. The existing test even said so in its own name — "still shows the snapshot when the run was clean, because rollback is still offered" — while nothing was offered. `onRollback` is optional and the button is absent without it, so the sheet stays presentational and does not reach for a store to work out whether a restore is possible. `PdPlanPanel` supplies it only when the store still knows which environment the run was against, and never *from* a rollback: offering to undo an undo from its own summary is a loop with no obvious exit. `App`'s `onFinished` now refetches the timeline with `force`. A rollback writes its own pre-rollback snapshot, so the list behind the panel is stale the moment the run ends — and `snapshotsFor` still matches, so without `force` the refetch is suppressed and the timeline shows the state from before. That is the `latest`-moves-twice trap one layer up from where L2 first hit it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d6ae948cda |
feat(ui): the env detail, the snapshot timeline, and a rollback that says what it cannot restore
UI-SPEC §4 puts Snapshots "under Environments → env detail" and there was no env detail — the screen was a flat list with a *Use* button. It is a **mode** of the Environments tab rather than a ninth sidebar entry, because a ninth entry would renumber `Ctrl+1..8`, which the keyboard map fixes in place. `openFor` lives in `useEnvStore`, not in the screen's `useState`. The plan panel replaces the whole content area while a rollback runs, so local state would be unmounted with it and the user would land back on the flat list the moment their rollback finished — the same shape as Stage 4's bug, one screen along. `PdSnapshotTimeline` shows the trigger, which is not decoration: an update writes a `Plan` snapshot before mutating and a rollback writes a `Rollback` one before restoring, so a single restore moves `latest` **twice**. That is what made TESTING L2's first run report every package as changed when the rollback had actually worked, and it is why nothing here ever names `latest` — the timeline hands ids to every command. `PdRollbackPreview` lists `unrestorable` under its code before the confirm rather than in the summary afterwards. §8 says those entries are "listed explicitly; user may proceed partially", and a preview reporting "12 packages" while quietly leaving two behind is a success message for a restore that did not happen. `PdPlanPanel` grows a `kind`. A rollback produces no `FlowStep` — nothing to resolve, nothing to decide — so all six `step`-shaped guards answered "no" and would have disabled the one button the flow needs. Confirm also takes the danger styling there, because a restore removes things. A dead interpreter still reaches the detail view: snapshots are keyed by `envHash` and outlive the Python that made them, so the timeline lists while diff and rollback are disabled with a line saying why. `PdEnvironments` switches to per-field selectors. It was a bare `useEnvStore()`, which subscribes to every field — including the timeline and the diff, so opening a detail would have re-rendered the whole environment list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
1df526c1ed |
feat(app): the five snapshot commands
`snapshot_list|create|diff|rollback_preview|rollback`, all `async` — a synchronous `#[tauri::command]` runs on the UI thread, and `snapshot_list` reads a directory while the other four shell out. `snapshot_list` takes the `env_hash`, not a `PyEnv`. Snapshots outlive the interpreter that made them, so an environment whose Python has been deleted still has a history worth showing — and that is exactly when `EnvRow.env` is `None`. `snapshot_diff` claims no session. Browsing a timeline must not start a flow: `RollbackFlow::start` runs `engine.freeze()`, which would be a subprocess per click on an interaction that has to feel instant, and each start would silently discard the preview the user is reading. The declared `snapshot_rollback` row becomes two, so ARCHITECTURE §7 goes 32 → 33. The preview parks the flow and the execute claims it, for the reason `plan_resolve` and `plan_execute` are separate: what the user confirms has to be the plan they were shown, not one re-derived after they answered. The outcome always carries a snapshot, because the pre-rollback one is what makes a rollback itself reversible — and is why `latest` moves twice across a single restore. Every one reads the store and drops the guard before awaiting; `cargo check -p pipdock-app` after the signatures and before the bodies, as usual. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
31bd37bf01 |
fix(core): a cancelled rollback stopped killing the current package and installing the rest
Two holes, both found by writing the test the plan asked for rather than by reading the code. **`execute_rollback`'s restore loop had no cancellation check.** The removal half gained one in S5; the install half did not, so Stop killed the package in flight and then calmly installed every remaining one. A rollback is the longest mutating run PipDock performs — a whole snapshot's worth of isolated installs — so it is the one most likely to be stopped. The remaining specs are now `Skipped` without the engine being invoked, and one killed mid-flight is `Skipped` rather than `Failed`, matching what `execute` and `execute_uninstall` already do. **`parse_freeze` and `unrestorable_lines` did not partition their input.** They were two independent filters: the second asked "starts with `-`, contains `@`, or lacks `==`", which passes `Foo Bar==1.0`, while the first dropped it because the name does not parse. A line neither claimed simply disappeared — and the one place that silence is worst is a rollback preview whose entire job is saying what it cannot put back. Both are now built on one `pin_of`, so the partition holds by construction rather than by two filters agreeing. The property test is a seeded LCG over enumerated line shapes rather than a proptest dependency: the interesting shapes are countable and it needs no shrinking to be readable. Plus a guard that `SnapshotMeta` keeps its schema name, since dropping the rename silently grows a second interface in the bindings and nothing else fails. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
463e689994 |
feat(core): a rollback preview that can cross the bridge
`RollbackPreview` derived only `Debug, Clone`, so the one thing DATA-FLOW §8 asks the user to decide — "a yanked release cannot be restored → PD-SNP-002, listed explicitly; user may proceed partially" — could not reach a screen. It and `RollbackPlan` join `SCHEMA_TYPES`; `RollbackPlan` is not strictly needed for the bindings, since `$defs` hoisting would carry it, but `pipdock schema RollbackPlan` is worth one golden for a type scripts will read out of a preview. `snapshot::Meta` gains `#[schemars(rename = "SnapshotMeta")]`. Roots take their name from the `SCHEMA_TYPES` key and `$defs` entries from the schemars name, so the moment something *embeds* `Meta` the bindings would declare both `SnapshotMeta` and `Meta` for one type, with `RollbackPreview.target` pointing at the copy. Nothing embedded it until now, which is why it never showed. Goldens 52 → 54, with two deliberate diffs: `SnapshotMeta`'s title, and the unknown-type error that lists every known type. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
f354030ed9 |
docs: record S5, and the controls that are deliberately absent
ROADMAP gains the Stage 5 table it never had — the whole S5/S6/S7 definition lived outside the repo, so `main` described the order and nothing else. Five live bugs are recorded there because none of them were S5 features: the wedged slot, the missing lifecycle markers, the removal that ignored its cancellation token, the swallowed `--no-snapshot`, and the pin button that was a tab stop. DATA-FLOW §5 now says the dialog is not the enforcement point, and §9.1 names its proof per plan shape: a `ResolutionReport` for a resolve, a `GuardReport` plus a `GuardAck` for a removal, a `RollbackPlan` for a restore. It had required a `ResolutionReport` "accepted in this session", which the uninstall path cannot produce — there is nothing to resolve — so the one flow with no preview was also the one flow the invariant did not describe. UI-SPEC §4 records two inline row buttons rather than the `⋮` menu it specified, with the click arithmetic that forced it, and the Pins screen's Exclude-only scope with the reason: `pins::hold_requirements` has no caller and `plan_requirements` restates the installed version, so a Hold at another version is a promise nothing keeps. §5 states the click-counting convention it had been applying inconsistently. §6 corrects the inventory to **13 of 16** — the "16 of 16" claim after S4 had folded in components that are not on that list — and names the four that are load-bearing but unlisted. CLI-SPEC §5 and §7 follow the exit code from 1 to 2. TESTING §1.5 says the guard must be enforced and not merely reported. CLAUDE.md: 31 → 32 codes, and adding one now re-blesses every schema that *embeds* `Code`, not just `Code`; 46 → 52 goldens; and the rule S5 leaves behind — a decision that sits between two IPC messages needs a value the executing call demands, or "somebody forgot to look" stays expressible. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
f5badf2750 |
test(ui): the first mocked IPC, the first store test, the first screen test
TESTING §2 asks for "IPC mocked at the typed wrapper layer" and nothing did it. No store had a test and no screen had one either — every existing L3 test drives a leaf component through props. S5 is the slice that needs all three, so it establishes them. `ui/src/test/ipc.ts` exports a **factory** each file passes to its own `vi.mock`, rather than a module that registers the mock as a side effect: `vi.mock` is hoisted within the file being transformed and only that file, so a side-effecting module would work or not depending on where the lint's import sort happened to put it. The factory imports lazily for the same hoist reason. `isPdError` is the real predicate, not a spy — both stores route every rejection through it, and a stub would make each error test agree with itself. `ui/src/test/stores.ts` resets a store between cases. They are module singletons created at import, so without it the second test inherits the first, and that failure passes alone and fails in a suite depending on file order. jsdom parses `<dialog>` and implements none of it, so `showModal` and `close` are stubbed beside the existing ResizeObserver stubs. They track `open` only, which means the **modality is not under test** — the top layer, the inert backdrop and focus containment are the browser's. What is covered is the policy on top: which control is focused, which is first, and what each calls. The rest is the manual pass, and the comment says so rather than letting a green suite imply otherwise. The dialog test asserts both of the slice's exit criteria — the sentence names each dependent *and* its constraint, and widening calls the guard again with no execute in between — against the generated `guard_report.json`, so the guard's own rules cannot drift away from what is asserted while both stay green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
980bd5d750 |
feat(ui): the Pins screen, Exclude only
UI-SPEC §4 specifies it in one sentence — "Pin list with reason field" — so the shape comes from what a pin has to answer six months later: which package, why, and how to stop. There is no `PdPins*` in §6's inventory, so it is built from the primitives, and the 🔒 chip is `PdPinChip` shared with the table rather than re-derived. **No Hold control.** The screen renders a `Hold` pin faithfully if one exists, but does not offer to create one: `pins::hold_requirements` is dead code in the core and `engine::plan_requirements` restates every package at its *installed* version, so a hold at any other version is a promise nothing keeps. The CLI cannot create one either, so both heads agree rather than one of them lying. The reason commits on blur — a `pin_add` upsert per commit, and one round trip per character is a lot of SQLite for a text field — and commits `null`, never `''`: `reason` is optional and `exactOptionalPropertyTypes` is on, so an empty string would round-trip as a reason that exists and says nothing. `updatePin` carries the existing mode through, because changing what a pin *is* must not be a side effect of typing in its reason box. Both writes go through one `writePin`, so which environment, the re-read, the selection prune and where the error lands are decided once. With no environment selected it says so rather than "no pins": pins are keyed by `envHash`, so that is not an empty list, it is no list. `useEnvPackages` extracts the mount effect `PdPackages` and `PdSearch` had each written. It loads **both** halves, always — `loadedFor` is one flag covering two calls, so a screen that fetched only `pkg_list` would set it and leave every row `unknown` for that environment permanently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
ef5b489861 |
feat(ui): uninstall from the row, and one tab stop per row again
The `✕` beside the pin toggle is the first of UI-SPEC §5's three clicks; *Remove*
in the guard dialog is the third. Two inline buttons rather than the `⋮` menu §4
describes: a menu spends one click opening and one choosing, which leaves one for
a confirm that has to name what breaks — and §4's third entry, "details", has no
panel to open yet. When it does they fold into a menu and the budget still holds.
Two live keyboard bugs came out with it, both against UI-SPEC §8.
The pin button had no `tabIndex`, so it **was** a tab stop — the rule the row's
own comment states ("200 rows, tabbing through two controls each is not
traversal") was enforced on the checkbox and forgotten one element later. Both
actions are now `tabIndex={-1}`.
And the row's Space handler had no target check, so Space on that focused button
toggled the row's *selection* instead of pinning. Reachable, not theoretical,
precisely because the button was focusable. Both are covered: the tab-stop test
now walks every button in the row, and a new test presses Space on an action and
asserts nothing is selected.
`PdPinChip` is extracted because the Pins screen shows the same chip, and a
second hand-written copy is how the two modes stop agreeing which is which.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
079b6146dd |
feat(ui): the uninstall session, and the dialog that names what breaks
`usePlanStore` gains a `kind`, so a removal shares the store an update already uses. One session at a time exists in Rust either way, and two stores would be two front ends onto one slot, each able to believe it owns it. Execution is written once — `runToSummary` — because the tail of DATA-FLOW §5 *is* the tail of §3: the same `plan-progress` stream, the same `ExecutionSummary`, the same console drawer and summary sheet. Only the command differs, so only the command is a parameter. `PdDialog` is the repo's first real modal. `PdConflictRow` confirms inline, which works because the thing it confirms is a row that stays put; a removal's confirm is opened from inside a virtualized table that renders a ~25-row window, so scrolling would unmount the dialog's own parent underneath it. A native `<dialog>` with `showModal()` rather than a hand-rolled overlay: the top layer, the inert backdrop, focus containment and Esc are the parts that are easy to get wrong, and the browser already has them. What is left is policy — Cancel first and focused (UI-SPEC §7), the backdrop does **not** dismiss, and `busy` disables rather than unmounts. `PdUninstallDialog` is §5's three options. *Remove dependents too* calls `uninstall_guard` again over `withDependents` instead of proceeding, because pulling Y in can break Z: stopping after one level hands the user a set that still breaks something, which is the bare-`pip uninstall` behaviour this guard exists to fix. The breakage sentence is composed here from `plan.breakage` — a new key, not `plan.blocker`, which has no subject and would render "scipy requires <1.28.0,>=1.21.6". Ctrl+1..8 is gated while the dialog is open. A native dialog makes the document inert to pointers and focus but a *window* keydown listener is neither, so the tab would change underneath and the user would answer about a screen they left. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
a08e8703d7 |
fix(ui): a plan that fails to resolve says so instead of vanishing
`usePlanStore.resolve`'s catch set `phase: 'idle'`. `App.tsx` mounts the plan panel only when the phase is not idle, and no screen reads `usePlanStore.error` — so every resolve failure was swallowed whole. A second plan (PD-RES-003), a PEP 668 environment, an unreachable index: the user pressed Update and nothing whatsoever happened, with the reason sitting in a store field nothing rendered. `failed` is its own phase and a member of the new `PANEL_PHASES`, which `App` now asks instead of comparing against `'idle'`. It gets a branch in `PdPlanPanel`, because falling through to the preview would draw a round counter for rounds that never happened and a Confirm for a plan that was never made, directly above an error row explaining there is no plan. Its own commit because it is an S3/S4 hole rather than S5 work — S5 only found it, by needing somewhere for a guard failure to land. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d36e30dd6c |
feat(app): uninstall_guard and uninstall_execute, and the re-guard they make possible
The last two mutating commands. Both were rows in ARCHITECTURE §7 and names in `COMMANDS` with nothing behind them. `uninstall_guard` parks the flow it built, so `uninstall_execute` runs the removal the user was actually shown rather than re-deriving it from names that may have moved. *Remove dependents too* is this command called **again** over `withDependents`, which is what DATA-FLOW §5 means by re-guarding: widening a removal must not skip the check that justified widening it, and a dependent of a dependent has to surface on the next pass instead of going unannounced. The previous pass's flow is discarded, exactly as `plan_resolve` discards a previous preview. `uninstall_execute` refuses with `PD-RES-004` **before** the snapshot when the guard objected and `force` is false, via a new `UninstallFlow::check` that shares its implementation with the one `execute` enforces — one rule, two call sites, so a plan that will not run leaves no snapshot behind. Both read the store and drop the guard before awaiting. `Store` is not `Sync`, so a future holding one is not `Send` and the command would not compile — and where it does compile it serializes every other command behind a subprocess. Checked with `cargo check -p pipdock-app` as soon as the signatures were written, which is the cheap version of finding this out. ARCHITECTURE §7 corrected in the same commit, as it requires. Four return types were wrong: `plan_execute` and `uninstall_execute` return `ExecutionOutcome`, not `ExecutionSummary`, and `plan_cancel` returns `bool`, not `()`. §7 also now states the one-session-at-a-time rule spans all four flows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
fc0aa4ccf6 |
feat(core): removing from a system Python is refused, and a guard trip is not a typo
Three refusals a removal did not have. **PEP 668.** DATA-FLOW §2's preamble says "all mutating flows", and `UpdateFlow` has refused externally-managed environments since S1. `UninstallFlow` did not, so PipDock would strip packages out of a system Python it declines to *upgrade* — the worse of the two operations, since there is no resolver standing between the user and the damage. **The guard was advisory.** `start` returned a `GuardReport` and `execute` ran the engine; between those two points nothing stopped a caller from not looking. DATA-FLOW §5's three options are a dialog, and a dialog is not an enforcement point. `GuardAck` is, and it is a named waiver rather than a `bool` for the reason `SnapshotProof` is: `execute(true, …)` at a call site says nothing about what was true. **PD-RES-004**, because the CLI printed `PD-PKG-002` — "no matching distribution", the opposite of the truth. Every package involved exists, and that is exactly why the removal is refused; a user grepping their logs for a typo would have found this instead. Adding it moves both count assertions (31 → 32), the `internally_raised` table, both locale catalogs, and three goldens — `Code` plus the two schemas that embed it. The exit code goes 1 → 2. CLI-SPEC §5 defines 1 as "completed with per-package failures (see JSON `counts.failed`)", but a guard trip executes nothing, so a script following the table reads counts that are not there. 2 is "plan aborted", which is what happened, and it is what `exit_for` already derives from `Area::Res` — so the binary stops disagreeing with its own mapping. Both are non-zero, so CLI-SPEC §7's `|| echo` example is unaffected. Verified against a real venv: the guard now prints PD-RES-004 and exits 2. The PEP 668 gate is not reproducible here — the marker lives in the base stdlib, so planting one would mark the machine's real Python — and it is covered by the unit test instead, the same reason `classifier_corpus` lists PD-ENV-002 as internally raised. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
8a5a69f14d |
fix(core): a removal is a plan too — lifecycle, cancellation, and the waiver
Three things `execute_uninstall` never did, none of which the CLI could notice. **It emitted no lifecycle markers.** Every line it produced carried `step: 0` and there was no `StepStarted` or `StepFinished` at all. The CLI prints `event.line()` and nothing else, so it looked fine there — but the console drawer groups sections on `StepStarted` and the live region counts `StepFinished`, which is the whole reason the payload became a lifecycle in S3. The GUI would have shown an empty drawer and a counter stuck at zero, against a green suite. **It ignored cancellation.** There was no token check in the loop, so a cancelled removal removed every package and *then* reported `cancelled: true` — a summary that reads correctly over an environment that is gone. Removals are fast, which is exactly why the window matters. Now the remaining names are `Skipped` without the engine being invoked, and one killed mid-flight is `Skipped` rather than `Failed`, matching what the install path already does. **It ignored `--no-snapshot`.** `UninstallFlow::take_snapshot` took no `SnapshotPolicy`, so the flag was parsed and dropped: the same waiver meant "waive" for an update and nothing at all for a removal, the one operation with no way back. `execute_uninstall` now takes a `base` step index, because `execute_rollback` calls it and then installs on top under one sink whose `total` counts both. The restore loop had the same missing markers and started its own indices at zero; both halves now share the space. Its doc comment is restored too — the block was attached to `execute_rollback`, leaving the function with none. `FakeEngine` records `uninstall` calls the way it records installs. Without that, "the engine was not invoked for the packages after the cancel" is a claim no test can make, which is how a loop that ignores the token passes a cancellation test. Verified against a real venv, not only the fakes: a leaf removal writes its snapshot first and reports "1 successful", and `--no-snapshot` now prints the warning and skips it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
1c17f6483d |
feat(app): one session slot for every mutation flow, not just updates
`PlanSlot` held a `Box<UpdateFlow>`, and `claim`/`park` were typed to it. S5 needs to park an `UninstallFlow` between the guard and the removal, and S6 a `RollbackFlow` between the preview and the restore, so the slot has to hold all three. All three variants land now rather than one per slice. Widening it again in S6 means revisiting `claim`, `park` and every match a second time, and the enum is the cheap half of the work. Rejected: `Box<dyn MutationFlow>`. The three flows do not share a signature — only `UpdateFlow` decides, only `UninstallFlow` has `names`, only `RollbackFlow` produces a preview — so the trait would be a pile of methods returning `Option` and every caller would still be matching on which one it really had. The typed claims (`claim_update`, `claim_uninstall`, `claim_rollback`) make asking for the wrong flow a compile error at the call site and a named error at runtime: "expected update session, found uninstall" points at the frontend's sequencing, where a bare "no plan in progress" sends the reader somewhere else. A refused session is parked back, not dropped — a mis-ordered call must not cost the user the dialog they were reading. `RollbackFlow` gains `cancel_handle`/`cancel`, which `UninstallFlow` has had since it was written. The token was already threaded into its `ProgressSink`; it simply had no way out, so a GUI rollback would have been uncancellable — and a restore is a two-phase install of a whole snapshot, which is exactly when a user reaches for Stop. `plan_cancel` becomes `async -> Wire<bool>`, because stopping now touches the slot as well as the token: a session that is merely parked has no process to kill and is discarded, since leaving it refuses the next plan on behalf of a preview nobody is looking at. An async command taking a borrowed `State<'_, _>` must return a `Result` for Tauri's glue to name the lifetime. The TS wrapper is unchanged — Tauri unwraps `Ok`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
05b8132088 |
feat(core): the guard says which requirement breaks, not just which package
DATA-FLOW §5's dialog is "Removing X breaks Y (requires X>=1), Z", but
`GuardReport.breaks` was `BTreeMap<PkgName, Vec<PkgName>>` — names only. A bare
list tells the user what will break and not whether they can live with it, and
the specifier is the only thing that separates "needs any version of this" from
"needs exactly this one".
The graph already held the requirement; `dependents_of` was throwing it away.
`breaking_dependents` keeps it as `BrokenDependent { pkg, version, constraint }`,
where `constraint` is the bare specifier tail — `"<2,>=1.26.0"`, not
`"numpy<2,>=1.26.0"` — because `Requirement::parse` splits the name off and the
name is already the map key. The caller has both halves and joins them the way
its own language does: Rust does not assemble the sentence (I18N §1), and a
specifier is data, like a version or a path.
A dependent appears once per *distinct* in-force constraint. Two marker-gated
branches that both apply are two real constraints; an exact duplicate is metadata
noise. That is the SP-5 bug's shape, so it has a test: pandas declaring numpy
four ways on 3.12 yields one line, not four.
`guard_report.json` joins the IPC fixtures, computed by running the real graph
over the real `pkg_list()` rather than hand-written — the fixture set was already
the SP-5 tangle, so removing numpy there breaks pandas and scipy with two
different specifiers, which is exactly the case the dialog exists for.
One golden moves, deliberately: `BrokenDependent` enters `$defs` and `breaks`
retypes. It arrives through `$defs` rather than `SCHEMA_TYPES`, so `pipdock
schema` gains nothing to list.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
ad167cf71e |
fix(app): a claim that finds nothing must release the slot, not wedge it
`plan_decide` and `plan_execute` called `AppState::claim()` and turned its `None` into PD-INT-001 at the call site. But `claim()` writes `Busy` before it discovers there is nothing to take, and neither of those paths released it — so one out-of-order call from the UI wedged the slot for the rest of the process, and every later command answered PD-RES-003 for a plan that had never existed. The empty case cannot be shared, because the two callers want opposite things from it. `plan_resolve` is *starting* work and needs the slot held for the whole resolve, so `Ok(None)` there is a successful claim. `plan_decide` and `plan_execute` want a session that already exists, and finding none is not claiming anything. That is `claim_one()`, which leaves the slot idle and clears the token it did not set. The slot and its cancellation token move out of `AppState` into `Sessions`, generic over what it parks. Their protocol — claim, park, release, exactly once each — is the delicate part and is now testable on its own: a test drives it with a `u32` where it could never build an `UpdateFlow`, which needs a real interpreter to probe. That is this crate's first `[dev-dependencies]` and its first tests; `AppState` keeps delegating methods, so no command body changes except the two that were wrong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d5ea886ada |
docs: correct the error-code count, and say what adding one costs
`Code::ALL` has been 31 since `PD-RES-003` landed in S3; CLAUDE.md still said 30, and the ERROR-CATALOG row count it quotes was 28 against an actual 29. Both numbers are pinned by tests, so they were never load-bearing — but a reading note that is wrong about a count is worse than one that omits it, because the next person checks it against the code and then distrusts the rest of the file. Also records what adding a code actually costs, since S3 found out one gate at a time: the catalog, `Code::ALL`, both count assertions, the "no code without a fixture" gate, both locale catalogs, and a re-blessed schema golden. The gates name what is missing, so this is a map rather than a checklist to follow by hand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
6fe362d9ec |
docs: record Stage 4, and two rules that came out of measuring it
A Stage 4 table in ROADMAP Phase 2 with the exit criteria as they were actually established: install-one counted by hand at **4 clicks**, and the keystroke budget measured before and after — **57.4 ms median / 79.8 ms p95 / 18 of 19 over budget**, then **22 ms / 24.5 ms / 0 of 19**. Both new CLAUDE.md rules are things that cost something this slice: **Measure in `--release`, and say which build a number came from.** The index load is 572 ms in debug and 140 ms in release; the worst keystroke is 176 ms against 16 ms. A design was justified with a figure four times too large before anyone noticed, and the fix is a test that refuses to run in debug rather than a note asking people to remember. **The `Send`/`Sync` rule now says it has bitten twice** — `UpdateFlow::start` and then `index::metadata`/`refresh` — so the next person can expect it rather than rediscover it. The "run it, don't just test it" tally gains Stage 3 and Stage 4, and Stage 4's entries are the sharpest yet: a wrong number, a missed budget, and a flow that ran correctly all the way through Rust and then rendered nowhere. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
411bb0e7b2 |
fix(ui): a plan belongs to the app, not to the screen that started it
Found by counting the install flow's clicks in the running app. Two bugs, neither of which
any test would have caught, and the first of which made the whole flow a dead end.
**`plan_resolve` succeeded and the preview rendered nowhere.** `PdPlanPanel` was owned by
`PdPackages`, so a plan started from the Search dock bay resolved into a screen that does
not render it — the command ran, the flow parked in `AppState`, and the user saw the search
results unchanged. The panel now lives in the shell, which is also where it belongs
conceptually: there is one plan at a time (`PD-RES-003`), it can be started from Updates or
from Search, and which tab happens to be showing is not part of that.
**Every search result offered [Add], including packages already installed.** The chips read
`useEnvStore.packages`, which only `PdPackages` ever loaded — so a user who opened Search
first got no chips at all and could queue something they already had, which is exactly the
mistake DATA-FLOW §4 added them to prevent. Search now ensures the load, and the store's
existing `loadedFor` guard makes that free when Installed has already run.
Verified the way they were found: **install-one is 4 clicks** — Search (autofocused) → Add →
Install → Confirm — the queue holds `httpx`, `requests` shows `INSTALLED` and no [Add], the
preview groups `new-install` and `new-dependency`, `Confirm (3 changes)` starts execution,
and the intent that crosses is `{ intent: "install", specs: ["httpx"] }`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
c4890985e2 |
perf(ui): meet the keystroke budget, and measure it rather than assume it
S4's exit criterion is **< 50 ms per keystroke measured in the app**. Measuring it first found that it was being missed, and then found that one of my own numbers was wrong. **The 613 ms index load I reported was a debug build.** In release it is 140 ms, and the worst keystroke is 16.44 ms rather than 176 ms. The design — hold the index, warm it on demand — is unchanged and still right at 140 ms, but it had been justified with a figure four times too large. Every comment stating it is corrected, and `tests/search_latency.rs` now **refuses to run in debug** rather than printing a number that means nothing. That test is `#[ignore]`d because it needs a real refreshed index. Then the end-to-end measurement, in the running app with a 16 ms stand-in for real ranking: **median 57.4 ms, p95 79.8 ms, 18 of 19 keystrokes over budget.** Two fixes: - **The debounce now has a leading edge.** It was trailing-only, so it spent 16 ms of a 50 ms budget doing nothing on *every* keystroke — a third of it. The comment above it had claimed leading-edge behaviour since the day it was written; the code never did it. - **`SEARCH_LIMIT` 50 → 20.** React commits every row on every keystroke, so the row count is the largest single lever on the render half. 20 is a screenful and the list scrolls. After: **median 22 ms, p95 24.5 ms, 0 of 19 over budget** — roughly 25 ms of headroom, of which 16 ms is the ranking itself. The first version of the harness was also wrong, and in the familiar way: it waited two animation frames per sample, which is ~33 ms of stopwatch on a 50 ms budget. A MutationObserver measures when React actually commits. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
30146b02d7 |
feat(ui): Search, the dock bay, and the offline chip
UI-SPEC §4's Search screen. `useIndexStore`, `PdDockBay` and `PdOfflineBanner` — 16 of 16 components in §6's inventory now exist. Three things live in the store rather than the component, and all three are consequences of the < 50 ms budget rather than preferences: - **The previous result set stays rendered** while a new query is in flight. Blanking the list on every keystroke is what makes a fast search feel slow. - **Responses are sequenced.** Two searches can be in flight and can return out of order; without a sequence number the older one wins and the list contradicts the field. This is the kind of bug that shows up only under a fast typist on a slow day. - **A 16 ms debounce** — one frame. It is a coalescer, not a delay: the first keystroke after a pause searches immediately. Anything longer is felt on a budget this tight. Already-installed packages show `INSTALLED` or `UPDATE` instead of an [Add] button (DATA-FLOW §4), which is what stops the most common mistake — queueing something you already have. An empty version field in the dock bay means *latest*, which is exactly what a `PlanRequest` with no specifier means, so the common case needs no typing. The offline chip is deliberately not a blocking state: search is served from the local index and keeps working, so greying the app out would claim more than is true. `navigator.onLine` reports whether an interface is up, not whether PyPI is reachable, so it explains a failure rather than gating an attempt. `/` focuses Search (UI-SPEC §8), guarded against text fields — otherwise a slash could not be typed into a version specifier. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
3d1e13bbbb |
feat(app): hold the name index in memory, and warm it on demand
S4's exit criterion is < 50 ms per keystroke measured in the app. **`NameIndex::load` costs 613 ms on the real 858k-project index** — measured before writing any of this — which is twelve times the whole budget. SP-3 had already ruled out the alternative: scanning SQLite per keystroke measured 218 ms. So the index is loaded once and held, and the only real question was when to pay for it. On demand, with `IndexSlot` as the honest account of it. A user who never opens Search never pays; one who does gets the field immediately with a note. Typing two or three characters takes about as long as the load, so the note is rarely seen — but `index_search` must **never** wait for it, which is what a state rather than an `Option` behind a lock enforces. `index_refresh` invalidates the slot, or a refresh reports thousands of new projects that search cannot find. `ready: false` is a state on the result, not an error. "You have never refreshed the index" is an action the user can take; an error row would say something went wrong instead. Empty `hits` and "not loaded yet" are different answers, and conflating them would tell someone their package does not exist for 613 ms. **`index::metadata` and `index::refresh` now take the app-data directory, not a `&Store`** — the same fix as `UpdateFlow::start`, for the same reason, and this is the second time it has come up: `Store` is `Send` but not `Sync`, so a future holding one is not `Send` and cannot be returned from a Tauri command. It also stops `refresh` holding a SQLite handle open across a multi-second PyPI download, which was wrong independently of whether it compiled. The no-snake_case-in-any-schema test earned its keep again: `RefreshReport` went onto the wire with `wire_bytes` and `elapsed_ms` and was rejected. Verified by running afterwards — a real `index refresh` fetched 864,083 projects in 4.5 s and printed camelCase. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
02c8d13d59 |
docs: record Stage 3, and the three rules that bind every slice after it
A Stage 3 table in ROADMAP Phase 2, with the exit criteria as they were actually verified — "update everything" counted by hand at **4 clicks** in a running app, still 4 with a conflict left at its default, and a cancel mid-execution yielding a coherent summary with Skipped rows. Three specification gaps are recorded in UI-SPEC §4 rather than left in commit messages, because each is a thing the next person would otherwise re-derive: `Will downgrade` had no section, `Keep compatible` should not be offered on impossible rows, and the round counter was invisible. CLAUDE.md gains the rule that cost the most to learn this slice: **a Tauri command's future must be `Send` and `Store` is not `Sync`**, so the store guard can never cross an await. At the command boundary it does not compile; inside core, where it does, it silently serializes every other command behind a network call. That is why `UpdateFlow::start` takes pins rather than a store, and it will be true of every command S4 adds. S4's exit check is called out as something to design for before building rather than after: < 50 ms per keystroke *measured in the app*, which adds an IPC round trip SP-3 never measured. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
bba928b173 |
test(ui): the last three L3 obligations — grouping, 3-way state, counts
TESTING §2 names five things L3 must cover. S2 did `PdPackageTable` dimming/badging and the design-token contrast test was already green; these are the other three, so the list is now complete and §3's PR gate means something. Fed from `flow_step.json` and `execution_summary.json`, serialized from the real `FlowStep` and `ExecutionSummary` by `xtask -- ipc-fixtures` and held current by the Rust-side staleness test. The resolve fixture covers all four `ChangeKind` variants plus a held-back and an impossible package, so every rule has a real subject rather than one invented to suit it. The summary fixture is a **cancelled** run on purpose: it is the case DATA-FLOW §6 does not work through, the one whose copy was deferred out of Stage 1, and the one where the headline and the rows are most likely to drift apart. The counts test checks the headline against the rendered rows by status rather than restating the fixture, so it fails if the sheet ever starts doing its own arithmetic instead of rendering the counts core derived. **Both conflict rules were checked by breaking them.** Enabling *Keep compatible* on an impossible row fails one test; forcing without the confirm fails two more. Those are the two places where a plausible-looking control would promise something the core refuses to honour — `default_decision(is_impossible = true, …)` returns `Skip`, and DISCLAIMER §2 wants the breakage named before anything is forced. One thing the type checker caught that a hand-written fixture would not have: `Trigger` is not a string. A plan-triggered snapshot carries the plan id it protects, which is what lets the summary's rollback offer point at the right one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
3fc529f42b |
feat(ui): the preview, the conflict control, the console and the summary
The mutation spine on screen — DATA-FLOW §3 from `Resolving` to `Summary`, and PRD G1's promise that every mutating operation is previewed before it runs. `usePlanStore` tracks which step is showing and nothing more: which step is *allowed* next is the flow's business, in Rust, because two implementations of that state machine is what `core::flow` exists to prevent. **`Will downgrade` is its own section.** `ChangeKind` has four variants and UI-SPEC §4 named three groups, so `Downgrade` had nowhere to go — and it is not rare: a *compatible* resolve routinely moves a package down to satisfy something else. Folding it in with the upgrades would put `2.0 → 1.9` under a heading reading "Will upgrade", which is misleading about exactly the change most likely to surprise. §4 amended. **`Keep compatible` is disabled on impossible rows.** UI-SPEC said every needs-decision row hosts the full 3-way control, but `default_decision(is_impossible = true, …)` returns `Skip` because an impossible package has no compatible version to keep. The UI mirrors the core rather than offering a choice it would refuse to honour; §4 now says so too. **The round counter is visible.** `MAX_CONFLICT_ROUNDS` has been in core since M1 with nothing surfacing it, so a user could hit the cap unwarned. The preview says how many rounds remain, and the exhausted state keeps the preview on screen with a warning rather than dead-ending. **The cancelled summary has copy now** — the third Stage 1 deferral. It says the run stopped part-way, that a package may have been left half-written, and points at the snapshot, which is the only complete answer to that. Two smaller things worth their comments: the console buffer is capped at 2000 lines, because a source build is tens of thousands and each would otherwise be a React state update holding a string alive — the full log is the log file, which is what "Copy full log" reads. And answers are cleared with the round they belonged to, since the next preview may name a different set and a stale answer would be sent to a flow that has moved on. "Update selected" is live, so UI-SPEC §5's budget is now real: Updates → Select all → Update → Confirm. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
1bc103bc75 |
feat(app): the plan session, and the four commands that drive it
The architectural centre of S3. `UpdateFlow` is a **resumable state machine** and IPC is stateless: `plan_resolve` builds the flow, the user reads the preview, and `plan_decide` or `plan_execute` arrives as a separate message seconds later. Something has to hold the flow in between, and that is `PlanSlot` in `AppState`. **One plan at a time, and `PD-RES-003` when a second arrives.** Nothing structurally prevents it — the calls are independent messages — and two concurrent plans would interleave engine commands against one environment while DATA-FLOW §9.3's staleness check compared against a set the other plan was busy changing. `claim()` takes the slot before any work, and **every** exit path releases it: a claim that leaks would leave the session refusing plans forever, which is the failure mode this design has to be careful about. `Busy` moves the flow out rather than borrowing it, because `execute` awaits for as long as the install takes and holding the slot's lock across that would block `plan_cancel` — the one command that must work precisely then. For the same reason the cancellation token lives in its own lock, held only long enough to read an `Option`. **`UpdateFlow::start` now takes the pins, not the `Store`.** Not a tidy-up: `Store` wraps a `rusqlite::Connection` and is `Send` but not `Sync`, so a future holding `&Store` across an await is not `Send` and a Tauri command cannot return one. It did not compile. Reading the pins first is one synchronous line at each call site, and the flow no longer reaches into a database at all — it can now be driven in a test without one. `plan_execute` returns the snapshot alongside the summary. The CLI prints the id *before* execution because DATA-FLOW §3 draws them as distinct states; the summary sheet needs it *after*, to offer the rollback. One envelope beats a second command to go and look it up. `PD-RES-003` went through the whole catalog process rather than round it: the "no code without a fixture" gate rejected it until it was listed as internally raised with the module that owns it, and both locale catalogs carry its copy — otherwise `PdErrorRow` would show `errors.unknown` for a condition PipDock raises itself. `Decision` joins SCHEMA_TYPES too, since `PdConflictRow` needs the 3-way type. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
e57870b3d9 |
feat(core): FlowStep and Intent cross the IPC boundary
The GUI's two decision points are IPC round trips with a render in between — that is why `core::flow` is resumable rather than callback-driven, and it is the whole reason the preview can be drawn at all. But the types those round trips carry were not serializable: `FlowStep` had no `Serialize` and `Intent` had neither, so the flow could be driven from Rust and from nowhere else. Both are now tagged enums with camelCase fields, generating as discriminated unions the frontend can switch on directly. Tagged internally rather than externally so a consumer can look at `step` without unwrapping first. `roundsRemaining` comes out with them, and it closes a gap worth naming: `MAX_CONFLICT_ROUNDS` has existed in core since M1 with nothing surfacing it, so a user could hit the cap with no warning that it was approaching. The preview can now say so before the last round. `Decision`, `Strategy` and `ResolutionReport` already had what they needed — no change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
82ffab23f3 |
feat(core): plan-progress carries a lifecycle, not just a line
The other Stage 1 deferral, and the same reason for deferring it: S3 is the first slice
that builds the two things it exists for.
ARCHITECTURE §7 specified `plan-progress { step, pkg, phase, line }`, which made both of
them unimplementable. UI-SPEC §3's per-package section markers in the console drawer had no
event meaning "a step began" to group under, and §8's "13 of 15 complete" live region had
none meaning "one finished" to count. Neither is recoverable from the text: engine output
does not reliably name the package it concerns, and counting lines is not counting steps.
Now a tagged enum — `stepStarted` / `line` / `stepFinished`. Every step emits exactly one
open and exactly one close, whichever way it ended, including the cancelled and
failed-to-spawn paths. That is asserted rather than assumed: a test collects the events off
a real execution and checks the opened and closed step indices are equal sequences, with
the failing package still closing its section carrying the status the summary reports.
Markers are emitted by the executor, not the adapters, for the same reason `step` is — an
adapter runs one command and cannot know it is step 3 of 15.
`line` also says which stream it came from. That is presentation, not judgement: uv writes
its **plan** to stderr (SP-1), so a drawer that treated stderr as failure would colour a
successful resolve red. Verified against a real subprocess rather than the FakeEngine —
the fake returns results without ever producing output, which is how the first version of
that test managed to assert nothing, caught by its own "this proves nothing" guard.
`ProgressEvent` joins SCHEMA_TYPES, so the frontend gets the discriminated union generated
rather than hand-mirrored. One new golden; `golden__schema-unknown-type` moves because it
lists the known types.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
346fbfad7a |
feat(core): cancellation now kills the whole process tree
Deferred from Stage 1 to the slice that could verify it. S3 is that slice: `python -m pip` spawns build backends and compilers for any source distribution, and cancelling a build is precisely when a user needs the stop to mean something. `kill_on_drop` reaches the direct child only. A `TreeGuard` puts each spawned child into a Windows Job Object with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE`, so everything the child goes on to spawn joins the same job and closing the handle terminates all of it. `run()` now spawns rather than calling `.output()`, which owns the child and never lends out a handle. `win32job` is a safe wrapper, so `unsafe_code = "forbid"` stays absolute and no unsafe block enters the codebase. It locks exactly one new package — its `thiserror` and `windows` dependencies are already in the tree via Tauri. Attaching is best-effort: if the job cannot be created the guard is `None` and behaviour is exactly what it was, since `kill_on_drop` still ends the direct child. **The first version of this test was wrong, and the mutation check is what caught it.** It measured wall-clock time for `run()` to return — but both stop paths return as soon as their future resolves, so it passed in 200 ms while the orphan lived on, and passed *again* with the guard disabled, taking 29 seconds to do it. Whether the grandchild is still alive is the only observable that separates the two outcomes, so the test now asks the OS for a process count by command-line marker. With the guard disabled it fails `left: 1, right: 0`; with it, the whole exec suite runs in 3.4 s instead of 29. Both stop paths are covered — cancellation and the watchdog — because they are two different drops of the same guard and only one of them had ever been exercised on a tree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
e81dd1c811 |
docs: record Stage 2, and the two decisions that bind S3
A Stage 2 table in ROADMAP Phase 2 in the shape of Stage 1's: what landed, the four bugs that were not in the plan, and the decisions a later slice has to honour. Three of those four were found by running — timing the probe, doing one real `pip install -e`, and logging what actually crossed the bridge. CLAUDE.md's "run it, don't just test it" note now carries both stages' tallies, because the pattern has held across every slice so far and is the single most useful thing to know before starting the next. Two S2 decisions are called out where S3 will actually read them. "N pinned excluded" in the table is presentation and S3's preview must use the flow's `excluded_pins()` instead, or the two numbers drift. And row state is three-valued because one of its two sources is networked — anything rendering package state inherits that obligation. Also added: `probe.py` is on the hot path. The Installed screen re-probes on every environment open, so anything added to `_dists()` is paid 200+ times per open — which is how an innocuous-looking `Distribution.files` became a 10× regression. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
a9363e91d5 |
fix(ui): stop every screen fetching twice on mount
Found by running the app and logging what actually crossed the bridge: opening Installed issued `pkg_list`, `pin_list` and `pkg_outdated` **twice each**, and `env_scan` had been firing twice since Stage 1. React runs effects twice on mount in development, and the `loadedFor` guard cannot catch it — `loadedFor` is only set once the await resolves, so both effect runs see the old value and both proceed. Guarding on the in-flight status instead (`listing`, `outdatedStatus`, `scanning`) is synchronous and closes it. It is not only a development-mode nicety. `loadedFor` is a *post-hoc* marker, so any re-render that re-runs the effect before the first response lands duplicates the work, and that work is `probe.py` — the thing whose cost the RECORD-parsing implementation existed to keep down — plus a network round trip for the outdated set. `env_scan` is the worst of the three, since discovery spawns a probe per candidate interpreter. It was invisible for a whole stage because both scans return the same rows. Verified the same way it was found: every command now appears exactly once, and switching Installed → Updates → Installed still adds none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d844c83ad3 |
fix(ui): drop the redundant fixture casts the tests did not need
`resolveJsonModule` already infers `pkg_list.json` and `pkg_outdated.json` as assignable to `Dist[]` and `OutdatedDist[]`, so the casts were dead and `no-unnecessary-type-assertion` was right to say so. Removing them is a small ongoing check that the committed fixtures still match the generated types — if a field is renamed, this stops compiling. `pin_list.json` keeps its cast: `PinMode` is a union and JSON inference widens `"exclude"` to `string`. Slipped past the previous commit because `npm run lint | tail` reports tail's exit status, not eslint's. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |