Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: bun
directory: /
schedule:
interval: daily
# Review the latest releases without an artificial waiting period.
cooldown:
default-days: 0
# Keep coupled peers, such as React/React DOM and the TypeScript tools,
# in the same review instead of proposing incompatible intermediate states.
groups:
javascript:
patterns:
- '*'
commit-message:
prefix: chore(deps)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ src-tauri/binaries/pathkeep-worker-*

# Local agent worktrees and runtime metadata
.claude/

# Generated dependency audit and gate output.
artifacts/dependency-refresh/
7 changes: 4 additions & 3 deletions .modal-offload.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ user = "ubuntu"
# ci.yml runs the checks under dbus-run-session and xvfb-run: owner_process starts the
# real app, which needs a display, and its single-instance handoff needs a session bus.
# Setup starts the same two here, so every command has them.
env = { DISPLAY = ":99", DBUS_SESSION_BUS_ADDRESS = "unix:path=/tmp/offload-dbus", CARGO_HOME = "/state/home/cargo", RUSTUP_HOME = "/state/home/rustup", BUN_INSTALL_CACHE_DIR = "/state/home/bun-cache", PLAYWRIGHT_BROWSERS_PATH = "/state/home/ms-playwright" }
# Tauri CLI parses CI as a boolean. Match the GitHub Actions value.
env = { CI = "true", PATH = "/state/home/bun/bin:/opt/cargo/bin:/opt/bun/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", DISPLAY = ":99", DBUS_SESSION_BUS_ADDRESS = "unix:path=/tmp/offload-dbus", CARGO_HOME = "/state/home/cargo", RUSTUP_HOME = "/state/home/rustup", BUN_INSTALL_CACHE_DIR = "/state/home/bun-cache", PLAYWRIGHT_BROWSERS_PATH = "/state/home/ms-playwright" }
# The desktop crate's build script needs the worker sidecar in src-tauri/binaries.
setup = "(pgrep -x Xvfb >/dev/null || (setsid Xvfb :99 -screen 0 1280x800x24 >/dev/null 2>&1 &)) && (test -S /tmp/offload-dbus || dbus-daemon --session --fork --address=unix:path=/tmp/offload-dbus >/dev/null) && bun install --frozen-lockfile >/dev/null && bunx playwright install chromium >/dev/null && bun run prepare:worker-sidecar --profile debug"
artifacts = ["artifacts/e2e"]
setup = "bash scripts/prepare-modal-env.sh"
artifacts = ["artifacts/e2e", "artifacts/dependency-refresh"]
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ src-tauri/crates/vault-core/tests/fixtures/static_parity_potion_multilingual.jso
# would silently desync the source from the pinned artifact → fail-closed).
src-tauri/crates/vault-core/src/ai/code_mode_guest/
docs/design/prototype-2026-10/

# Generated dependency audit and gate output.
artifacts/dependency-refresh/
13 changes: 13 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,16 @@ Update docs in the same branch when you change:
- release commands or workflow inputs
- support diagnostics expectations
- user-visible settings, onboarding, or screens (`docs/design/screens-and-nav.md`)

## Dependency updates

Use the Bun version in `package.json`'s `packageManager` field. Current JS
checks require a supported Node release: 22.22.2+, 24.15.0+ or 26+.
`bun run outdated:js` lists available updates; `bun run update:js` updates to
current stable versions, including new majors. Run `bun run check` and
`bun run check:supply-chain` after the compatibility changes.

See [dependency maintenance](docs/architecture/dependency-maintenance.md) for
the TypeScript compiler/API split, the minimatch override and Dependabot's
coverage. Do not replace the TypeScript API alias with the native compiler
package: typed ESLint still needs that compatibility API.
1,046 changes: 491 additions & 555 deletions bun.lock

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions docs/architecture/dependency-maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Dependency maintenance

PathKeep follows current stable releases. A major version is a migration to
validate, not a reason to keep an old dependency. Keep an older release only
for a concrete incompatibility, with its reason and reproduction recorded.

## JavaScript and TypeScript

`package.json` declares the supported ranges and the Bun version; `bun.lock`
records the exact graph. Use the Bun version in `packageManager`, which
`oven-sh/setup-bun` also reads in CI. Modal setup reads the same field, rather
than keeping a second Bun version pin.

```sh
bun run outdated:js
bun run update:js
bun run check
bun run check:supply-chain
```

`update:js` checks latest stable versions across major-version boundaries.
Review their migration guides and keep related peers compatible. Refresh
transitive dependencies too; do not add a transitive package to the app's
direct dependencies just to update it. Bun 1.4.4 supports named transitive
updates without changing that ownership:

```sh
bun update <existing-transitive-package>
```

`audit:js` runs `bun audit` over the lockfile, including development and
transitive dependencies. It is part of `check:js` and the combined
`check:supply-chain`. New advisories fail the checks; an unavailable audit
service is not treated as a clean result. Rust retains its separate advisory,
license, source and dependency checks.

## Dependabot coverage

`.github/dependabot.yml` checks the Bun project daily, including major updates,
without a cooldown. Related JavaScript peers are grouped in one PR. Changes
still require review and the normal gate; there is no automatic merge.

Security updates and scheduled version updates are separate GitHub features.
On 2026-11-10 this repository had security updates enabled and no open alerts,
but no version-update configuration. Its GitHub SBOM exposed 43 npm entries,
including manifest ranges such as `vite@^8.0.3`, rather than the complete Bun
lockfile graph. It omitted transitive packages such as `dompurify` and
`react-router`. Therefore zero GitHub alerts did not establish a clean Bun
dependency graph. Keep the lockfile audit in CI even with Dependabot enabled.

References: [Dependabot Bun support](https://docs.github.com/en/code-security/reference/supply-chain-security/supported-ecosystems-and-repositories),
[dependency graph formats](https://docs.github.com/en/code-security/reference/supply-chain-security/dependency-graph-supported-package-ecosystems),
[security updates](https://docs.github.com/en/code-security/concepts/supply-chain-security/dependabot-security-updates).

## Current compatibility choices

- **TypeScript compiler and API.** `@typescript/native` aliases the current
`typescript` 7 package and supplies `tsc`. The package named `typescript`
aliases Microsoft's current `@typescript/typescript6` compatibility API.
The current typescript-eslint supports the 6 API and rejects 7. This keeps
the compiler current without disabling typed linting or using an unsupported
API. Follow [Microsoft's side-by-side guidance](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0)
until typescript-eslint supports the new API.
- **minimatch override.** Current ESLint and typescript-eslint still request
minimatch 10. `overrides.minimatch` selects current 11 because
[GHSA-g3hv-75wg-m249](https://github.com/advisories/GHSA-g3hv-75wg-m249)
affects versions below 11.0.1. The consumers use the supported `Minimatch`
and matching interfaces; validate the project's real lint, typecheck and
full gate. Remove the override when upstream ranges accept the fixed major.
- **Tauri peers.** Updating `@tauri-apps/plugin-dialog` or
`@tauri-apps/plugin-log` also updates the corresponding Rust crate to the
same major/minor. Preserve the desktop identifier, IPC payloads and backend
client boundary.
- **Node support.** Current jsdom requires Node 22.22.2+, 24.15.0+ or 26+.
`engines.node` records those supported release lines; CI uses current Node
22 and local validation also covers Node 26.

## Validation scope

Advisory results describe the database at the time of the run. PR #20's check
passed on 2026-11-13, but the following supply-chain step detected
[RUSTSEC-2026-0486](https://rustsec.org/advisories/RUSTSEC-2026-0486.html),
issued on November 11 after the earlier validation. Update the existing rustix
1.x dependency to the current patched 1.1.6, preserve compatible locked Windows
bindings, and rerun the gates. The rustix 0.38 series is unaffected. This adds
no advisory exception.

The authority remains `bun run check`, including the real Rust backend and
all E2E configurations. A dependency audit is additional evidence about known
advisories, not a substitute for behavior tests. Keep each run's fixture,
results, report and logs. When a full local gate cannot fit on disk, use the
project's authorized Modal workflow with a hard timeout and terminate the
sandbox when the run ends.

Modal runs `scripts/prepare-modal-env.sh` in a separate Bash process with
`set -euo pipefail`. The offload runner tests setup with `|| exit`; Bash ignores
`errexit` inside that conditional subshell. Keeping preparation in its own
process ensures a failed dependency installation stops setup before browser
installation or the worker build.
7 changes: 7 additions & 0 deletions docs/architecture/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ slashes and operator-looking text remain literal parts of the Rust regex pattern

## Desktop, worker and dev IPC

History owns its streamed search subscription in a React layout effect. Changing
or clearing the request closes the previous subscription during commit, before
its next animation frame. Queued state updaters also check that ownership when
React applies them. A cleared search cannot return as the next search's dimmed
placeholder; replacing a search directly retains settled rows until the new
search delivers a step. Transport startup stays asynchronous.

Tauri commands:

```ts
Expand Down
4 changes: 4 additions & 0 deletions docs/plan/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3091,3 +3091,7 @@ that held up when checked against the code.
- `WORK-BACKUP-INTEGRITY`, seventh review round (2026-11-03). ChatGPT Pro's review of PR 18's change over #16, each finding checked against the code and fixed at its cause. A checkpoint replayed after a backup put a finished download back in progress: downloads were the one record whose state can go any way with nothing in the row saying which is newer, so each row now keeps when the copy it was read from was taken (`observed_at_ms`, migration 21) and an earlier copy leaves it. Two Firefox visits at one address and time but of different kinds were one: visit identity was compared in three places, now one (`identity::same_event`, Firefox's kind included, also in the preview and the opener marks). A file of Firefox Sync copies only previewed as nothing to import, since the preview had two outcomes and the import three; it now has the import's three, the card shows the copies and offers the import, and a first import's preview applies the same within-file identity (found by Codex's read of the fixes). The raw-copy check's claim for Windows was corrected (NTFS may not update the last-write time while the browser holds the file); measuring it needs a Windows machine (`WORK-WINDOWS-RAW-COPY-CHECK`). Kept: the incremental read's table scan (22 ms per million rows, within the full-file copy every backup makes), and two points the earlier rounds decided.
- `WORK-BACKUP-INTEGRITY`, eleventh review round (2026-11-08; the eighth to tenth reviewed #16 and changed nothing here). ChatGPT's review of the head rebased onto main (`0ed981b9`) found one problem and reproduced it on the real v0.4.0 archive: matching a visit version 1 saved only preferred the Firefox row's kind, so in a renumbered file a visit of another kind at the same address and time, which version 1 never saved, could be read first and take the old visit; the old row then matched it exactly and the new visit was never written while the run reported success (with two microseconds in one millisecond, one row's time was paired with the other's kind and the next full read added a third visit; an import wrote fewer visits than its preview offered). The seventh round made the kind part of `same_event`; the version 1 rule and the version 1 fallback of the opener lookup now require it too, through one filter on the candidates already loaded (`identity::same_kind`). Version 1 stored the kind raw, so a visit's own row always has it. Four scenarios and the v0.4.0-archive E2E fail on the old rule. `store-schema.md` no longer says version 1 visits are navigated by row id.
- `WORK-BACKUP-INTEGRITY`, twelfth review round (2026-11-09). ChatGPT's review of `545f9a37` found three problems, each reproduced twice; all hold, each less severe than rated. The read cursor remembered the row a backup stopped at, and the lowest row, by address and time only, so a Firefox row reused by a visit at the same address and microsecond but of another kind, older than the recent window, passed for the visit already read and was left to the weekly full read; the cursor now keeps the kind too (migrations 22 and 23) and compares the whole identity in one place. Round 7 had kept this, judging the file it needs could not occur; the review reached it through Firefox's ordinary id reuse. The incremental read's `id > ? OR time >= ?` walked every visit row, and the count of visits without a page did too once the file had statistics (kept in round 7 at 22 ms per million rows); the four copies of that window are now one (`visit_query`): a rowid range after the cursor and the browser's time index below it, merged in id order, with Chrome and Firefox pinned to no full scan and Safari, which has no index led by the time, reading no more than before. The schedule's health took the newest wake for the newest backup, so a "not due" wake right after a partial run cleared its warning; it now takes the newest attempt that ran a backup. Also fixed, older than this PR: the hourly schedule backed up every two hours, because the due clock ran from the end of the last backup and wanted a whole interval when the wake comes every interval; a scheduled backup now runs at the wake nearest one interval after the last counted backup started, the wake interval defined once for the plan and the worker, and the app's "next backup" time comes from the same rule. rmcp 3.9 for three new RustSec advisories; RUSTSEC-2026-0459 (bundled SQLite before 3.54) is allowlisted with the user's agreement until libsqlite3-sys bundles SQLCipher on SQLite 3.54: the patched release still builds SQLCipher on SQLite 3.53.4 and would add an unreviewed dependency (`WORK-SQLCIPHER-SQLITE-354`).

- `WORK-JS-DEPS-2026-11-10` (2026-11-10). Refreshed 30 direct JS and TS dependencies to current stable releases and kept typed ESLint on Microsoft's supported compiler API alongside the TypeScript 7 compiler. Aligned both Tauri plugin pairs, added a daily Bun Dependabot schedule and placed the lockfile audit in the normal gate. The original graph matched 19 packages and 88 distinct advisories on Bun 1.4.4. The refreshed graph passed across 532 checked packages. React Router now mounts a separate provider after onboarding. The Insights tests query Radix's `radiogroup` role and retain the original behavior assertions. Linux `bun run check` passed with 134 E2E cases and one platform skip. The Modal environment now sets `CI=true` for Tauri, and the desktop debug build and combined supply-chain checks passed in that environment. Local frontend checks passed with 107 tests. Validation is recorded in `docs/plan/releases/v0.5.0/dependency-refresh.json`.

- PR #20 review and fresh RustSec scan (2026-11-13). A queued search frame could restore cleared rows before passive cleanup; the subscription now ends during commit and queued state updates check ownership. Three React race cases were written before the fix, with the cleared-search case failing under the old code. Modal setup could report success after an installation failed because the runner's conditional subshell suppressed errexit; a separate Bash process now preserves failure (injected exit 17 stops both later commands). The subsequent GitHub audit found newly issued RUSTSEC-2026-0486 after its full check passed. Updated the existing rustix 1.x dependency to 1.1.6, retaining compatible Windows bindings and adding no exception. The patched source passed `bun run verify` and `bun run check:supply-chain`: 110 frontend tests, 91 Rust test groups, 134 E2E cases and one platform skip, desktop debug build, zero JavaScript advisories and the same eight documented Rust exceptions. Both lockfiles stayed unchanged. Receipt: `docs/plan/releases/v0.5.0/pr20-review.json`.
15 changes: 15 additions & 0 deletions docs/plan/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@

## CURRENT FOCUS

- [x] **WORK-RUSTIX-2026-11-13** — 新發布的 RUSTSEC-2026-0486 擋下 PR #20 的供應鏈 gate,更新既有間接依賴後重新驗證。
- 讀先:`docs/architecture/dependency-maintenance.md`、RustSec 官方公告與 crates.io 的版本/依賴資料。
- 11 月 11 日發布的公告影響 rustix 1.1.4;更新至最新修正版 1.1.6。保留既有 Windows bindings,不新增 advisory 例外。GitHub 的完整 `bun run check` 已過,失敗的是隨後的新公告掃描。
- 修正後 `bun run verify` 與 `check:supply-chain` 通過;前端 110 個測試,E2E 134 過/1 個平台略過,Rust 91 組通過。兩份鎖檔前後 hash 相同,JS audit 為零,Rust 維持原有八項例外。證據:`releases/v0.5.0/pr20-review.json`。合併另等最新 GitHub CI。

- [x] **WORK-PR20-REVIEW** — PR #20 的兩個審查問題已重現、修正並通過完整 gate。
- 讀先:`docs/architecture/search.md`、`dependency-maintenance.md`、`docs/plan/program/quality-matrix.md`。
- 搜尋清除時,舊動畫幀能在 passive cleanup 前寫回資料;先寫的 React 回歸測試在舊實作失敗。改在 commit 清理訂閱,queued updater 也檢查存活狀態。
- Modal 的條件 subshell 會忽略 `errexit`,安裝失敗仍繼續準備;改以獨立 Bash process 執行 setup,失敗注入現在保留 exit 17 並停止後續命令。

- [x] **WORK-JS-DEPS-2026-11-10** — 更新 30 個既有 JS/TS 直接依賴,加入每日 Dependabot 更新與 Bun 鎖檔稽核。
- GitHub 安全更新原已啟用,依賴圖當時只列出 43 個 npm manifest 項目。舊鎖檔稽核命中 19 套件/88 項公告,新鎖檔掃描 532 套件後為零。
- TypeScript 7 編譯器搭配官方 6 API 供 ESLint 使用。同步更新 Tauri dialog/log 的 JS 與 Rust 版本。Onboarding 與主畫面各自掛載 router provider,Insights 測試查詢新版 Radix 的 `radiogroup`。
- `bun run check` 通過,E2E 134 過、1 個平台略過。修正 Modal 的 `CI=true` 後,Linux desktop debug build 與供應鏈檢查通過。本機前端 107 測試及 build 通過。證據見 [dependency-refresh.json](releases/v0.5.0/dependency-refresh.json)。

- [x] **WORK-BACKUP-INTEGRITY** — 瀏覽器重新編號時備份漏掉新紀錄還說成功(PR #18;2026-11-01 重做)
- 讀先:`docs/architecture/backup-integrity.md`、`store-schema.md`(Archive versions)、`same-visit-across-sources.md`;`docs/features/archive.md`。
- 原因:下一次備份只讀 `visits.id > 上次讀到的`、`UNIQUE(profile, source_visit_id)` 加 `INSERT OR IGNORE`、URL 用瀏覽器的列號找。Chrome 清除全部紀錄或重建檔案後從 1 重新編號,Firefox 把刪掉的最新列號給下一筆,Chrome 的下載編號 max+1:新紀錄全掉,run 照樣 `success`。行為對照 Chromium / Firefox 原始碼,並在一份真實 Chrome 歷史的副本上數過(只數筆數)。
Expand Down
Loading
Loading