You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(storage): move target_data source of truth from SQLite to filesystem (#677)
* feat(storage): move target_data source of truth from SQLite to filesystem
The target_data table stored complete output JSON arrays as TEXT blobs,
causing 1GB+ databases for content-heavy workflows. The same data was
already written to agent_io/target/ on every call — the DB copy was
redundant.
This change makes the filesystem the source of truth:
- write_target writes data to filesystem, stores only metadata in DB
- _read_target_raw reads from filesystem instead of DB
- preview_target reads from filesystem
- --fresh now cleans up target JSON files alongside DB rows
- data_scanners and smoke tests read from filesystem
The DB data column now contains "[]" (satisfies NOT NULL, eliminates
blob storage). No schema migration needed.
* clean: remove TOCTOU is_file checks, unused import
- Remove is_file() pre-checks before read_text() in _read_target_raw,
preview_target, and data_scanners — handle errors directly
- Remove unused ensure_directory_exists import from writer.py
* fix: address review — path containment, fail-loud on missing target_dir, dead code
- Add assert_path_contained in write_target and _read_target_raw to
prevent path traversal via absolute relative_path
- Fail loudly (ValueError) in write_target when target_dir is None
instead of silently skipping the filesystem write
- Change preview_target target_dir=None from continue to break
- Remove 18 dead Path(tmpdir) expressions in integration tests
- Add comment explaining intentional double-write in FileWriter
- Add target_dir to test_delete_target.py fixtures
* clean: fail-fast on missing target_dir in preview_target
Replace silent break with early ValueError, matching write_target
and _read_target_raw. Remove now-unreachable None check in loop.
* fix: eliminate double filesystem write, fix --fresh nested path cleanup
- Remove redundant atomic_json_write from FileWriter — backend now owns
the filesystem write exclusively. Byte count computed from serialized
data instead of stat.
- Change --fresh cleanup from glob("*.json") to rglob("*.json") with
batch/ exclusion, so nested target files are properly cleaned.
- Align test output_directory with backend's target_dir/action so
file_path and backend write path are always consistent.
0 commit comments