mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
refactor: move leaf utilities under internal/ (#650)
Phase 1: the packages with no project dependencies move first, so every later phase builds on finished leaves; the goldens pin the behavior.
This commit is contained in:
1 parent
fb86bd368e
commit
9937dbf9fb
54 files changed
+319
-335
No files matched your search
@@ -33,6 +33,7 @@ Internal Go names are free to change; anything the user can see — commands, fl
|
||||
| `app` stages and values | `Validate`, `Discover`, `NewPlan`, `Execute`, `Report`; `Request`, `Discovery`, `Plan`, `Extraction`, `Summary`. |
|
||||
| `snapshot.Dir` / `snapshot.Snapshot` | A snapshot directory and one user data dir's snapshot inside it, a snapshot being one user data dir's copy as in Chromium; not `FS`, `Tree`, or `Copy`. |
|
||||
| `winapi`, `abe`; `log` and `crypto` kept | Windows-only packages; not `platform/windows`. |
|
||||
| `timeconv` and `sqlitex` functions | `timeconv.Chromium`, `UnixMicro`, `UnixMilli`, `Unix`, `CoreData`, each named for the encoding it reads; `sqlitex` exports `CountRows` and `QueryRows` only. |
|
||||
| CLI names unchanged | `-c/--category` selects `category.Category` values; `-p/--profile-path` and `dumpkeys` stay. [RFC-009](009-cli-surface.md). |
|
||||
|
||||
## Item-by-item detail
|
||||
@@ -229,6 +230,12 @@ A category says what kind of data is meant; a record is one row of that data. Th
|
||||
| `keychain.Login` | collides with `record.Login`, a saved login. |
|
||||
| `masterkey.Keychain` | `masterkey` holds Chromium keys; Safari's saved logins are not keys. |
|
||||
|
||||
### 9. Leaf helpers — `timeconv` and `sqlitex`
|
||||
|
||||
**`timeconv`: one function per stored encoding, named for what the caller holds.** `Chromium` reads `base::Time`, microseconds since 1601; `CoreData` reads `CFAbsoluteTime`, seconds since 2001; `UnixMicro`, `UnixMilli`, and `Unix` read the three Unix units Firefox stores, named after the `time` functions they wrap. Not `WebKit`: in this tool WebKit is Safari's engine, and Safari's timestamps are Core Data's.
|
||||
|
||||
**`sqlitex` exports `CountRows` and `QueryRows` only.** The row-callback helper behind them, today's `sqliteutil.QuerySQLite`, has no other caller, and as an export it would read `sqlitex.QuerySQLite`.
|
||||
|
||||
## Summary table
|
||||
|
||||
| Concept | Decision | Rejected |
|
||||
@@ -248,5 +255,6 @@ A category says what kind of data is meant; a record is one row of that data. Th
|
||||
| Unit of work | `app.Extraction{DirID, Profile, Category}` | `Job`, `Task`, `Target`, `Unit` |
|
||||
| Snapshot | `snapshot.Dir` + `snapshot.Snapshot`, returned by `Dir.Snapshot(dirID)` | `snapshot.FS`, `snapshot.Tree`, `snapshot.Copy`, `snapshot.Files`, `Dir.CopyOf`, `type Dir string` |
|
||||
| Windows packages | `winapi`, `abe` | `platform/windows` |
|
||||
| Leaf helpers | `timeconv.Chromium`…`CoreData`; `sqlitex.CountRows`, `QueryRows` | `timeconv.WebKit`, an exported `sqlitex.QuerySQLite` |
|
||||
|
||||
The only cross-row couplings: the `category` package and the bare record names are one decision, and the flat `Browser`/`Profile` source replaces every mention of `Origin`.
|
||||
@@ -31,7 +31,7 @@ These guard the contract; a failure means the rewrite changed something users ca
|
||||
|
||||
Export and extractor tests compare against checked-in golden outputs. Deterministic ordering is what makes goldens stable — without it, goldens would flap. A `-update` flag regenerates them on intentional changes. Goldens double as documentation of the exact output shape, useful for the README and for talks.
|
||||
|
||||
The compatibility goldens — the flag sets, every output format, `keys.json`, and the archive layout — live in the repository-root `testdata/` and are read by the tests in `cmd/hack-browser-data`, the one package that never moves, so every phase compares its output against the same files. A golden holds what no other golden already implies: the Cookie-Editor golden holds only `cookie.json`, because every other category is asserted to match the json output byte for byte, and `restore` is asserted to match the extract output except for its `browser` stamp.
|
||||
The compatibility goldens — the flag sets, every output format, `keys.json`, and the archive layout — live in the repository-root `testdata/` and are read by the tests in `cmd/hack-browser-data`, the one package that never moves, so every phase compares its output against the same files. After the switch-over, Phase 8 moves each test and its goldens into the package it covers ([RFC-012](012-migration-roadmap.md)). A golden holds what no other golden already implies: the Cookie-Editor golden holds only `cookie.json`, because every other category is asserted to match the json output byte for byte, and `restore` is asserted to match the extract output except for its `browser` stamp.
|
||||
|
||||
## Regression tests for the known bugs
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ Leaves first, bottom-up along the dependency arrows ([RFC-002](002-package-layou
|
||||
### Phase 8 — Delete & document
|
||||
|
||||
- Remove the superseded top-level packages — `browser/`, `crypto/` except the ABE unit's `crypto/windows/`, `filemanager/`, `log/`, `masterkey/`, `output/`, `types/`, and `utils/` except `utils/injector` — once nothing references them.
|
||||
- Move the compatibility tests out of `cmd/hack-browser-data` into the packages they cover — the export goldens into `export`, `keys.json` into `masterkey`, the archive into `snapshot`, the extract goldens into `browser/chromium`, and `restore` into `app` — each with its goldens in its own `testdata/`; `cmd` keeps only the flag-surface test, and the root `testdata/` goes away.
|
||||
- Update CLAUDE.md (the new paths), the README (Safari, the `cookie-editor` behavior), and the root help text.
|
||||
- Bring the RFCs to their finished state: the format and technique RFCs (013–021) move from today's type names — `BrowserConfig`, `WindowsABE`, `winutil.Table`, `Hints`, the `Retrievers` struct — to the names in [RFC-004](004-naming-decisions.md); the design RFCs describe the code as it is instead of comparing it with today's; and this roadmap is removed.
|
||||
- Final `go mod tidy` under go@1.20; confirm the `go` directive is still `1.20` and `otiai10/copy` and `mint` are gone.
|
||||
|
||||
Reference in new issue
Block a user