6 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 c667a0b4c9 chore(i18n): store listings, translation form and harness for zh-CN and ro
- store/listing.zh_CN.md and store/listing.ro.md (best-effort, marked
  TODO(review-zh) / TODO(review-ro)); every listing and the README now
  name all five languages.
- The translation issue form offers 简体中文 and Română; CONTRIBUTING
  explains the plural forms and the comma-below rule, and points at
  docs/07 §6.
- scripts/screenshots.mjs photographs every locale, and the popup per
  theme and language.
- tests/unit/i18n/touch-points.test.ts holds the files that cannot import
  LOCALES (harness, check-manifest, the form, the listings) to the list;
  the cedilla scan covers the Romanian listing too.
- Comments that said "three locales" or "VI/JA" now say what they mean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:31:50 +07:00
poli0981andClaude Opus 5.5 9dd6dc317f fix(import): a Replace backup that matches what it deletes, the right roots, and depth Chrome can keep
From the v1.1.0 adversarial review (data integrity):

- Replace re-reads the tree once the backup is on disk. If anything changed
  while the save dialog was open (or while the user checked Downloads on the
  fallback path), the picker path writes the fresh snapshot to the same file
  and checks again (up to 3 times); the fallback path stops with BACKUP_STALE.
  Before, a bookmark added meanwhile inside an existing folder was deleted with
  no copy anywhere.
- Roots resolve by folderType among this device's roots; a signed-in account's
  own roots (Chrome 134+, syncing) are never emptied or written. Replace backs
  up and clears exactly the three destinations.
- An empty Mobile root, which desktop Chrome leaves out of getTree, is found
  with bookmarks.get('3'), so Mobile content stops landing under Other. The
  fake now hides it the same way.
- Plans report writeDepth; past MAX_WRITE_DEPTH (90) the import is refused with
  TOO_DEEP before any backup — Chrome re-reads its own bookmarks file with a
  200-level JSON nesting limit, two levels per folder.
- The suggested backup name carries seconds, and a picked file that never
  received a backup is removed again.
- Edit tab: a stale "created" event for an id the view already holds is
  dropped, and the duplicate finder never pairs a node with itself — together
  they made "Keep first" delete the only copy. Sort re-plans from the folder's
  children at confirm time.
- Netscape: an unescaped <h3> inside a bookmark title no longer turns the
  bookmark into an empty folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 03:22:56 +07:00
poli0981andClaude Opus 5.5 db4b720936 feat(diagnostics): a local log to copy into bug reports, and one writer across tabs
- browser/diagnostics.ts: an in-memory ring buffer of 200 allowlisted events —
  import phases, failure codes (logged where every failure is described, by
  code, never by detail text), bulk edits, storage read failures, uncaught
  errors by name only. Page-relative times, no storage, no network. About →
  "Copy diagnostics" copies it with the version, locale, theme and Chrome major.
- browser/write-lock.ts: Web Locks, ifAvailable — a second Manager tab trying
  to import, sort or delete duplicates while another writes is refused at once
  with WRITE_LOCKED, before anything is touched. The import takes the lock after
  opening the save picker, so the click's activation still holds.
- The settings store reads the UI language through browser/ (uM15); progress
  reports the first create, so a slow start no longer looks like a hang (uL9).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 03:22:56 +07:00
poli0981andClaude Opus 5.5 bb2b175551 feat(import): Chrome and Firefox bookmark files, a Merge that merges, restores that do not nest
Import Chrome's profile `Bookmarks` file and Firefox's JSON backup directly.
Each reader is held to a parity rule against its browser's own HTML exporter,
tested on Chromium/Firefox-faithful fixture pairs. One entry point,
parseBookmarkFile, sniffs by content (JSON first, parsed exactly once, routed
by shape); the picker loses its extension filter, which hid the extensionless
`Bookmarks` file. Firefox's internal root names are localized by the caller.

Merge finally reuses the folders a user already has, level by level, appending
new items (core/merge.ts) - 1.0.x planned it exactly like Replace. Root folders
are unwrapped by marker (core/route.ts), so restoring a backup no longer nests
Other and Mobile one level deeper each time, 1.0.x backups included. Replace
never dedupes, plans before the backup is taken, and refuses a backup the
import could not read back (BACKUP_EXCEEDS_LIMITS) before anything is written,
downloaded or deleted. The save dialog's late rejection is marked handled.

Also found: the seeded round-trip suite had compared 200 empty trees since
Phase 1 (xorshift32 seeded with 1-200 draws near zero first). makeRng now
scrambles the seed and every seeded suite checks its corpus is non-trivial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 03:22:56 +07:00
poli0981andClaude Opus 5 d8bbd4ca79 fix(import): never lose the count, and close the Back-button deadlock
Three defects on the paths that touch a user's real bookmarks.

**A mid-import rejection used to lose everything needed to recover.**
writeTree awaited create() and let a rejection propagate bare — while the
bookmarks it had already written sat in the user's tree, uncounted. The
neighbouring BmAborted has always carried `done` for exactly this reason.
clearRoots was worse: it is the one path that deletes, and it reported nothing
at all, plus threw BmAborted(0) on cancellation regardless of how many root
children were already gone. Both now throw BmPartialWrite{phase, done}, and the
error state carries the safety backup's filename — which `attesting` knew and
`error` threw away, so the one string that lets someone restore a half-replaced
tree was the one thing not on screen. Only when a backup was actually produced:
on a BmBackupError the file may never have been written, and sending a
frightened user to look for a backup that does not exist is worse than silence.

BmAborted is re-thrown before the wrap, with a test pinning it. Wrapping it
would relabel every user cancellation as a failure and make the `cancelled`
state — and its copy in three languages — unreachable.

**Browser Back during the backup attestation deadlocked the Manager
permanently.** The attestation resolver was a component-local `let`, so Back
unmounted ImportTab, stranded the promise runImport was awaiting, and left
isWriting() true forever: every tab and footer control disabled, beforeunload
prompting, and a remounted tab rendering two inert buttons against a fresh empty
resolver. Closing the tab was the only escape. Phase 4 closed this same hole for
the footer and the tab bar; hashchange was the door left open.

Two independent fixes, because one is not enough: startRouting now takes an
injected isBlocked predicate (injected, not imported, so route stays uncoupled
from the import session), and the resolver moved into the store where it
outlives any component. A stale or reset resolver settles **false** — an
unanswered attestation is not consent, and this is the last gate before deleting
every bookmark someone has. The restore-the-hash path has an explicit test for
not recursing; an infinite hashchange loop in a released extension, on the path
a panicking user takes, is not a defect worth discovering from a review.

**Nothing told users their imported bookmarks are re-dated to today.** docs/05
§6 instructs saying so in the import report and docs/00 §8 repeats it as a
success criterion; no string ever did. The README and store listing say it to
prospective users, and the product never said it to actual ones — so someone
migrating a decade-old archive finds every bookmark dated today with no
explanation and no way to tell it from corruption. Now shown before the import
as well as after: telling someone before they commit is worth more.

Also: a profile whose every root is policy-managed now reports
NO_WRITABLE_ROOTS rather than "the browser refused a bookmark operation". The
browser refused nothing; it is an absence, not a refusal, and the old wording
sent people looking for a permission problem that was not there.

describeError moves out of ImportTab into browser/describe-error.ts so #edit and
#export can share it next, with tests asserting the two properties that have
been defects before: it returns a key rather than a resolved sentence, and it
omits `detail` rather than setting it to undefined.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 20:20:05 +07:00
poli0981andClaude Opus 5 f54af08980 feat(import): browser layer, stores and the #import flow (Phase 2)
Adds src/lib/browser/ (bookmarks adapter, write queue, storage, download,
open-manager), the runes stores, hash routing, the Manager shell, and the full
#import pipeline per docs/03 §1. 248 tests, npm run verify green, manifest
still exactly ["bookmarks", "storage"].

The write queue is spec-complete: DFS order, one shared done/total across
segments, progress every 50, abort that stops before the next create, and a
periodic event-loop yield whose parentheses are pinned by their own test
(the unparenthesised form never yields on either side of Chrome 129).

An adversarial review pass found 13 defects, all fixed here with regression
tests. Three were in the path that deletes bookmarks:

- The anchor-download backup fallback was treated as success. It reports
  nothing at all, so Replace could delete every bookmark a user owns with no
  file on disk — if they cancelled the save dialog, or the disk was full.
  docs/03 §1 step 6b.3 requires a blocking confirmation there; it existed in
  the spec and nowhere in the code. Now an `attesting` state gates deletion,
  and anything short of an explicit confirmation aborts the import.
- The backup was serialized from the PREVIEW-time snapshot while the deletion
  used a fresh read, so anything bookmarked between preview and Start was
  destroyed and absent from the backup. The live tree is now read once and the
  same nodes are both serialized and deleted, making the backup provably a
  superset of what is removed.
- toBookmarkNodes never emitted `toolbar: true`, so restoring a backup nested
  the entire Bookmarks Bar under Other Bookmarks — import routes purely on
  that flag.

Also: showSaveFilePicker was called after an await, losing transient
activation on exactly the largest profiles (the picker is now opened as the
first statement, before the tree read — only the handle is activation-gated);
clearRoots ignored the AbortSignal while the UI showed a live Cancel, so
cancelling mid-delete wiped the tree and reported "0 items created" (now a
non-cancellable `clearing` state plus a per-node signal check); the parsed
file lived in component-local state and was lost on any route change, leaving
a dead Import button; in-app navigation had no mid-write guard, since
beforeunload only covers tab close; and the preview badges were hardcoded
English.

docs/03 §1 6b and §5 are rewritten to match — the previous step ordering was
itself unsafe.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 06:13:53 +07:00