Commit Graph
37 Commits
Author SHA1 Message Date
BFlat 9658558449 Merge pull request #2611 from dotCooCoo/fix/settings-bounded-config-read
craft-settings: read config.toml up to a 16 MiB limit
2026-11-27 14:15:24 +07:00
dotCooCoo 82c484b52d craft-settings: keep the document unchanged when a save fails
The save now merges the settings into a copy of the document and keeps
the copy only after the file is written. Before, a save rejected as too
large, or one whose write failed, had already removed dropped keys from
the document together with their comments, so putting a key back later
wrote it without its comment.
2026-11-25 22:20:44 -08:00
dotCooCoo c94a5f795d craft-settings: expect the dotted key path in the section error test
SectionError::section holds the dotted key path of the value, so an
invalid theme under [appearance] reports [appearance.theme].
2026-11-25 21:06:26 -08:00
dotCooCoo 37c6774c1a Merge main into fix/settings-bounded-config-read 2026-11-25 20:44:51 -08:00
dotCooCoo d2fd6c843c Merge main into feat/settings-section-error-display 2026-11-25 19:13:14 -08:00
Dylan M. Taylor 98d01dfc3f fw-services: resolve the sync of origin/next into pdf-port/gaps
platform (appearance, portal, clipboard, open), settings, host files, dialogs
service, print, i18n date. Settings take upstream's LocalStorageFiles, with
BrowserFiles a deprecated alias (L-313); Windows reduced motion is upstream's
native worker; the port's forced pick answers, write intent, GNOME text scale,
open-for and byte intake stay on upstream's code.
2026-11-22 22:57:38 -05:00
Dylan M. Taylor cb3101725c sync skeleton: origin/next 118f1d2ff9 into pdf-port/gaps ea77c1676f, markers left
257 conflicted files staged with their conflict markers (630 hunks). The one
modify/delete, crates/ui-patterns/src/patterns/preferences/body.rs (deleted
upstream, modified by the port), keeps the port's file for its area to carry
into upstream's preferences/page.rs. Plan: landing/fw-sync-plan.md.
2026-11-22 22:42:09 -05:00
dotCooCoo b0f09a0651 craft-settings: keep an adopted outside edit as the save baseline
When a save adopted a changed config.toml and then failed (settings too
large to write, a backup or write error), the store kept the adopted
document but still compared later reads against the text it had loaded
before. If the outside edit was then undone, the next save skipped the
file on disk and wrote the undone edit's comments and keys back.

The store now records the adopted text as its baseline together with
the document.
2026-11-20 14:40:16 -08:00
dotCooCoo 7648e5db54 craft-settings: do not save settings larger than the read limit
A save rendered the settings and wrote them whatever their size, so a
string setting near 16 MiB produced a config.toml that the next start
refused to read. The save now checks the rendered text against
store::MAX_CONFIG_BYTES before writing and returns SettingsError::Io
with ErrorKind::FileTooLarge when it is larger. The file on disk is not
backed up, moved aside or replaced, and the store keeps the change and
tries again after the retry delay.

The backup and the move-aside of a damaged file now happen after the
size check, so a save that writes nothing also leaves the file alone.
2026-11-20 11:13:27 -08:00
dotCooCoo 4e349df893 craft-settings: read config.toml up to a 16 MiB limit
SettingsStore read config.toml with read_to_string at open, in the
read-only fallback and before every save, so a file of any size was
read into memory whole before parsing.

The store now reads at most store::MAX_CONFIG_BYTES. A larger file is
left untouched: the store opens read-only with Unreadable carrying
ErrorKind::FileTooLarge, and a file that grows past the limit while the
app runs makes the save return SettingsError::ReadOnly.
2026-11-20 10:43:56 -08:00
dotCooCoo 1463b8caea settings: SectionError implements Display and Error
A section that did not fit the settings type is reported in
LoadReport::section_errors, but SectionError had no Display, so an app
could only show it with Debug. It now formats as "settings section
[<name>] was reset to defaults: <message>" and implements
std::error::Error, as MigrateError does.
2026-11-20 10:43:19 -08:00
Martin Ball e93b8c1fea Docs: intra-doc links resolve under -D warnings 2026-11-20 01:33:09 +00:00
Martin Ball f77301a76d Merge follow-up: resolve_in takes Reads; the host-key trial gives states through CommandStates; cargo fmt 2026-11-20 00:40:05 +00:00
Dylan M. Taylor d552111634 rustfmt framework batch 3 2026-11-19 15:48:49 -05:00
Martin Ball 42bcdb68e7 fu-platform: app batch 1 rulings (S-L324, S-L239) 2026-11-18 22:39:34 +00:00
Martin Ball 2bbd01087b platform-w8: net change of 2 commits
- platform-w8: written by an agent
- platform-w8: review fixes (review-1)
2026-11-18 17:25:03 +00:00
Dylan M. Taylor a0e57a9188 pdf-shell-w4: net change of 2 commits
- pdf-shell-w4: written by an agent
- pdf-shell-w4: review fixes (review-1)
2026-11-18 03:15:53 -05:00
Martin Ball b21c69300c Contract stubs: craft-codepage craft-i18n craft-host craft-quit craft-theme craft-keymap craft-behavior craft-settings craft-platform 2026-11-18 08:01:14 +00:00
Dylan M. Taylor 830da93f02 Contract stubs: craft-atomic, craft-font-catalog, craft-i18n, craft-host, craft-quit, craft-settings, craft-theme, craft-web-host 2026-11-17 22:24:02 -05:00
aiongg ac3dfd1f53 Merge storytold main into next (17 Nov sync)
storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.

- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
2026-11-17 12:44:52 +00:00
Dylan M. Taylor 9ac3245966 settings, atomic: give a replaced file's group bits only to its group (#558)
* settings, atomic: give a replaced file's group bits only to its group

write_backup copied the config's mode onto a new backup inode without
giving it the config's group, and craft-atomic's stage() did the same
for every replaced file: on a setgid directory or with another primary
group, the group bits opened the contents to a group never granted
them. Both now chown the new inode to the replaced file's group first
and drop the group bits when that fails.

* address review: skip fchown when the stage already has the replaced file's group

* atomic: route the stage's group change through AtomicFs so the fallback is tested
2026-11-16 09:55:13 -05:00
aiongg 8f1d4731d5 Props: vis option for setters; settings read follows open_with's folder and reports a damaged file; agent link rejects out-of-range ports 2026-11-16 14:10:46 +00:00
aiongg 464ded51f4 merge-fwi: craft-settings: SettingsStore::read, a read-only load on the store's own load path 2026-11-16 13:18:40 +00:00
aiongg 3f44be022e Settings: the legacy file parser has a named type (clippy type_complexity) 2026-11-16 01:39:05 +00:00
aiongg 7fa10c107a craft-settings: reset and repair one value at a time, remove map entries the value drops, merge a missing section against its defaults 2026-11-15 15:21:21 +00:00
aiongg 300852385e top-w19: net change of 2 commits
- top-w19: written by an agent
- top-w19: review fixes (review-1)
2026-11-15 12:06:38 +00:00
aiongg d867ef2446 top-w30: net change of 1 commits
- top-w30: written by an agent
2026-11-15 12:06:38 +00:00
aiongg 0e216b6257 Contract stubs: decision pass 2026-11-14 16:07:24 +00:00
aiongg a17171af48 Lints: drop the workspace missing_docs lint and warn on it in the framework crates that document every public item 2026-11-14 00:15:29 +00:00
aiongg e59460135e Base crates on the framework: theme, behaviour, keymap, platform, window, settings, i18n, fonts 2026-11-12 14:09:48 +00:00
Dylan M. Taylor 269629ee8c Merge pull request #107 from euisuh/fix/settings-permission-test-portability
test(settings): respect effective filesystem permissions
2026-11-02 22:48:25 -05:00
Dylan M. Taylor c64d9b28f4 Merge pull request #145 from midasmatterhorn/fix/r4-settings-blank-file
settings: a blanked config.toml is no longer adopted over the loaded document
2026-11-02 21:41:02 -05:00
Dylan M. Taylor 08109be362 security: validate settings sections against the defaults alone
deserialize_sections tried each top-level key against a document holding every key accepted
before it, cloning and deserializing the growing document per key. A config.toml with many
unknown keys took quadratic time (20k keys: >2 minutes, now <1 s). Each key is now checked
against the defaults plus that key, and accepted keys are merged once.

CodeRabbit CWE-407, crates/settings/src/document.rs:47
2026-10-22 21:42:13 -04:00
midasmatterhorn 65df18d8db settings: a blanked config.toml is no longer adopted over the loaded document
A syntactically broken file keeps the loaded document and is moved aside,
but a blank file parses fine — so check_disk adopted the empty document
before its blankness test ran, and the next save wrote only the known
values: comments and unknown sections loaded at startup were deleted
silently, with no error and no backup (blank text is never written as a
backup either, so on a file's first save the content was unrecoverable).
The crate itself treats blank as untrustworthy for the backup
(recovery.rs: 'a blank or unparsable file must never replace the previous
backup') and the docs promise comments and unknown keys survive saves.

Blank text is now rejected up front, before it can replace the document.
Regression test: an_emptied_file_is_not_adopted_over_the_loaded_document
— fails today (comments and unknown sections missing after the second
save), passes with the early return; the existing backup test keeps
passing.
2026-10-15 17:49:50 +03:00
euisuhandOpenAI Codex 11cbf52ea7 test(settings): respect effective filesystem permissions
Probe effective write restrictions so privileged container runs do not
assert errors the OS cannot provide, while retaining unprivileged coverage.

Closes #46

Co-Authored-By: OpenAI Codex <noreply@openai.com>
2026-10-14 16:03:59 +09:00
skylartaylor b55b21cdeb Apply permission policy review before first release 2026-10-13 04:33:01 +02:00
Alejandro Londono 6006abb757 feat(settings): add shared config storage for Craft apps
Add shared config.toml storage while keeping settings types, defaults and UI policy in each app.

Includes isolated in-memory operation, configurable portable paths, atomic saves with private backups, damaged-file preservation, schema migrations, and documented best-effort handling of external edits.

Validation: native macOS formatting, strict workspace clippy, 172 workspace tests and the craft-settings WASM check. Independent backup-permission and failed external-migration repros fail before the fixes and pass afterward.

Hosted CI: all seven UI and printing jobs pass across macOS, Linux, Windows and UI WASM.

Refs #12
2026-10-12 15:40:50 -06:00