beads/internal/types
Dmitry Verkhoturov ed915036c9
fix: backward-compatible JSONL import for all pre-v1.0 formats (#3021)
* fix: backward-compatible JSONL import for all pre-v1.0 formats

Three breaking changes accumulated across versions that prevent
importing old JSONL data:

1. Comment.ID changed from int64 to string in v1.0 — old JSONL
   with numeric comment IDs crashes the importer. Add custom
   UnmarshalJSON that accepts both types.

2. "wisp" field renamed to "ephemeral" in v0.38 — JSONL from
   v0.35–v0.37 silently loses the ephemeral flag. Map the old
   field name during import.

3. BondRef.proto_id renamed to source_id — old JSONL silently
   loses bond source references. Accept proto_id as alias.

Also improve auto-import error messaging: when upgrade recovery
fails, tell the user their data is safe and suggest bd init
--from-jsonl instead of silently swallowing the error.

* fix: use American English spelling for misspell linter

* test: add unit tests for backward-compatible UnmarshalJSON and legacy import

- TestCommentUnmarshalJSON: string IDs, numeric IDs (pre-v1.0),
  zero, large numbers, missing ID, invalid JSON
- TestBondRefUnmarshalJSON: source_id, proto_id (legacy),
  both fields (precedence), neither, invalid JSON
- TestImportFromLocalJSONL_LegacyFormats: numeric comment IDs
  survive import, wisp→ephemeral mapping (true/false/absent)
2026-04-04 22:34:12 -07:00
..
explain_test.go tests: add coverage for explain logic, cycle detection, and engine warnings 2026-03-30 09:15:52 -07:00
id_generator.go refactor: consolidate ExtractPrefix into types package 2026-03-02 23:17:14 -08:00
id_generator_test.go style: run gofmt across entire codebase (bd-nmk12) 2026-02-07 19:35:20 -08:00
orphans.go chore: clean up stale SQLite references in comments (bd-nlw2m) 2026-02-18 11:50:52 -08:00
storage_ext.go refactor(rpc): fix leaky abstraction - remove direct sqlite imports (bd-oslm) 2026-01-26 20:28:27 -08:00
types.go fix: backward-compatible JSONL import for all pre-v1.0 formats (#3021) 2026-04-04 22:34:12 -07:00
types_test.go fix: backward-compatible JSONL import for all pre-v1.0 formats (#3021) 2026-04-04 22:34:12 -07:00