* test(cli): pin today's argument handling
Run the real binary and record how the hand-written parser behaves for every
subcommand: help and version spellings, no arguments, unknown subcommands and
flags, value flags in both spellings, missing and repeated values, positional
order, exit codes and which stream carries each message.
No behaviour change. Later parser changes update these assertions on purpose.
* refactor(cli): split main.rs into modules
Move only: args, error, output, convert, info, session, catalog, app and
mcp each get their functions and unit tests; main.rs keeps the usage doc,
help_text and the dispatch. Moved items become pub(crate) where other
modules call them. No behaviour change.
* refactor(cli): typed errors and run(args, out, err)
soundcraft-cli is now a library plus a thin binary. `soundcraft_cli::run(args,
out, err) -> i32` is the whole program; main.rs only passes the real streams
and shuts the plugin hosts down afterwards (process teardown, not part of run,
which tests call repeatedly in one process). Subcommands write to the given
writers, return `Result<(), CliError>`, and `fail` is gone. CliError wraps
engine, audio-io, io (with the path), serde_json and the control channel
errors; UsageError, ConvertError and RootFlagError cover the subcommands' own
failures. No Result<_, String> is left except where a dependency reports a
string (control-channel call, AutomationRoots::new), wrapped in a variant.
The tests that need no files, working directory, environment or stdin now call
`run` in-process (tests/it/run.rs); the rest still run the binary.
Behaviour changes:
- Error messages start with `error: ` instead of `soundcraft-cli: `.
- A script line that stops the run now prints `error: FILE:N: ID: ...` (it had
no prefix). With --keep-going the line stays bare.
- A convert encode or write failure now names the output path.
- An empty or help-less call still prints the one-line usage to stderr without
a prefix and exits 1; `files confined:` keeps its `soundcraft-cli:` prefix
(it is a note, not an error).
* refactor(cli): parse arguments with clap
Replace the hand parser (arg_value, check_options, ENGINE_OPTIONS, the
lib.rs dispatch, the per-subcommand positional handling and the root
flags' consume) with clap derive types in args.rs: a Parser, a
Subcommand enum and one Args struct per subcommand, with the run/script
engine flags flattened. main passes args_os(); run takes OsString-like
arguments and renders clap's help, version and usage errors (help and
version on stdout, exit 0; usage errors on stderr, exit 2). Add
command() returning the clap definition. The usage block in the module
doc and help_text are gone: the doc comments are the help.
Behaviour changes:
- Usage errors exit 2 with clap's message and the --help hint on
stderr, instead of exit 1 with hand-written text: unknown subcommand,
unknown flag, missing value, missing or extra positional, a value on
a boolean flag (--demo=1, --normalize=1).
- No arguments prints the help to stderr, exit 2 (was a one-line usage,
exit 1).
- --help, -h and help print clap's generated help, and every subcommand
has its own (SUB --help, SUB -h, help SUB). Before, info and script
read --help as a file name, describe as an id, commands as a filter,
run rejected --help and ignored -h, convert and app printed their
usage error, mcp, parity and plugins ignored it, and app --port P -h
called the method -h.
- --help or -h before -- shows the subcommand's help even after a
mistake on the same line (run --bounce --help).
- --version, -V and version print "soundcraft-cli X.Y.Z" (was
"SoundCraft CLI X.Y.Z").
- Unknown flags on info, commands, describe, app, mcp, parity and
plugins are usage errors; they were ignored or read as a positional.
mcp --automation-bogus exits 2 (was exit 1).
- Extra positionals are usage errors on every subcommand (were ignored).
- A single-dash word (-x) is a flag, so an unknown one is a usage
error; a value starting with - is written --flag=-value.
- Flags may come before or between the positionals: convert IN --rate
44100 OUT, convert --rate 44100 IN OUT and script --keep-going FILE
parse (the flag word was taken as a file name).
- A repeated single-value flag keeps its last value (was the first):
--rate, --bit-depth, --save, --port and the others.
- parity --write without a value is a usage error (printed the report).
- mcp --connect without a value, or followed by a flag, is a usage
error (was exit 1, or took the flag as the port).
- mcp --demo=1 is a usage error (was ignored, without the demo).
- A root flag without a folder, with an empty one, or followed by a
flag is a usage error with clap's message (was exit 1).
- A non-Unicode argument is a usage error where text is expected and
accepted as a root folder (std::env::args panicked).
- The help lists --sample as --demo's alias.
Unchanged: --dither with --no-dither, bad --rate and --bit-depth values,
the roots with --connect and the SOUNDCRAFT_CONTROL_PORT fallback are
still checked after parsing (exit 1).
* refactor(cli): reject repeated flags, clap --version (photocraft#7071 decisions)
Behaviour changes:
- A flag given twice is a usage error (exit 2), in either spelling, including
an alias pair such as --demo and --sample. Before, the last one won. Only
run's --cmd and mcp's --automation-read-root / --automation-write-root
repeat; they accumulate in order.
- --version and -V print the long version, "soundcraft-cli 0.13.1 (linux
x86_64)": the version and the platform the binary was built for.
- The hidden `version` subcommand is gone; `soundcraft-cli version` is an
unrecognized-subcommand usage error.
- --start and --end accept a negative number (`--start -1`, as the engine
counts positions before 0); any other value starting with `-` needs `=`
and otherwise is an unexpected-argument usage error. No flag has
allow_hyphen_values.
- `help <subcommand>` is unchanged (tested).
* refactor(cli): typed values and flag relations
Handlers receive typed values: convert --bit-depth is a ValueEnum, --rate a
NonZeroU32, file arguments PathBuf, --start/--end a TimeArg, --cmd a parsed
(id, JSON) spec, app's JSON a serde_json::Value, app --port and mcp --connect
a validated port or host:port. Relations (--dither/--no-dither, --in/--demo,
--start/--end needing --bounce) are declared on the flags. describe ID,
commands FILTER and app METHOD refuse an empty string. parse_rate,
parse_bit_depth, parse_dither, parse_cmd_spec, time_arg and the Rate,
BitDepth, DitherConflict and CmdJson errors are gone.
Behaviour changes:
- --dither with --no-dither is a usage error (exit 2) instead of exit 1.
- --rate 0 / non-numeric and an unknown --bit-depth are usage errors (exit 2)
with clap's wording, naming the flag. --bit-depth help lists the values.
- --in with --demo (or --sample) is a usage error; --in used to win silently.
- --start/--end without --bounce are a usage error; they used to be ignored.
- Malformed JSON in --cmd ID=JSON and in app's JSON argument is a usage error
(exit 2) at parse time. Before, run opened the engine and executed every
earlier --cmd (printing their results) before the bad one failed with exit 1.
- An empty --start/--end, an empty command id (--cmd =1), and an empty
describe ID, commands FILTER or app METHOD are usage errors. An empty
commands FILTER used to list everything.
- app --port and mcp --connect accept only a port (0-65535) or host:port;
junk used to be accepted and failed at connect time (exit 1).
- Non-Unicode file names are accepted wherever the callee takes a Path (info
audio files, convert, script, parity --write). Session and bounce/save paths
go to the engine as text, so a non-Unicode one fails with exit 1, "the path
is not valid Unicode", after any earlier --cmd ran.
* refactor(cli): shared launch flags and SOUNDCRAFT_CONTROL_PORT as clap env
soundcraft_automation::args holds the launch flags as clap Args structs:
ControlClientArgs (`app --port`, env SOUNDCRAFT_CONTROL_PORT, default
7979), ControlServerArgs (the desktop `--control`, same variable, wired
in a later step; its ControlPort value is a port, also from a loopback
host:port, or another host's host:port, which the app decides on, so one
export serves both), AutomationArgs (the two root flags, repeatable, flags
only), the ControlTarget value parser, and the blank_env_is_unset,
name_env_vars and conflict helpers. The module and its clap/thiserror
dependencies are left out of the wasm build. `app` and `mcp` flatten
them; the hand fallback to the variable in `app` is gone.
Behaviour changes:
- An empty or blank SOUNDCRAFT_CONTROL_PORT counts as unset, so `app`
uses 7979; before, it tried to connect to `127.0.0.1:` (exit 1).
- A bad SOUNDCRAFT_CONTROL_PORT is a usage error naming the variable
(exit 2); before, the connection failed (exit 1).
- Spaces around the `app --port` or `mcp --connect` value, or the
variable's, are ignored; before, the connection failed (exit 1).
- An IPv6 host in `app --port`, `mcp --connect` or the variable goes in
brackets (`[::1]:7979`); `::1:7979` is a usage error (exit 2), as the
host and port can't be told apart; before, the connection failed
(exit 1).
- `app --help` shows `[env: SOUNDCRAFT_CONTROL_PORT=]` and
`[default: 7979]` instead of the hand-written default note.
- `mcp` with a root flag and --connect is clap's conflict error (exit 2,
"the argument '...' cannot be used with '...'"), reported before any
root folder is opened; before, a custom message with exit 1, after the
roots were opened.
* refactor(app): move launch flag parsing into launch_args
The parsing moves out of main unchanged, into a LaunchArgs struct and a
parse function that takes SOUNDCRAFT_CONTROL_PORT as a parameter. Tests pin
the flags, the file list, ignored unknown flags and the fallback of a bad
--control to the variable. No behaviour change.
* refactor(app): parse launch flags with clap
soundcraft --help now comes from the LaunchArgs doc comments and ends with the
environment variables the app reads, and the shared ControlServerArgs supplies
--control and SOUNDCRAFT_CONTROL_PORT. Process tests cover the variable (bad
value, blank value, loopback host:port, another host).
Behaviour changes:
- An unknown flag (--bogus, -x) is a usage error on stderr, exit 2. It was
ignored, and a single-dash word was opened as a file; after `--` it is a file.
- A bad --control (out of range, not a number, missing value) is a usage error,
exit 2. It was ignored and the variable used instead.
- A bad SOUNDCRAFT_CONTROL_PORT is a usage error naming the variable, exit 2.
It was ignored. An empty or blank variable still counts as unset.
- A loopback host:port (127.0.0.1, localhost or [::1]) in --control or
SOUNDCRAFT_CONTROL_PORT gives its port, so the value `soundcraft-cli app`
takes from the variable works for both. The control server listens on
127.0.0.1 only, so another host in --control is a usage error. In the
variable, which may point `soundcraft-cli app` at another machine, it is
ignored with a log warning and the app opens without a control server.
Both were ignored before.
- A repeated flag is a usage error (--demo twice, --control twice).
- --control=PORT and a port with surrounding spaces are accepted; a value that
starts with `-` is not taken as the value, except a negative number, which is
a bad port (`--control -1`).
- --help ends with an Environment section listing SOUNDCRAFT_CONTROL_PORT,
SOUNDCRAFT_CONFIG_DIR, SOUNDCRAFT_NO_PREFS, SOUNDCRAFT_NO_SYSTEM_FONTS,
SOUNDCRAFT_WAYLAND (Linux) and RUST_LOG.
- --help and -h print the help, exit 0. They were ignored.
- --version and -V print `soundcraft 0.13.1 (linux x86_64)`, as soundcraft-cli
does. It printed `SoundCraft 0.13.1`.
- -V and --version are read in order with the other arguments: an earlier
error comes first.
- macOS -psn_… process serial numbers are dropped, as before they were
opened as files.
- A file whose name is not valid Unicode is skipped with a log warning. It
used to panic in std::env::args.
* feat(cli): shell completions and man pages
An example, `cargo run -p soundcraft-cli --example man-and-completions -- <out-dir>`,
writes bash, zsh, fish, elvish and PowerShell completions and soundcraft-cli.1 plus a
page per subcommand, using clap_complete and clap_mangen (dev-dependencies of
soundcraft-cli only, not in the binary).
The Linux package (deb, rpm, tar.gz, AppImage) installs the pages in
/usr/share/man/man1 and the bash, zsh and fish completions in their standard
directories; the deb also links the zsh completion into Debian's
vendor-completions. A cross build runs the example through $EMULATOR and
leaves the files out without one. The FreeBSD tarball carries them in the
ports layout; a cross build builds the example for the host as well.
No change to the CLI's behaviour. A test pins the files the example writes.
* ci(cli): check the command-line code with ast-grep rules
Adds lint/ast-grep (rules for clap errors built from strings, String as an
error type, and std::env::args) and a workflow that runs the rule tests and a
scan over the CLI code through the shared craft-common-actions workflow. No
behaviour change; the scan has no hits.
* docs(cli): document soundcraft-cli and RFC-0012
Add docs/cli.md: the subcommands, exit codes, environment variables, the
desktop app's launch flags, man pages and completions, and the RFC-0012 rules
not followed yet (convert can overwrite its input; no --compact/--json).
Link it from the README and the MCP and control-protocol guides. No code change.
* feat(cli): refuse an output that replaces an input
An output that is one of the subcommand's inputs is a usage error (exit 2,
`error: …` on stderr, clap's usage line), reported while parsing, before
the engine loads or any --cmd runs. Paths are compared by file identity
(device and inode, through same-file), or, when neither exists yet, by
where they would be created, so `a.wav`, `./a.wav`, an absolute path and a
symbolic or hard link all count as the same file.
Inputs and outputs per subcommand:
- convert: input IN, output OUT. --in-place lets OUT replace IN.
- run: input --in, outputs --bounce and --save. --in-place lets --save
replace the --in session; it requires --in. A --bounce naming the --in
session is always refused.
- script: inputs FILE and --in, outputs --bounce and --save. --in-place
lets --save replace the --in session; a --bounce naming it is always
refused, and neither may ever replace FILE.
- run and script: --bounce and --save naming one file is refused with or
without --in-place (the save would replace the bounce).
- info, commands, describe, app, mcp, plugins write no file; parity
--write has no input. Paths inside --cmd parameters are not checked.
With --in-place, an output that is a symbolic link to the input is written
to the file the link names, so convert and --save both replace the input
and leave the link in place (a save renames a new file over its path,
which would otherwise replace the link and leave the input unchanged).
Behaviour changes:
- `convert a.wav a.wav`, `run --in s.scraft --save s.scraft`,
`run --in s.scraft --bounce s.scraft` and the other cases above exit 2
instead of replacing the input.
- New flag --in-place on convert, run and script.
- An existing file that is not an input is still replaced without asking.
* feat(cli): --compact for JSON output
RFC-0012 rule 1.3: JSON is pretty-printed by default and --compact prints
one line. Every pretty-printed JSON output now goes through
output::print_json.
Changed outputs:
- info <audio file>, describe, app: new --compact flag.
- run and script: new --compact flag, which requires --inspect and applies
to the --inspect JSON only.
Unchanged on purpose:
- The `ID: JSON` result lines of run and script and the --bounce and --save
results stay one line each. The prefix makes them text records, and the
RFC lets a command document its own layout; scripts that parse them keep
working.
- commands, plugins, parity and the .scraft summary of info are text and get
no --json flag (an open question in the RFC); mcp speaks JSON-RPC lines.
Pretty output is byte-identical to before.
* fix(app): one Switch parser for boolean environment switches
SOUNDCRAFT_NO_PREFS, SOUNDCRAFT_NO_SYSTEM_FONTS and SOUNDCRAFT_WAYLAND each
counted any value, including 0, as on. They now share
soundcraft_ui_egui::switch::Switch: 1/on/true/yes is On, 0/off/false/no is
Off (case- and space-insensitive), unset or blank is Default, and any other
value is Default and logged with the variable name. The ENVIRONMENT help
text, docs/cli.md and the README say the same.
Behaviour changes (old -> new):
- SOUNDCRAFT_NO_PREFS=0 disabled preferences (any value did); now only On
does.
- SOUNDCRAFT_NO_SYSTEM_FONTS=0 disabled system fonts (any value did); now
only On does.
- SOUNDCRAFT_WAYLAND=0 kept native Wayland (any value did); now only On does.
- An empty value of any of the three counted as set; it now means the
default (off).
- An unknown value of any of the three is logged.
* refactor(app): read the environment once into Env
The desktop app reads SOUNDCRAFT_CONFIG_DIR, SOUNDCRAFT_NO_PREFS,
SOUNDCRAFT_NO_SYSTEM_FONTS and SOUNDCRAFT_WAYLAND once at startup into
env::Env (typed fields, Switch for the on/off ones), after the logger is
installed so malformed switches are logged. The --help Environment
section is generated from the same VARS table, with a test that it lists
every name.
ui-egui no longer reads the app's variables: fonts::install and
definitions take system_fonts, set through SoundApp::set_system_fonts
(default on, so the web app is unchanged). The XWayland and prefs
decisions are methods on Env, tested on literals. logging::install takes
the RUST_LOG value, which stays outside Env because the logger needs it
before anything can log.
No behaviour change beyond help column spacing.
* refactor(cli): one long_version for both binaries
* refactor(audio-io): one FileFormat table for extensions
FileFormat gains the extension table every caller matches on:
from_extension / from_path (ASCII case-insensitive) over extensions,
from_write_extension over write_extensions, default_extension, name,
mime_type, the READ and WRITE lists, and readable_extensions /
writable_extensions for dialog filters, help and messages. Reading
takes every extension the decoder knows; writing takes only the names
whose readers expect what the encoder writes (no rf64 or aifc, whose
files would get plain RIFF and AIFF headers).
detect_format, bounce (mix and stems), convert, the bounce dialog, the
desktop and web file pickers, the workspace browser, the Sampler, web
downloads and the MCP bounce schema all use it; ENCODE_EXTENSIONS and
encode_format_for are gone. convert's IN/OUT and info's FILE help name
the extensions from the read and write lists.
Behaviour changes, where the lists disagreed:
- The bounce dialog's Browse result, the bounce save filter and the MCP
bounce enum take wav, wave, bwf, aif, aiff and flac: wave and bwf are
new to all three, and aif is new to the MCP enum. convert and
file.bounce_mix already took these. The "supported:" list in the
cannot-write errors is "wav, wave, bwf, aif, aiff, flac".
- file.bounce_stems reads its format name case-insensitively: `AIFF`
or `FLAC` meant WAV before. Unknown names still mean WAV.
- The bounce dialog sends the format as its file extension (aif for
AIFF); the engine accepts both spellings.
- File pickers, the workspace browser and the Sampler's drop and Load
Sample filter list every extension the decoder reads: the workspace
browser gains wave, bwf, rf64, aifc, mp1, mp2, oga, aac, mp4, adts,
mkv and webm; the Sampler gains rf64, mp1, mp2, m4b, adts, mkv and
webm; the desktop and web open filters gain rf64, mp1, mp2 and adts.
- Web downloads get a media type for every audio format, not only WAV,
AIFF and FLAC.
* refactor(app): resolve the settings folder once in Env
* fix(app): keep paths as paths until the engine needs text
A path is text only where an engine command takes `"path": string`; a
name that is not valid Unicode is reported there instead of being opened
under a lossy rendering (another file, or a confusing "can't read").
- ui-egui: dialogs::unicode() and NotUnicode ("<path:?> is not valid
Unicode"); dialogs::open_path(app, &Path), moved from the desktop app,
is the one open-by-extension path for dropped, command-line and
Workspace files.
- Services: the file dialogs return PathBuf (pick_save and pick_folder
start from a &Path); callers convert where the text field or command
takes the path.
- Sampler drops and Load Sample pass the path to mix.sampler_load
through unicode(); the audio test checks the Path.
- Workspace panel keeps entry paths; names are shown lossily only as
labels. workspace_dir stays a String (serialized preferences).
- soundcraft-cli: utf8() is unicode(), CliError::NonUnicodePath is
NotUnicode; it is called only for info's session, --in, --bounce and
--save. convert's output format test no longer treats a non-Unicode
extension as "no extension".
- docs/cli.md: sessions and bounces the engine opens or writes must be
valid Unicode.
Behaviour changes:
- A dropped, command-line, picked or Workspace file whose name is not
valid Unicode is not opened: the status line (and log) says
"<path:?> is not valid Unicode", with the bytes escaped. Dropped files
used to be opened under a U+FFFD rendering.
- A file dialog result that is not valid Unicode leaves the path field
unchanged and shows the same warning.
- Double-clicking a Workspace file opens it like a dropped file:
.MID/.MIDI/.SCRAFT in any case open as MIDI/session (they used to
import as audio), and a failed open is logged.
- convert OUT with an extension that is not valid Unicode is refused as
an unsupported format instead of being written as WAV.
* fix(app): read Env after the launch flags; tidy Switch and Env
* fix(audio-io): decode every extension the format table lists
* fix(cli): write convert output atomically; tighten --connect and loopback
- convert writes every output to a new file in the output's folder, flushes it and renames it
over the target, removing the new file on failure. A failed write (disk full, unwritable
folder) no longer truncates the input under --in-place (RFC-0012 rule 1.6). A link output
still writes the linked file.
- --save in place already goes through the engine's replace_file (tmp + rename), and
file.bounce_mix renders to <name>.part and renames it when complete, so both are atomic.
- The desktop's --control / SOUNDCRAFT_CONTROL_PORT no longer treat [::1] as loopback: the
control server binds 127.0.0.1 only. [::1]:P is a usage error from the flag and is ignored
with a warning from the variable. The CLI's --connect / app --port still accept [::1]:P.
Error tip and docs/cli.md updated.
- mcp --connect conflicts with --demo (exit 2): the demo session belongs to the in-process
server. Help and docs/cli.md say so.
* test(audio-io): list the decode fixtures in ATTRIBUTION.md
cargo xtask assets needs a row for every committed audio file; one
directory row covers crates/audio-io/tests/fixtures/.
* fix(cli): refuse non-finite --start and --end values
* refactor(cli): parse the control target once; open sessions by path; keep error sources
- A1: ControlTarget { host, port } is parsed once by args::control_target; is_loopback() replaces
control_port/ControlPort, and Remote::new takes &ControlTarget.
- A2: engine::io::open_session takes impl AsRef<Path>; the CLI no longer requires a Unicode path
to open a session, only for the --bounce and --save paths that go into JSON.
- A3: ValueError::Json keeps the serde_json::Error; Remote::request returns RemoteError and
AutomationRoots::new returns RootError, both carried by CliError.
* test(engine): pass session paths to open_session without a borrow
* test(cli): info opens a session at a non-Unicode path
* refactor(app): log the shared long version; info: session extension in any case; Switch beside Env
* ui: keep SoundCraft's beside-the-session-view place for panels craft-ui has no record of
* ui: Tracks and Groups and Clips in full-height dock columns
The Edit window docks Tracks and Groups (168 pt) at its start edge and Clips
(230 pt) at its end edge, with the MIDI editor under the session view between
them; Mix docks Tracks and Groups at its start edge. Panels dragged to an
empty window edge make a dock there.
Saved preferences and window configurations carry docking_version. Split-frame
layouts saved without it load as the new defaults, keeping every other
setting. A list with no recorded place reopens in its dock group, making the
dock again at its side and width when it is gone.
Pins craft-ui, craft-docpath and craft-media to craft-libs#312.
* Pin craft-libs at d24e4bc for the Mac round 3
* ui: test that a floating list reopens floating while its dock is shown; ui-parity revision
* feat: startup update prompt modal and direct self-updating
Integrate `craft-update` pinned to storytold/craft-libs fe61243 to check for
updates on startup, display the standard suite update modal with changelog notes,
and support one-click in-app updating and restart.
Ref: storytold/craft-libs#319
* wip
* build: refresh the lock
* refactor(updates): drive the flow with craft-update's Updater
The check at start is opt-in for the desktop app, a successful update closes through the app's own close path, and no update starts over unsaved work.
* fix(updates): register the update command and hold the install back during a recording
Help ▸ Check for Updates… goes through the shared command id, and an active recording counts as work the update must not interrupt.
* ui: move panel docking onto craft-ui's shared Workspace and DockCommand
Pin every craft-libs crate at 16fb3d4 (craft-libs main after #285).
The Edit and Mix workspaces are craft_ui::docking::Workspace<Panel>.
ui.dock and ui.dock.reset parse into DockCommand; the app keeps its
panels, permissions, defaults, the document-view and Mix rules, the
beside-the-canvas fallback for panels without a recorded place, and
Arrange. The canvas accepts splits so panels still open beside it.
Saved v1 workspaces (no version, floating windows as
{panels, active, rect}) load unchanged. Tests cover loading one and
dragging a group by its drag bar.
* ui: test that activating a hidden panel shows it
* ui: name the field in ui.dock operation errors; document the shared panel menu and zones
cli::mcp_automation_roots_take_several_folders built its folders from
std::fs::canonicalize, which returns \\?\C:\... on Windows. The server
prints its roots without that prefix (file_access::plain), so the stderr
check never matched. The test also sent \\?\ paths with `..` in them,
which Windows does not normalize, so that call failed with "cannot
resolve" instead of "outside the read roots".
A test helper now canonicalizes and strips \\?\ (and \\?\UNC\) on
Windows, as file_access::plain does, and the test builds every path from
it. On macOS and Linux the paths are unchanged.
* Build: line tables only for workspace crates, no debug info for dependencies
Full debug info made most of the dev and test target size and link time. Line tables keep file and line numbers in backtraces; dependency frames lose them.
* Tests: build each crate's integration tests as one binary
Each tests/*.rs file was its own test binary: 98 binaries, each linking the crate and its dependencies. The files are now modules of tests/it/main.rs, one binary per crate, which cuts link time and target size. Filter by module: `cargo test -p <crate> --test it <module>::`.
Binaries with their own main (harness = false) in clap-host and vst3-host stay separate, as do the ui-egui tests that switch the process-wide Light/Dark palette and recovery.rs, whose autosave locks leak into child processes other tests start.
* Xtask: run tests with nextest, doctests apart, and no examples in the test build
cargo xtask ci runs the tests with cargo nextest when it is installed, else cargo test with a notice, and doctests with cargo test --doc. The test build leaves out examples (--lib --bins --tests); clippy --all-targets still compiles them. Test binaries with harness = false run under cargo test: their own main cannot answer nextest's --list. clippy and the wasm check keep going past a failing crate. cargo xtask test runs the test step alone.
* Use chrono for UTC/calendar conversion instead of hand-rolled copies
Replaces the civil_from_days copy behind the desktop app's log timestamp with
chrono as a workspace dependency. The output format is unchanged and pinned by
the existing test. AGENTS.md now says time goes through chrono.
Follow-up to storytold/cadcraft#1785
* Never panic logging on a clock outside chrono's range
chrono's From<SystemTime> unwraps internally, so a clock past year 262143
panicked inside the logger. timestamp now reads the duration since the epoch
and goes through the fallible DateTime::from_timestamp, reading an
out-of-range clock as the epoch, exactly as the pre-epoch clamp already did.
The year is written with {:04} rather than %Y, which would prefix a '+' past
year 9999. Tests cover the far-future and year-10000 cases.
* Don't build an unrepresentable SystemTime in the far-future test
UNIX_EPOCH + Duration::from_secs(u64::MAX / 2) overflows Windows'
SystemTime and panicked before timestamp() ran, failing the Windows
test job. Build it with checked_add and only assert where it exists.
* time: preserve old out-of-range log timestamp (no epoch fallback)
`DateTime::from_timestamp(...).unwrap_or_default()` silently reset any clock
past chrono's year range to 1970-01-01, changing output the old hand-rolled
`civil_from_days` converted exactly. Restore the old conversion domain with a
cycle-based helper that routes the calendar through chrono (the calendar
repeats every 400 years = 146_097 days, so month/day/time come from chrono and
only the year is carried in i128, keeping every i64 exact). Keep the pre-1970
epoch clamp; u64 seconds past i64::MAX saturate rather than falling back.
Pinned old outputs in the test (replacing the u64::MAX/2 -> epoch assertion):
u64::MAX/2 s -> 292277026596-12-04T15:30:07.000Z
10_000_000_000_000 s -> 318857-05-20T17:46:40.000Z
* Don't build a year-318857 SystemTime unchecked in the logging test
Windows' SystemTime only reaches about year 30828, so
UNIX_EPOCH + Duration::from_secs(10_000_000_000_000) panicked before
timestamp() ran and failed the Windows test job. Build it with
checked_add and assert where the platform can hold it. The year-10000
case fits everywhere and stays unconditional.
* Name the 400-year range extension as the one exception to the time rule
The rule said never to hand-roll calendar math, but the range fix
(shifting by whole 400-year Gregorian cycles so dates past chrono's year
range keep their old output) is cycle arithmetic, so the rule and the code
disagreed. The rule now names that exception: the library still computes
month, day and time, and only whole cycles are carried in the year.
* Say the library computes month and day; time-of-day is plain arithmetic
Narrows the range-extension wording: the date library computes the
calendar fields, and splitting seconds into hours, minutes and seconds
is ordinary arithmetic, which is what the code does.
soundcraft-cli convert always passed dither: true, so a same-depth or
wider conversion still added ±1 LSB TPDF noise and digital silence came
out as noise. It now dithers only when writing integer samples that
cannot hold the source exactly: fewer bits than the source, a float or
lossy source, or samples changed by --rate/--normalize. 32-bit float
output never dithers. --dither and --no-dither override the choice,
like the Bounce option in #551.
Picking a session with Open Session or dropping one on the page in the
browser replaced the document as soon as its bytes were read, without the
Save Changes question the native Open goes through, so unsaved edits and
their undo history were lost. The bytes now wait behind that question,
asked when the read finishes: Don't Save opens them, Save saves first and
then opens them, Cancel drops them and leaves the document alone.
Decode, resample and build peaks on a worker; file.import_audio then only places the clip. CLI/MCP/control unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`convert`, `run` and `script` read options with `arg_value`, which matches a
flag exactly and takes the argument after it. A misspelling, an `--option=value`
form or an option with no value therefore read as absent: the command ran
without what was asked for and still exited 0.
convert IN OUT --rate=44100 wrote IN's 48000 Hz unchanged
convert IN OUT --bitdepth 16 wrote the default 24-bit
convert IN OUT --bogus wrote the file, said nothing
run --cmd session.new --bounce=OUT bounced nothing
Check what each subcommand accepts and report an unknown option or a missing
value with a non-zero exit, and read `--option=value` as the value it looks
like. The documented space-separated form is unchanged.
With the marker present, ui.json, Autosave, Presets and logs go to
<exe dir>/SoundCraftData instead of the user profile. SOUNDCRAFT_CONFIG_DIR
still wins, and a data folder that can't be written falls back to the
profile with a warning in the log.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
256 MiB per line times 16 connections let a peer make the app buffer about
4 GiB. 16 MiB would break a legitimate request: mix.insert_state carries a
plugin's state as base64 inline, and the engine accepts states of up to
b64::MAX_DECODED_BYTES (64 MiB), about 85.3 MiB of base64. Nothing else sent
to the app is that large (screenshots are replies, which this doesn't bound).
So the cap is that base64 length plus 1 MiB for the JSON around it, derived
from the same constant so the two stay in step; a compile-time check keeps it
under 96 MiB, about 1.5 GiB across all 16 connections.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A bounce keeps its own snapshot of the session, decoded audio included.
The progress window blocks the mouse, but shortcuts, the macOS menu bar,
dropped files and the control channel still reach SoundApp::run, so a
second session could be opened beside the one bouncing; two large ones
could exhaust memory, which aborts the app.
New, Open, Close and Revert now fail with "Finish or cancel the bounce
first" while a bounce runs, and so do sessions opened or dropped in the
browser.
Nothing caught a panic outside a command: one in the interface's frame
code ended the process in that frame (exit code 101), losing every
unsaved change, and the log got a single line with no backtrace.
Each frame's logic and drawing now run guarded. A panic there autosaves
the session (once per change, so a bug that repeats every frame doesn't
flood the disk), says so in the status line and lets the app carry on.
If the app goes down after all, the autosave is offered at the next
launch. The panic hook now logs a backtrace.
Autosave wrote every session called "Untitled" to the same
Autosave/Untitled folder and reused audio files there by source id, so
a second untitled session, or a take recorded after an undo, could be
autosaved with another take's audio. Its first run also copied all of
the session's audio again. Nothing ever offered an autosave back
(latest_autosave had no callers), so after a crash the work could only
be found by digging in the settings folder.
Each open session now autosaves to a folder of its own, locked while
the session is open. Audio already saved with the session is referenced
where it is; audio that exists only in memory is copied once per
recording or render. Saving, closing the session, opening another and
quitting with SoundCraft's Quit delete the folder. A crash, or an exit
that skips Quit with unsaved changes, leaves it behind, after one last
autosave when SoundCraft gets the chance. At the next launch,
SoundCraft offers each kept folder, newest first, to recover or
discard. Recovered work opens as an unsaved version of the session it
came from, so Save writes it back there; unsaved changes in the session
it replaces are kept the same way. Folders older than their session
file are dropped.
Pro Tools has File › Open Recent; SoundCraft had no way back to a session but
browsing for it. The list (UiState.recent_sessions) records the engine's
session path whenever it changes, so opening or saving by any route (menu,
control channel, MCP, a dropped file) is covered by one rule.
- Under File › Open; each entry is "name — folder", full path on hover.
- A session that has moved or been deleted is greyed out "(missing)" instead
of failing on click; existence is re-checked at most every 3 s while the menu
is open, since a network share costs a round trip per file.
- Opening goes through the dialog layer, so unsaved changes are asked about.
- Clear Recent empties it.
- The desktop host saves ui.json as soon as the list changes, not only on a
clean exit: the list matters most after a crash.
- An older ui.json without the field still loads (serde default).
The macOS system menu bar (native_menu) does not show it yet; the egui menu
bar on Windows and Linux does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setup > Playback Engine now chooses the audio system (cpal host), output
and input device, device sample rate and buffer size, kept per machine
with the UI preferences and applied by reopening the devices (refused
while recording; the transport position is kept). ui.audio_device does
the same for agents and lists every system with its devices, channels,
rates and buffer range.
Player and recorder open the chosen device, fall back to the defaults
for anything unavailable (unplugged device, unsupported rate), retry
with the device's default buffer when the chosen one is refused, and
convert 32/16-bit integer devices from and to the f32 mix through
scratch buffers allocated up front (no allocation in the callbacks).
ASIO is behind an opt-in 'asio' feature (playback and app): building it
downloads Steinberg's ASIO SDK (proprietary licence or GPLv3) and needs
LLVM, so it stays off by default. Verified on Windows with an SSL 2+:
WASAPI output/input switching and buffer 256, ASIO duplex at 128.
Docs: G-01 shrunk, hardware-parity rows, roadmap log.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>