Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dc6c4ab
refactor(file-types): introduce branded FilePathSchema
EurFelux Jul 4, 2026
626cedc
refactor(file-types): unify FilePath as Zod-branded canonical path
EurFelux Jul 4, 2026
738c6d3
refactor(file): add filepath-brand/no-as-filepath lint guard
EurFelux Jul 4, 2026
576f9c4
docs(file): sync path-type docs to the unified FilePath brand
EurFelux Jul 4, 2026
d561643
refactor(file): guard ArtifactPane render parse and tighten findByExt…
EurFelux Jul 4, 2026
cfb38fb
refactor(file): keep FileHandle schema/type-wiring TODO
EurFelux Jul 4, 2026
fad407b
refactor(file-types): make FilePath shape-only, add CanonicalFilePath…
EurFelux Jul 4, 2026
b2f614e
fix(composer): isolate and guard non-absolute attachment path parse
EurFelux Jul 5, 2026
ada6f60
refactor(file): log renderer FilePath safeParse failures
EurFelux Jul 5, 2026
71a3b69
refactor(file): fix stale path-type docs and harden externalPath/path…
EurFelux Jul 5, 2026
17b5012
docs(file): store externalPath byte-faithful; reject NFC-normalizatio…
EurFelux Jul 5, 2026
b70bcbf
fix(file): store externalPath byte-faithful (drop NFC normalization)
EurFelux Jul 5, 2026
dbba1e5
refactor(file): allow ensureExternalEntry to create dangling entries
EurFelux Jul 5, 2026
0214a9f
docs(file): sync stale path-type references to explicit canonicalizeF…
EurFelux Jul 5, 2026
d8fa092
refactor(file-types): derive CanonicalFilePath from a Zod schema; pri…
EurFelux Jul 5, 2026
32215e6
chore(eslint): extend no-as-filepath guard to CanonicalFilePath
EurFelux Jul 5, 2026
6b11061
fix(composer): align attachment-build failure with upstream abort-on-…
EurFelux Jul 5, 2026
8b89821
Merge remote-tracking branch 'origin/main' into
EurFelux Jul 6, 2026
d3f40d4
fix(shared): type-safe dirnameSimple with FilePath output
EurFelux Jul 6, 2026
d06b17e
refactor(file): validate FilePath at DirectoryWatcher chokidar boundary
EurFelux Jul 6, 2026
383bf00
Merge branch 'main' into eurfelux/refactor/file-type
EurFelux Jul 6, 2026
30ecd56
Merge remote-tracking branch 'origin/main' into eurfelux/refactor/fil…
EurFelux Jul 7, 2026
1c1d8d4
docs: add todo comment for Base64String and UrlString
EurFelux Jul 7, 2026
a2335bf
chore(file-types): clean up merge-conflict residue
EurFelux Jul 8, 2026
1d52966
Merge remote-tracking branch 'origin/main' into eurfelux/refactor/fil…
EurFelux Jul 8, 2026
59301a7
chore(lint): remove watcher exemption from no-as-filepath rule
EurFelux Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/references/file/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Pure FS primitives (src/main/utils/file/) — shared raw FS primitives, open to
│ atomic write: atomicWriteFile / atomicWriteIfUnchanged / createAtomicWriteStream
│ version: statVersion / contentHash (xxhash-h64)
├── shell.ts — system ops: open / showInFolder
├── path.ts — path utils: resolvePath / isPathInside / canWrite / isNotEmptyDir / canonicalizeExternalPath
├── path.ts — path utils: resolvePath / isPathInside / canWrite / isNotEmptyDir
├── metadata.ts — type detection: getFileType / isTextFile / mimeToExt
├── search.ts — directory search: listDirectory (ripgrep + fuzzy matching)
├── legacyFile.ts — shared legacy helpers (`getFileType(ext)` / `sanitizeFilename` / `getAllFiles` / `pathExists` / …); planned to be split into the modules above over time
Expand Down Expand Up @@ -299,7 +299,7 @@ All operations that can act on any file (FileEntry or arbitrary path) **accept a
| Method | Description |
|---|---|
| `createInternalEntry` / `batchCreateInternalEntries` | Create a new Cherry-owned FileEntry (writes to `{userData}/Data/Files/{id}.{ext}`; each call produces an independent new entry, no conflict possible) |
| `ensureExternalEntry` / `batchEnsureExternalEntries` | Pure upsert by `externalPath`—the entry point first `canonicalizeExternalPath(raw)` normalizes it (see `pathResolver.ts`); reuses the existing entry with the same path or inserts a new one. Idempotent by design—callers may safely repeat calls. No "restore" branch: external entries cannot be trashed. External rows carry no stored `size` (always `null`); live values come from `getMetadata`. |
| `ensureExternalEntry` / `batchEnsureExternalEntries` | Pure upsert by `externalPath`—the entry point first validates the path shape via `FilePathSchema` (shape-only, no rewrite), then `ensureExternalEntry` canonicalizes it to the byte-faithful lexical form via the `canonicalizeFilePath()` factory (see `canonicalize.ts`) before matching; reuses the existing entry with the same path or inserts a new one. Idempotent by design—callers may safely repeat calls. No "restore" branch: external entries cannot be trashed. External rows carry no stored `size` (always `null`); live values come from `getMetadata`. |
| `trash` / `restore` | Soft delete based on deletedAt (DB only). **Internal-origin only** — external-origin entries cannot be trashed (`fe_external_no_delete` CHECK); passing an external id throws. |
| `batchTrash` / `batchRestore` | Batch versions of `trash` / `restore` — same internal-origin-only rule. |
| `batchPermanentDelete` | Batch version of `permanentDelete`. |
Expand Down Expand Up @@ -663,7 +663,7 @@ The File IPC adapter is a transport/dispatch layer. It may depend on FileManager
| services/file/utils/* (file-module path/API helpers) |
| |
| Role: higher-level path-arm helpers with file-module semantics |
| Examples: resolvePhysicalPath, canonicalizeExternalPath, getMetadataByPath |
| Examples: resolvePhysicalPath, getMetadataByPath |
| FS: may delegate to @main/utils/file/*; no DB lifecycle ownership |
+-------------------------------------------------------------------------+
| DanglingCache (file_module singleton, not lifecycle) |
Expand Down
2 changes: 1 addition & 1 deletion docs/references/file/directory-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ The `file:tree:*` prefix places these alongside `File_Open` / `File_Read` / etc.

### 4.2 Validation

Both `File_TreeCreate` and `File_TreeDispose` validate their payloads through Zod at the handler boundary. `rootPath` must satisfy `AbsolutePathSchema` (non-empty, no null bytes, starts with `/` or `[A-Z]:\`). `options` is validated against `DirectoryTreeOptionsSchema` — the same schema whose `z.infer` produces the `DirectoryTreeOptions` TypeScript type, so wire shape and static type cannot drift.
Both `File_TreeCreate` and `File_TreeDispose` validate their payloads through Zod at the handler boundary. `rootPath` must satisfy `FilePathSchema` (non-empty, no null bytes, starts with `/` or `[A-Z]:\`). `options` is validated against `DirectoryTreeOptionsSchema` — the same schema whose `z.infer` produces the `DirectoryTreeOptions` TypeScript type, so wire shape and static type cannot drift.

A malformed payload rejects with a `ZodError` Promise rejection at the IPC boundary; the renderer's `invoke()` rejects with the same error. There is no silent narrowing — handlers never see an unvalidated object.

Expand Down
Loading
Loading