The stored name is "<attachment_id>_<filename>", so a valid 240-byte filename
exceeded the 255-byte component limit and put() raised ENAMETOOLONG. Trim the
stem by bytes, keeping a short extension, so saving and lookup stay consistent.
Apply Unicode casefolding to filename and query instead of relying on SQLite LIKE ASCII-only folding. Preserve literal wildcard escaping, soft-deletion filtering and result ordering.
AI-assisted: implemented and validated with OpenAI Codex; actual SQLite stores and isolated API fixtures.
Translate only an actual active-SHA uniqueness conflict into a safe 409 response. Preserve both records and their bytes so restoring the earlier entry can be retried after deleting the replacement; unrelated database failures still propagate.
AI-assisted: implemented and validated with OpenAI Codex; isolated API and real SQLite constraints, no user workspace writes.
search_files promises case-insensitive substring matching, but _search_files_sync
interpolated the query into a LIKE pattern without escaping. SQLite LIKE treats
'_' as any single character and '%' as any run, so a query like 'report_v1'
matched 'reportXv1.pdf' too — filenames commonly contain '_', so the false
positives are routine. Escape the query's LIKE metacharacters and add ESCAPE.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Ship the reading, listening, question-bank, parsing, and provider updates
summarized in assets/releases/ver1-6-13.md.
Make speech timeouts configurable, report actionable synthesis failures,
and keep chat attachments discoverable in their selected workspace while
preserving earlier uploads and URLs. Keep reply playback cancellation and
single-audio ownership intact.
Sync README prose and all eleven translations, update the stable install
note, and archive release notes older than one week. Repair stale reading
test fixtures and spawned test imports, and clear the Partner type error.
Validation: 9252 Python tests and 8 subtests passed (28 skipped); 518 web
unit tests, 1253 Node tests, and 62 browser audits passed. Pre-commit, ruff,
typecheck, contracts, architecture, i18n, production build, route budgets,
and the docs build passed.
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.
Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
Twenty-two community pull requests and the reports behind them. Where
v1.6.7 chased a token budget spent on hidden thinking, this one answers
a different complaint: I did a thing and the app quietly did nothing.
New surfaces: a recycle bin that makes a deleted chat recoverable,
search across the full text of your conversation history, and
`knowledge_frontier` — a tool that reads a knowledge base and goes
looking for what is not in it.
Fixes worth naming: a reasoning model that stops mid-thought now fails
with the counters that prove it rather than an opaque error; deep book
URLs open the book instead of the library; the reading outline tracks
the page again; an EPUB that macOS re-zipped reads as the book it is; a
file whose extraction produced nothing is listed with the reason instead
of skipped in silence; the launcher stops killing a backend that is
merely still starting.
Also in this commit: README prose plus all eleven translations, the
v1.6.8 release notes with v1.6.5 archived past the one-week line, three
duplicate keys removed from the locale files (`Delete permanently` had
two different zh values, and the wrong one was winning), and the mypy
annotation that made every `conn.execute` in the new file library look
like a call on None.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* feat: Persistent File Library with API router (issue #1437)
FileLibraryStore (deeptutor/services/storage/file_library.py):
- add_file: stores bytes to disk, deduplicates by SHA-256
- get_file: returns entry by id
- delete_file: soft-delete, idempotent
- hard_delete_file: permanent delete (requires prior soft-delete)
- restore_file: clears is_deleted, idempotent
- list_files: active entries, newest-first, paginated
- search_files: case-insensitive filename LIKE search
- resolve_path: returns absolute Path or None
API router (deeptutor/api/routers/file_library.py):
- GET /files/library/ — list files
- POST /files/library/ — multipart upload with SHA-256 deduplication
- GET /files/library/search — filename search
- GET /files/library/{id} — get entry
- GET /files/library/{id}/download — download file bytes
- DELETE /files/library/{id} — soft-delete
- POST /files/library/{id}/restore — restore soft-deleted
25 unit tests + 20 API integration tests, all passing.
* fix: ruff import-sort/unused-import fixes for file library
* fix: scope file library singleton per user, close upload dedup race
- get_file_library_store() was caching the FileLibraryStore under a
hardcoded key ("default") instead of the resolved per-user root, so
in multi-user deployments every user after the first shared one
library (list/get/download/delete/restore all leaked across
accounts). Now resolves get_path_service().get_user_root() on every
call and keys the cache by str(user_root), mirroring
get_attachment_store().
- _add_file_sync's SHA-256 dedup check was a plain SELECT followed by
an INSERT with no synchronization; concurrent uploads of identical
content (double-click, duplicate tabs, client retries) could both
miss the dedup lookup and each create a duplicate row/file. Added a
per-instance lock around the check-then-write-then-insert sequence,
plus a partial unique index on sha256 (active rows only) with
IntegrityError handling as a defense-in-depth backstop for
multi-process deployments.
- Fixed the test fixture in test_file_library_router.py: it patched
file_library._fl.get_file_library_store then reverted the patch
before any request ran, so the mock never actually intercepted
anything; removed the dead code and added tokens/auth_enabled
support for multi-user testing.
- Added regression tests: test_upload_and_list_are_isolated_between_users
and test_add_file_concurrent_uploads_of_same_content_do_not_duplicate,
both verified to fail against the pre-fix code.
- ruff format on the three touched files (pre-existing line-length
debt in code this change touches).