Files
relicario/docs/test-checklists/extension-import.md
2026-11-10 18:20:36 -05:00

138 lines
8.0 KiB
Markdown

# Extension → Import: LastPass CSV manual runbook
This is the live-browser runbook for the vault tab's **Import → LastPass CSV**
flow. It complements the automated suites. The automated suites are fast and
broad, but they cannot prove the real WASM module, the real Chrome message
channel, and a real git host all line up. This checklist covers that gap.
**Scope:** the vault-tab import panel and the SW commit path. It does not cover
CLI import (see `cargo test -p relicario-cli --test import_lastpass`) or org
vaults.
## What the automated tests do, and why they are not enough
- The Rust fixture suite at `crates/relicario-core/tests/import_lastpass_fixtures.rs`
is the **parser oracle**. It loads every committed fixture plus
`tests/fixtures/lastpass/expected.json` and asserts the fatal/error outcome,
login count, note count, and warning rows. If the parser and the oracle
disagree, that test fails first.
- The extension's vitest suite runs against
`extension/src/__stubs__/relicario_wasm.stub.ts`, a stub that throws on every
real WASM call. Because the stub has no parser, the extension fixture tests
**mock `parse_lastpass_csv` per fixture** and then exercise the commit path
with a faked git host. That proves the wiring, not the real end-to-end
pipeline.
- Only a live browser can show the real WASM parser, the real
`chrome.runtime` transport, the real panel DOM, and a real git host agreeing
on the same bytes. Hence this runbook.
## Expected outcomes per fixture
Outcomes below come from `tests/fixtures/lastpass/expected.json`. Do not edit
them here; if the fixture or the parser changes, update the oracle and this
table together.
| Fixture | Expected outcome |
|---|---|
| `01-basic.csv` | Import ok. 9 logins, 2 notes. No warnings. Covers quoting, embedded newlines, unicode/emoji, nested group, favorite, TOTP, duplicate titles, padded title, long password. |
| `02-warnings.csv` | Import ok. 5 logins, 1 note. Warning rows 1, 2, 3, 4, 5, 8. Mixed per-row problems including a ragged row; import continues past each. |
| `03-bom.csv` | Import ok. 2 logins, 1 note. No warnings. UTF-8 BOM before the header is stripped. |
| `04-legacy-7col.csv` | Import ok. 1 login, 1 note. No warnings. Pre-TOTP 7-column header is mapped by name (`url,username,password,extra,name,grouping,fav`). |
| `05-wrong-format.csv` | Fatal header error. 0 items written. Panel shows the expected columns vs the found columns. Import never becomes enabled. |
| `06-header-only.csv` | Import ok. 0 items. Panel shows exactly `This CSV file contains no importable items.` Import stays disabled. |
| `07-crlf.csv` | Import ok. 2 logins, 1 note. No warnings. Windows CRLF line endings, including CRLF inside quoted fields. |
| `08-latin1.csv` | Import ok. 2 logins, 0 notes. Warning row 2: the non-UTF-8 row is skipped with a warning; the rest import. |
| `09-notetypes.csv` | Import ok. 0 logins, 4 notes. No warnings. LastPass `NoteType` notes stay raw secure notes (lossless; no typed mapping). |
| `10-hostile.csv` | Import ok. 6 logins, 1 note. Warning rows 2, 3: unsafe URL schemes (`javascript:`, `data:`, etc.) are dropped and the logins import **without** a URL. Hostile titles/groups/notes render as inert text. |
| `large-3000.csv` (gitignored stress file) | 3000 items import with visible progress. ~1.02 git-host writes per item (~3060 writes total, including 60 manifest checkpoints). No hang. Completes in well under a minute. |
| `huge-note-2mb.csv` (gitignored stress file) | One ~2 MB note imports, or fails with a clear message. No hang, no silent truncation. |
Generate the two gitignored stress files before using this runbook:
```bash
python3 tools/lastpass-fixtures/gen.py --large 3000
python3 tools/lastpass-fixtures/gen.py --huge-note 2
```
## Keyboard-only checklist
Run this with the mouse unplugged or untouched. Every step must be reachable
with Tab / Shift+Tab, Enter, and Space.
- [ ] Tab order from the top of the import panel is: file picker → Import →
warnings list (when present) → Done. No element is skipped and nothing
traps focus.
- [ ] The file picker has an associated `<label for="lp-file">Choose LastPass
CSV file</label>`, so a screen reader announces the control name. Pressing
Enter or Space on the label opens the OS file dialog.
- [ ] After a parse, focus stays in a sensible place, and the Import button is
reachable by Tab. Import is disabled for `05-wrong-format.csv` and
`06-header-only.csv`, so Tab skips it and it cannot be activated.
- [ ] The progress block is a `role="status"` live region with
`aria-live="polite"`. During a `large-3000.csv` run it announces rising
counts ("Importing N of 3000…") without stealing focus.
- [ ] `aria-busy` flips to `true` during commit and back to `false` afterward.
- [ ] Warnings render in a scrollable list. With 3000 warnings the list is
capped (first 200 plus "…and N more") and announces the total, and the
page does not freeze.
- [ ] After success, Tab reaches Done, Enter activates it, and the panel resets
to idle with the file input cleared.
- [ ] No focus trap: Shift+Tab from the first control and Tab from the last both
leave the panel normally.
## Live-browser steps (manual gate)
Use a **throwaway** vault repo. Never run this against a real vault.
1. **Create or open a throwaway vault.** Create an empty git repo (local or on a
test Gitea/GitHub host), then create a vault in the extension against it.
Unlock it and open the fullscreen vault tab.
2. **Import `01-basic.csv`.** Open Import, choose the fixture, confirm the
preview shows 9 logins and 2 notes with no warnings, then Import.
- [ ] The progress text advances and ends at "Imported 9 of 9."
- [ ] The new items appear in the list and the sidebar counts update **without
a page reload**.
- [ ] Done is enabled; pressing it returns the panel to idle and clears the
file picker (re-picking the same file re-triggers the change event).
3. **Import `02-warnings.csv`.** Confirm the preview shows 5 logins and 1 note,
then Import.
- [ ] The warnings list shows rows 1, 2, 3, 4, 5, and 8.
- [ ] The 5 logins and 1 note appear in the vault.
4. **Import `10-hostile.csv`.** Confirm 6 logins and 1 note in the preview.
- [ ] Warnings name rows 2 and 3 (unsafe URL schemes).
- [ ] The two affected logins exist **without** a URL field, not with a
`javascript:`/`data:` URL.
- [ ] Hostile titles, group names, and note bodies appear as literal text in
the preview, the warnings, and the item list. No markup executes and no
dialog or script fires.
5. **Import `large-3000.csv`.** Watch the progress region.
- [ ] Progress announces rising counts and completes at 3000 of 3000.
- [ ] No hang, no spinner forever, no page freeze.
- [ ] The item list and sidebar reflect the imports without a reload.
- [ ] The import finishes in well under a minute.
6. **Interrupt an import mid-way.** Restart with `large-3000.csv`, then kill it
partway through (close the tab mid-commit, or stop the SW from the extensions
page). Then reopen the vault.
- [ ] The manifest is consistent: every item visible in the list is also
present as a blob, and no list entry points at a missing blob.
- [ ] No orphan items are visible. Uncommitted item blobs from after the last
checkpoint are cleaned up and are not referenced by the restored
manifest.
- [ ] No durable (checkpointed) blob was deleted. Items up to the last
checkpoint survive.
7. **Read back with the CLI.** In the same repo, run:
```bash
RELICARIO_IMAGE=/path/to/reference.jpg relicario list
```
- [ ] `relicario list` shows exactly the items that survived in the extension,
matching what the UI shows. No phantom entries, no missing items.
## Recording results
For each run, note the extension commit, the browser and version, the host type
(Gitea/GitHub), the fixture name, pass/fail, and any warning text that differed
from the table. File the notes with the release checklist for the branch under
test.