mirror of
https://github.com/storytold/soundcraft.git
synced 2026-12-01 02:04:21 -06:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8028202ac9 | ||
|
|
bb486228cd | ||
|
|
3b06aea7d0 | ||
|
|
7b4905c00e | ||
|
|
40497d7eca | ||
|
|
35dcf1d412 | ||
|
|
f155bba583 | ||
|
|
896de30146 | ||
|
|
681f40f566 | ||
|
|
a3c7f4edc7 | ||
|
|
7fe79e21ed | ||
|
|
d42ade0951 | ||
|
|
025cf1e0ba | ||
|
|
31dfc36766 | ||
|
|
7a563aca6e | ||
|
|
af7c16b570 | ||
|
|
60950ba884 | ||
|
|
c776bbd2b4 |
@@ -83,7 +83,9 @@
|
||||
}
|
||||
},
|
||||
"max_artifact_bytes": 2147483648,
|
||||
"automatic_signer_actors": [],
|
||||
"automatic_signer_actors": [
|
||||
"github-actions[bot]"
|
||||
],
|
||||
"platforms": {
|
||||
"windows-x86_64": {
|
||||
"unsigned_artifact_name": "nightly-unsigned-windows-x86_64",
|
||||
@@ -95,7 +97,15 @@
|
||||
"unsigned_artifact_name": "nightly-unsigned-linux-x86_64",
|
||||
"trust": {
|
||||
"fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED"
|
||||
}
|
||||
},
|
||||
"package_formats": [
|
||||
"appimage",
|
||||
"arch",
|
||||
"deb",
|
||||
"flatpak",
|
||||
"oci",
|
||||
"rpm"
|
||||
]
|
||||
},
|
||||
"macos-aarch64": {
|
||||
"unsigned_artifact_name": "nightly-unsigned-macos-aarch64",
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
RUST_BACKTRACE: 1
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
RUST_BACKTRACE: 1
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -207,7 +207,7 @@ jobs:
|
||||
RUST_BACKTRACE: 1
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
name: Dispatch release-ref nightly
|
||||
|
||||
# Transport only, never authorization. No checkout, payload parsing or release environment.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [SoundCraft unsigned nightly]
|
||||
types: [completed]
|
||||
branches: [main]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
dispatch:
|
||||
if: >-
|
||||
github.repository == 'storytold/soundcraft' &&
|
||||
github.event_name == 'workflow_run'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- name: Dispatch only the exact completed producer run and attempt
|
||||
shell: python
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
import json
|
||||
import os
|
||||
import urllib.request
|
||||
|
||||
def require(value, message):
|
||||
if not value:
|
||||
raise RuntimeError(message)
|
||||
|
||||
# These filters reduce noise; the protected signer-branch validator repeats admission
|
||||
# against authenticated API metadata and required attestation/quality evidence.
|
||||
require(os.environ.get('GITHUB_REPOSITORY') == 'storytold/soundcraft', 'wrong repository')
|
||||
require(os.environ.get('GITHUB_EVENT_NAME') == 'workflow_run', 'wrong event')
|
||||
with open(os.environ['GITHUB_EVENT_PATH'], encoding='utf-8') as stream:
|
||||
event = json.load(stream)
|
||||
require(event.get('action') == 'completed', 'producer is not complete')
|
||||
require(event.get('repository', {}).get('full_name') == 'storytold/soundcraft', 'wrong event repository')
|
||||
producer = event.get('workflow_run', {})
|
||||
require(producer.get('head_repository', {}).get('full_name') == 'storytold/soundcraft', 'foreign producer')
|
||||
require(producer.get('path') == '.github/workflows/nightly.yml', 'wrong producer path')
|
||||
require(producer.get('head_branch') == 'main', 'wrong producer branch')
|
||||
require(producer.get('status') == 'completed' and producer.get('conclusion') == 'success', 'producer did not succeed')
|
||||
# First scheduled attempt only; reviewed manual/re-run authority belongs to release policy.
|
||||
require(producer.get('event') == 'schedule', 'not an automatic scheduled producer')
|
||||
run_id, attempt = producer.get('id'), producer.get('run_attempt')
|
||||
require(type(run_id) is int and run_id > 0, 'invalid producer run id')
|
||||
require(type(attempt) is int and attempt == 1, 'invalid automatic producer attempt')
|
||||
body = json.dumps({'ref': 'refs/heads/nightly-signer', 'inputs': {
|
||||
'producer_run_id': str(run_id), 'producer_run_attempt': str(attempt)
|
||||
}}).encode('utf-8')
|
||||
request = urllib.request.Request(
|
||||
'https://api.github.com/repos/storytold/soundcraft/actions/workflows/nightly-sign.yml/dispatches',
|
||||
data=body, method='POST', headers={
|
||||
'Authorization': 'Bearer ' + os.environ['GH_TOKEN'],
|
||||
'Accept': 'application/vnd.github+json',
|
||||
'Content-Type': 'application/json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
'User-Agent': 'soundcraft-nightly-dispatch'
|
||||
})
|
||||
class NoRedirect(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
raise RuntimeError('dispatch redirects are forbidden')
|
||||
# One bounded request, no retry: duplicate transport is not publication authority.
|
||||
with urllib.request.build_opener(NoRedirect()).open(request, timeout=20) as response:
|
||||
require(response.status == 204, 'dispatch was not accepted')
|
||||
print('Dispatched producer run/attempt to the release-ref validator; not a signing result.')
|
||||
@@ -1,8 +1,10 @@
|
||||
name: SoundCraft unsigned nightly
|
||||
|
||||
# Enabled for supervised manual runs by the reviewed manual actors only; no schedule yet.
|
||||
# A later explicit opt-in may add a cadence (and a reviewed dispatcher with it).
|
||||
# Runs automatically on the reviewed nightly schedule and for supervised manual runs
|
||||
# by the reviewed manual actors.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 5 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
@@ -37,6 +37,7 @@ jobs:
|
||||
dry-run: ${{ github.event_name == 'schedule' }}
|
||||
app-name: soundcraft
|
||||
app-title: SoundCraft
|
||||
macos-runner: macos-15
|
||||
version: ${{ inputs.version }}
|
||||
contributors-artifact: ${{ needs.credits.outputs.artifact-name }}
|
||||
secrets:
|
||||
|
||||
@@ -10,7 +10,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: sonarcloud-${{ github.ref }}
|
||||
group: ${{ github.ref == 'refs/heads/main' && format('sonarcloud-main-{0}', github.sha) || format('sonarcloud-{0}', github.ref) }}
|
||||
# A push to main is the run that publishes coverage; superseded runs there would never finish.
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
|
||||
+14
-3
@@ -21,9 +21,18 @@ are bundled.
|
||||
|
||||
## Fonts
|
||||
|
||||
SoundCraft bundles no font files. It uses the default fonts shipped inside the `egui` crate
|
||||
(Ubuntu-Light: Ubuntu Font Licence 1.0; Hack: MIT; Noto Emoji: OFL-1.1; emoji-icon-font: MIT)
|
||||
and, at runtime, the operating system's own UI fonts when available (never redistributed).
|
||||
SoundCraft ships one font file, for the web build only. Everything else is the default fonts
|
||||
shipped inside the `egui` crate (Ubuntu-Light: Ubuntu Font Licence 1.0; Hack: MIT; Noto Emoji:
|
||||
OFL-1.1; emoji-icon-font: MIT) and, at runtime, the operating system's own UI fonts when available
|
||||
(never redistributed).
|
||||
|
||||
The browser cannot reach the operating system's fonts, and egui's bundled faces carry no Han
|
||||
glyphs, so a Simplified Chinese interface would draw boxes. `assets/fonts/NotoSansSC-SoundCraftSubset.ttf`
|
||||
is therefore compiled into the web build alone (`crates/ui-egui/src/fonts.rs`): a subset of the
|
||||
Noto Sans SC variable font, pinned at weight 400 and reduced with fontTools to the UI glyph set
|
||||
(the zh-Hans catalog, GB 2312 level-1 common characters, ASCII, Latin-1 letters and the UI's
|
||||
punctuation, arrows and triangles; about 1.1 MiB). It is SIL Open Font License 1.1 — see
|
||||
`assets/fonts/OFL.txt`. Native builds never embed it and keep drawing with system fonts.
|
||||
|
||||
## Bundled egui font icons
|
||||
|
||||
@@ -47,6 +56,8 @@ here. The subset uses default_fonts; the parent face uses monochrome_emoji_fonts
|
||||
| `docs/brand/artcraft-mark.png` | ArtCraft Team | ArtCraft brand assets | ArtCraft brand terms |
|
||||
| `docs/brand/artcraft-mark-black.svg` | ArtCraft Team | ArtCraft brand assets | ArtCraft brand terms |
|
||||
| `docs/brand/artcraft-mark-black.png` | ArtCraft Team | ArtCraft brand assets | ArtCraft brand terms |
|
||||
| `assets/fonts/NotoSansSC-SoundCraftSubset.ttf` | Google LLC / Noto Project Authors | Noto Sans SC variable font, subset to the UI glyph set and pinned at weight 400 (generated with fontTools by `docs/i18n/tools/subset_web_font.py`) | SIL Open Font License 1.1 (`assets/fonts/OFL.txt`) |
|
||||
| `assets/fonts/OFL.txt` | Noto Project Authors / SIL | SIL Open Font License 1.1 text | OFL-1.1 |
|
||||
| `assets/app-icon/icon.svg` | SoundCraft contributors | original (hand-placed SVG paths; placeholder app icon) | MIT OR Apache-2.0 |
|
||||
| `packaging/macos/dmg/` (all files) | @XusBadia | original (macOS DMG window background and layout, from the app icon; see `packaging/macos/dmg/README.md`) | MIT OR Apache-2.0 |
|
||||
| `assets/app-icon/soundcraft-1024.png` | SoundCraft contributors | original, rendered from `icon.svg` | MIT OR Apache-2.0 |
|
||||
|
||||
Generated
+27
-18
@@ -1478,6 +1478,14 @@ dependencies = [
|
||||
"encoding_rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-nightly"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=1f6c3a21f85ed96f8fd4ddd5a959d4e1edbedb24#1f6c3a21f85ed96f8fd4ddd5a959d4e1edbedb24"
|
||||
dependencies = [
|
||||
"winsafe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-pdf"
|
||||
version = "0.1.0"
|
||||
@@ -5971,11 +5979,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"craft-audio",
|
||||
"craft-nightly",
|
||||
"craft-update",
|
||||
"eframe",
|
||||
"egui",
|
||||
@@ -5996,7 +6005,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-au-host"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
@@ -6006,7 +6015,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-automation"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"craft-audio",
|
||||
@@ -6020,7 +6029,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-clap-host"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"clap-sys",
|
||||
"libc",
|
||||
@@ -6035,7 +6044,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-cli"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
@@ -6053,7 +6062,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-dsp"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"proptest",
|
||||
@@ -6064,7 +6073,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-engine"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
"craft-aaf",
|
||||
@@ -6094,7 +6103,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-interchange"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
"craft-aaf",
|
||||
@@ -6107,7 +6116,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-midi"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-midi",
|
||||
"proptest",
|
||||
@@ -6115,7 +6124,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-mix"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"log",
|
||||
@@ -6131,14 +6140,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-model"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-scraft-format",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-playback"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"cpal",
|
||||
"craft-audio",
|
||||
@@ -6154,14 +6163,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-time"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-ui-egui"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"craft-behavior",
|
||||
@@ -6197,7 +6206,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-video"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-media",
|
||||
"craft-video",
|
||||
@@ -6208,7 +6217,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-vst3-host"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"libloading 0.9.0",
|
||||
@@ -6226,7 +6235,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcraft-web"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"craft-web-api",
|
||||
@@ -8150,7 +8159,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"
|
||||
|
||||
[[package]]
|
||||
name = "xtask"
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
+2
-1
@@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"]
|
||||
default-members = ["crates/*", "apps/*", "xtask"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.20.1"
|
||||
version = "0.21.0"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.95"
|
||||
@@ -79,6 +79,7 @@ craft-scraft-format = { version = "0.1.0", git = "https://github.com/storytold/c
|
||||
# craft-update: app-specific pretend versions apply to startup and manual checks.
|
||||
craft-update = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", features = ["ui"] }
|
||||
craft-mcp-server = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" }
|
||||
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "1f6c3a21f85ed96f8fd4ddd5a959d4e1edbedb24" }
|
||||
|
||||
# ui
|
||||
craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" }
|
||||
|
||||
+4
-3
@@ -52,7 +52,7 @@ measures readiness and adds hardware, localization and field bug reports.
|
||||
| UI/UX fidelity | ~55 % | 60–100 | [ui-parity.md](docs/ui-parity.md) |
|
||||
| File formats | ~40 % | 70–120 | [file-format-parity.md](docs/file-format-parity.md) |
|
||||
| Hardware (interfaces, MIDI, surfaces, sync) | ~12 % | 110–180 | [hardware-parity.md](docs/hardware-parity.md) |
|
||||
| Localization | ~12 % (1 of Pro Tools' 8 languages; English and pt-BR fixed UI strings, no CJK/RTL font fallback or native review) | 70–110 | [localization-parity.md](docs/localization-parity.md) |
|
||||
| Localization | ~19 % (2 of Pro Tools' 8 languages; English, pt-BR and zh-Hans fixed UI strings, with a CJK fallback and a web Han font; no RTL or complex-script shaping, no native review) | 55–90 | [localization-parity.md](docs/localization-parity.md) |
|
||||
| Performance | ~35 % (unmeasured) | 40–70 | [hardware-parity.md](docs/hardware-parity.md#performance) |
|
||||
| Stability | ~45 % | 50–80 | [gaps.md](docs/gaps.md) |
|
||||
| Platforms | ~65 % (5 platforms built, macOS exercised) | 20–40 | [gaps.md](docs/gaps.md) |
|
||||
@@ -86,7 +86,7 @@ Weights and evidence per row: [target-app-parity.md](docs/target-app-parity.md#f
|
||||
| Language | Code | Status | Translated |
|
||||
|---|---|---|---:|
|
||||
| English | en | full | 100 % |
|
||||
| Simplified Chinese | zh-Hans | none | 0 % |
|
||||
| Simplified Chinese | zh-Hans | full — 100 % of fixed UI strings; CJK fallback, web Han font, tests pass | 100 % (native-speaker review pending) |
|
||||
| Spanish | es | full — 100 % of fixed UI strings and engine errors; tests pass | 100 % (native-speaker review done) |
|
||||
| Hindi | hi | none | 0 % |
|
||||
| Arabic | ar | none | 0 % |
|
||||
@@ -98,7 +98,7 @@ Weights and evidence per row: [target-app-parity.md](docs/target-app-parity.md#f
|
||||
| Korean | ko | none | 0 % |
|
||||
| Vietnamese | vi | none | 0 % |
|
||||
|
||||
Other languages shipped: Spanish complete (fixed UI strings and engine errors, native-speaker review). French is partial (≈ 62 %). Brazilian Portuguese covers the fixed UI strings (100 %), with native-speaker review, CJK/RTL font fallbacks and script shaping still pending. Detail: [localization-parity.md](docs/localization-parity.md).
|
||||
Other languages shipped: Spanish complete (fixed UI strings and engine errors, native-speaker review). French is partial (≈ 62 %). Brazilian Portuguese and Simplified Chinese cover the fixed UI strings (100 %); both still need native-speaker review. CJK fallbacks ship for Chinese, while RTL and complex-script shaping are still missing. Detail: [localization-parity.md](docs/localization-parity.md).
|
||||
|
||||
## Upcoming
|
||||
|
||||
@@ -191,6 +191,7 @@ mutated and truncated movies. Field reports from the first public week are track
|
||||
|---|---|---|
|
||||
| 2026-11-27 | trivial | Languages table: Spanish catalog complete with native-speaker review. Estimates unchanged |
|
||||
| 2026-11-24 | trivial | Languages table: French and Spanish catalogs, partial (≈ 62 %), PR #143. Estimates unchanged |
|
||||
| 2026-11-22 | minor | Languages table: Simplified Chinese (zh-Hans) covers the fixed UI strings through the `locales/zh-Hans` catalog, with a Han system-font fallback and an OFL web subset; needs native review. Localization estimate 70–110 → 55–90 h |
|
||||
| 2026-11-14 | minor | Strict external-WAV AAF import with bounded property caching; remaining interchange work and readiness estimates unchanged |
|
||||
| 2026-11-09 | trivial | Progress log: Frequency Shifter plugin; readiness estimates unchanged |
|
||||
| 2026-11-08 | trivial | Command-click breakpoint/control priority and insertion affordance; active-tool drags retained; readiness estimates unchanged |
|
||||
|
||||
@@ -12,18 +12,38 @@
|
||||
import { createRequire } from 'node:module'
|
||||
import http from 'node:http'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
const dir = process.argv[2]
|
||||
if (!dir) { console.error('usage: node page-api.mjs <site folder>'); process.exit(2) }
|
||||
const cwd = path.resolve(process.cwd())
|
||||
const tmp = path.resolve(os.tmpdir())
|
||||
const rootDir = path.resolve(cwd, dir)
|
||||
const inAllowedRoot =
|
||||
rootDir === cwd ||
|
||||
rootDir.startsWith(cwd + path.sep) ||
|
||||
rootDir === tmp ||
|
||||
rootDir.startsWith(tmp + path.sep)
|
||||
if (!inAllowedRoot) {
|
||||
console.error('site folder must be inside the current working directory or system temp directory')
|
||||
process.exit(2)
|
||||
}
|
||||
const rootPrefix = rootDir.endsWith(path.sep) ? rootDir : rootDir + path.sep
|
||||
const require = createRequire(path.join(process.cwd(), 'noop.js'))
|
||||
const { chromium } = (() => { try { return require('playwright') } catch { return require('@playwright/test') } })()
|
||||
|
||||
const types = { '.html': 'text/html', '.js': 'text/javascript', '.wasm': 'application/wasm', '.png': 'image/png' }
|
||||
const server = http.createServer(async (req, res) => {
|
||||
const route = decodeURIComponent(req.url.split('?')[0])
|
||||
const file = path.join(dir, route === '/' ? 'index.html' : route)
|
||||
const relPath = (route === '/' ? 'index.html' : route).replace(/^\/+/, '')
|
||||
const file = path.resolve(rootDir, relPath)
|
||||
if (!file.startsWith(rootPrefix)) {
|
||||
res.writeHead(403)
|
||||
res.end()
|
||||
return
|
||||
}
|
||||
try {
|
||||
const body = await readFile(file)
|
||||
res.writeHead(200, { 'content-type': types[path.extname(file)] || 'application/octet-stream' })
|
||||
@@ -42,7 +62,7 @@ try {
|
||||
await page.locator('canvas').first().waitFor({ timeout: 180_000 })
|
||||
await page.waitForFunction(() => window.soundcraft && typeof window.soundcraft.request === 'function', null, { timeout: 180_000 })
|
||||
|
||||
const names = await page.evaluate(() => Object.keys(window.soundcraft).sort())
|
||||
const names = await page.evaluate(() => Object.keys(window.soundcraft).sort((a, b) => a.localeCompare(b)))
|
||||
for (const f of ['request', 'execute', 'commands', 'docInspect', 'uiInspect', 'screenshot']) {
|
||||
assert(names.includes(f), `window.soundcraft.${f} is installed (found: ${names.join(' ')})`)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ asio = ["soundcraft-playback/asio"]
|
||||
[dependencies]
|
||||
soundcraft-engine.workspace = true
|
||||
craft-audio.workspace = true
|
||||
craft-nightly.workspace = true
|
||||
soundcraft-ui-egui.workspace = true
|
||||
soundcraft-playback.workspace = true
|
||||
soundcraft-automation.workspace = true
|
||||
|
||||
@@ -1,23 +1,10 @@
|
||||
//! Build-time channel is distinct from a launch selector. A runtime environment cannot promote a stable build.
|
||||
use crate::launch_profile::Profile;
|
||||
|
||||
pub use craft_nightly::BuildFlavor;
|
||||
use std::ffi::OsString;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum BuildFlavor {
|
||||
Stable,
|
||||
NightlyV1,
|
||||
}
|
||||
|
||||
pub const COMPILED: BuildFlavor = if cfg!(soundcraft_nightly_v1) { BuildFlavor::NightlyV1 } else { BuildFlavor::Stable };
|
||||
|
||||
pub fn require_profile(flavor: BuildFlavor, profile: &Profile) -> Result<(), String> {
|
||||
match (flavor, profile.is_nightly()) {
|
||||
(BuildFlavor::NightlyV1, false) => Err("Open SoundCraft Nightly from ArtCraft Launcher".into()),
|
||||
(BuildFlavor::Stable, true) => Err("This is a stable SoundCraft build; nightly-v1 requires the nightly build".into()),
|
||||
_ => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn needs_native_error(flavor: BuildFlavor, desktop_session: bool) -> bool {
|
||||
desktop_session && flavor == BuildFlavor::NightlyV1
|
||||
}
|
||||
@@ -36,6 +23,7 @@ pub fn version(flavor: BuildFlavor, stable: &str) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn only_a_nightly_desktop_refusal_requests_a_native_dialog() {
|
||||
assert!(needs_native_error(BuildFlavor::NightlyV1, true));
|
||||
@@ -44,20 +32,6 @@ mod tests {
|
||||
assert!(!needs_native_error(BuildFlavor::Stable, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nightly_build_without_a_profile_is_refused_before_startup() {
|
||||
let started = std::cell::Cell::new(false);
|
||||
let result = require_profile(BuildFlavor::NightlyV1, &Profile::Stable).map(|()| started.set(true));
|
||||
assert!(result.unwrap_err().contains("ArtCraft Launcher"));
|
||||
assert!(!started.get());
|
||||
}
|
||||
#[test]
|
||||
fn stable_and_nightly_flavors_accept_only_their_own_profile() {
|
||||
let nightly = Profile::NightlyV1(std::path::PathBuf::from("already validated root"));
|
||||
assert!(require_profile(BuildFlavor::Stable, &Profile::Stable).is_ok());
|
||||
assert!(require_profile(BuildFlavor::Stable, &nightly).is_err());
|
||||
assert!(require_profile(BuildFlavor::NightlyV1, &nightly).is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn nightly_version_query_is_unambiguous_and_never_reinterprets_file_arguments() {
|
||||
assert_eq!(version(BuildFlavor::Stable, "0.20.1"), "0.20.1");
|
||||
|
||||
@@ -10,12 +10,6 @@ use soundcraft_ui_egui::docking;
|
||||
pub(crate) const PORTABLE_MARKER: &str = "portable.txt";
|
||||
pub(crate) const PORTABLE_DATA_DIR: &str = "SoundCraftData";
|
||||
|
||||
/// The portable marker in `dir`, if it is a regular file (never a link or a directory).
|
||||
pub(crate) fn portable_marker(dir: &std::path::Path) -> Option<std::path::PathBuf> {
|
||||
let marker = dir.join(PORTABLE_MARKER);
|
||||
std::fs::symlink_metadata(&marker).ok().filter(|m| m.file_type().is_file()).map(|_| marker)
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum Platform {
|
||||
Mac,
|
||||
@@ -44,7 +38,7 @@ pub fn resolve_config_dir(get: impl Fn(&str) -> Option<OsString>) -> Option<Path
|
||||
}
|
||||
|
||||
fn config_dir_with(platform: Platform, env: impl Fn(&str) -> Option<OsString>, exe_dir: Option<&Path>, nightly: Option<&Path>) -> Option<PathBuf> {
|
||||
// The compiled Nightly flavor cannot run without a profile (`build_flavor::require_profile`),
|
||||
// The compiled Nightly flavor always selects an isolated profile (`launch_profile::prepare`),
|
||||
// so this is the complete settings folder and never falls back to Stable data.
|
||||
if let Some(root) = nightly {
|
||||
return Some(root.to_path_buf());
|
||||
|
||||
@@ -1,214 +1,289 @@
|
||||
//! Launcher-owned nightly-v1 bootstrap. Selected before logging, updates, fonts or saved state.
|
||||
//! Stable launches retain their original arguments and directory policy. No environment mutation.
|
||||
//! Nightly-v1 bootstrap and profile fencing via `craft-nightly`.
|
||||
//!
|
||||
//! Selected before logging, updates, fonts or saved state. Direct launches of a nightly build
|
||||
//! self-isolate into `craft_nightly::canonical_profile_root("soundcraft")`; launcher launches
|
||||
//! pass `--launch-profile nightly-v1 --profile-root <dir> -- <args...>`. Stable builds keep
|
||||
//! their original arguments and directory policy.
|
||||
|
||||
use std::ffi::OsString;
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
use std::sync::OnceLock;
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub const VERSION: &str = "nightly-v1";
|
||||
use craft_nightly::{AppProfileSpec, Launch, Profile, ProfileError, StartupOptions};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Profile {
|
||||
Stable,
|
||||
NightlyV1(PathBuf),
|
||||
}
|
||||
use crate::build_flavor;
|
||||
|
||||
impl Profile {
|
||||
pub fn is_nightly(&self) -> bool {
|
||||
matches!(self, Self::NightlyV1(_))
|
||||
}
|
||||
const APP_ID: &str = "soundcraft";
|
||||
const DISPLAY_NAME: &str = "SoundCraft";
|
||||
const STABLE_DIR_NAMES: &[&str] = &["soundcraft", "SoundCraft"];
|
||||
const STABLE_PACKAGE_ID: &str = "ai.storyteller.soundcraft";
|
||||
const NIGHTLY_PACKAGE_ID: &str = "ai.storyteller.soundcraft.nightly";
|
||||
const FORBIDDEN_ENV_VARS: &[&str] = &[crate::env::CONFIG_DIR];
|
||||
const PORTABLE_MARKERS: &[&str] = &[crate::config::PORTABLE_MARKER];
|
||||
const FOLDER_ONLY_ENTRIES: &[&str] = &["Autosave", "Presets", "logs"];
|
||||
|
||||
pub fn root(&self) -> Option<&Path> {
|
||||
match self {
|
||||
Self::Stable => None,
|
||||
Self::NightlyV1(root) => Some(root),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Launch {
|
||||
pub profile: Profile,
|
||||
pub args: Vec<OsString>,
|
||||
}
|
||||
|
||||
static PROFILE: OnceLock<Profile> = OnceLock::new();
|
||||
static STABLE: Profile = Profile::Stable;
|
||||
|
||||
pub fn current() -> &'static Profile {
|
||||
PROFILE.get().unwrap_or(&Profile::Stable)
|
||||
craft_nightly::current().unwrap_or(&STABLE)
|
||||
}
|
||||
|
||||
pub fn install(profile: Profile) -> Result<(), String> {
|
||||
PROFILE.set(profile).map_err(|_| "the launch profile was already selected".into())
|
||||
fn non_empty_abs_env(env: &impl Fn(&str) -> Option<OsString>, key: &str) -> Option<PathBuf> {
|
||||
let value = env(key)?;
|
||||
if value.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let path = PathBuf::from(value);
|
||||
path.is_absolute().then_some(path)
|
||||
}
|
||||
|
||||
/// Recognize only the agreed literal selector/root pair before `--`. Everything after it is
|
||||
/// a file, even when it looks like a profile flag. No filesystem or startup hook runs here.
|
||||
pub fn parse(args: Vec<OsString>) -> Result<Launch, String> {
|
||||
let mut selector = None;
|
||||
let mut root = None;
|
||||
let mut other = Vec::new();
|
||||
let mut files = Vec::new();
|
||||
let mut iter = args.iter();
|
||||
let mut delimiter = false;
|
||||
while let Some(arg) = iter.next() {
|
||||
if arg == "--" {
|
||||
delimiter = true;
|
||||
files.extend(iter.cloned());
|
||||
break;
|
||||
fn extra_forbidden_roots_with(env: impl Fn(&str) -> Option<OsString>) -> Vec<PathBuf> {
|
||||
let mut roots = Vec::new();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
// The MSI's default per-user and per-machine folders (install-policy.wxi).
|
||||
if let Some(local) = non_empty_abs_env(&env, "LOCALAPPDATA") {
|
||||
roots.push(local.join("Programs").join("ArtCraft").join("SoundCraft"));
|
||||
}
|
||||
if arg == "--launch-profile" || arg == "--profile-root" {
|
||||
let slot = if arg == "--launch-profile" { &mut selector } else { &mut root };
|
||||
if slot.is_some() {
|
||||
return Err("the profile selector and root must each occur exactly once".into());
|
||||
if let Some(profile) = non_empty_abs_env(&env, "USERPROFILE") {
|
||||
roots.push(profile.join("AppData").join("Local").join("Programs").join("ArtCraft").join("SoundCraft"));
|
||||
}
|
||||
for key in ["ProgramW6432", "ProgramFiles", "ProgramFiles(x86)"] {
|
||||
if let Some(base) = non_empty_abs_env(&env, key) {
|
||||
roots.push(base.join("ArtCraft").join("SoundCraft"));
|
||||
}
|
||||
let value = iter.next().filter(|v| !v.is_empty()).ok_or("the profile selector/root needs a value")?;
|
||||
if value.to_string_lossy().starts_with("--") {
|
||||
return Err("the profile selector/root needs a value".into());
|
||||
}
|
||||
*slot = Some(value.clone());
|
||||
} else if arg.to_string_lossy().starts_with("--launch-profile=") || arg.to_string_lossy().starts_with("--profile-root=") {
|
||||
return Err("the nightly protocol requires separate literal selector/root argument tokens".into());
|
||||
} else {
|
||||
other.push(arg.clone());
|
||||
}
|
||||
}
|
||||
match (selector, root) {
|
||||
(None, None) => Ok(Launch { profile: Profile::Stable, args }),
|
||||
(Some(version), Some(root)) if version == VERSION => {
|
||||
if !delimiter || !other.is_empty() {
|
||||
return Err("nightly-v1 accepts only its selector/root followed by -- and file names".into());
|
||||
}
|
||||
let root = PathBuf::from(root);
|
||||
if !root.is_absolute() || root.components().any(|c| matches!(c, Component::ParentDir)) {
|
||||
return Err("the nightly profile root must be absolute and contain no parent traversal".into());
|
||||
}
|
||||
Ok(Launch { profile: Profile::NightlyV1(root), args: std::iter::once(OsString::from("--")).chain(files).collect() })
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
{
|
||||
roots.extend(["/usr/bin/soundcraft", "/usr/local/bin/soundcraft", "/opt/soundcraft"].map(PathBuf::from));
|
||||
// The stable Flatpak keeps its data in its own per-app folder.
|
||||
if let Some(home) = non_empty_abs_env(&env, "HOME") {
|
||||
roots.push(home.join(".var/app/ai.storyteller.soundcraft"));
|
||||
}
|
||||
(Some(_), Some(_)) => Err("unsupported launch profile (expected nightly-v1)".into()),
|
||||
_ => Err("--launch-profile and --profile-root must be supplied together".into()),
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
roots.push(PathBuf::from("/Applications/SoundCraft.app"));
|
||||
if let Some(home) = non_empty_abs_env(&env, "HOME") {
|
||||
let library = home.join("Library");
|
||||
roots.push(library.join("Preferences/ai.storyteller.soundcraft.plist"));
|
||||
roots.push(library.join("Saved Application State/ai.storyteller.soundcraft.savedState"));
|
||||
roots.push(home.join("Applications/SoundCraft.app"));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(unix, target_os = "windows")))]
|
||||
let _ = env;
|
||||
|
||||
roots
|
||||
}
|
||||
|
||||
fn spec_with(env: impl Fn(&str) -> Option<OsString>) -> AppProfileSpec {
|
||||
AppProfileSpec {
|
||||
app_id: APP_ID,
|
||||
display_name: DISPLAY_NAME,
|
||||
stable_dir_names: STABLE_DIR_NAMES,
|
||||
stable_package_id: STABLE_PACKAGE_ID,
|
||||
nightly_package_id: NIGHTLY_PACKAGE_ID,
|
||||
profile_root_env: None,
|
||||
forbidden_env_vars: FORBIDDEN_ENV_VARS,
|
||||
portable_markers: PORTABLE_MARKERS,
|
||||
folder_only_entries: FOLDER_ONLY_ENTRIES,
|
||||
extra_forbidden_roots: extra_forbidden_roots_with(env),
|
||||
}
|
||||
}
|
||||
|
||||
/// The Launcher's version check: the selector/root pair followed by exactly `--version` (or `-V`),
|
||||
/// answered like a plain version query. Only [`parse`]'s lexical checks apply; the root is never
|
||||
/// validated or touched, and `-- --version` stays a file name.
|
||||
pub fn version_query(args: &[OsString]) -> bool {
|
||||
let Some((last, pair)) = args.split_last() else { return false };
|
||||
if last != "--version" && last != "-V" {
|
||||
return false;
|
||||
}
|
||||
let lexical = pair.iter().cloned().chain(std::iter::once(OsString::from("--"))).collect();
|
||||
matches!(parse(lexical), Ok(Launch { profile: Profile::NightlyV1(_), args }) if args.len() == 1)
|
||||
pub fn spec() -> AppProfileSpec {
|
||||
spec_with(|key| std::env::var_os(key))
|
||||
}
|
||||
|
||||
/// Validation finishes before the caller's first startup effect. Stable never calls the nightly
|
||||
/// root validator, so its old portable/config resolution stays unchanged.
|
||||
pub fn prepare(mut launch: Launch, validate: impl FnOnce(&Path) -> Result<PathBuf, String>) -> Result<Launch, String> {
|
||||
if let Profile::NightlyV1(root) = &launch.profile {
|
||||
launch.profile = Profile::NightlyV1(validate(root)?);
|
||||
}
|
||||
Ok(launch)
|
||||
}
|
||||
|
||||
/// Resolve the selected private root before the caller's first startup effect.
|
||||
pub fn validate_root(root: &Path, env: impl Fn(&str) -> Option<OsString>, exe: Option<&Path>) -> Result<PathBuf, String> {
|
||||
// SoundCraft keeps no Documents agent folder and has no craft-settings data/cache roots: one
|
||||
// settings folder holds ui.json, Autosave/, Presets/ and logs/, and `config::writable` is the
|
||||
// app's existing exclusive write probe.
|
||||
crate::profile_root::validate(root, env, exe, crate::config::writable)
|
||||
pub fn prepare(args: impl IntoIterator<Item = OsString>) -> Result<Launch, ProfileError> {
|
||||
craft_nightly::prepare_launch(build_flavor::COMPILED, &spec(), args, &StartupOptions::new())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::cell::Cell;
|
||||
use craft_nightly::{BuildFlavor, NIGHTLY_V1_CONTRACT, canonical_profile_root, launch_arguments, parse_startup, validate_and_prepare_root};
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
fn args(values: &[&str]) -> Vec<OsString> {
|
||||
values.iter().map(OsString::from).collect()
|
||||
}
|
||||
|
||||
fn absolute() -> &'static str {
|
||||
if cfg!(windows) { r"C:\NightlyData\profiles\soundcraft" } else { "/nightly-data/profiles/soundcraft" }
|
||||
}
|
||||
fn nightly() -> Vec<OsString> {
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--"])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stable_arguments_and_directory_policy_are_unchanged() {
|
||||
for argv in [args(&[]), args(&["--new-instance", "a.psd"]), args(&["--", "--launch-profile", "file.psd"])] {
|
||||
let launch = prepare(parse(argv.clone()).unwrap(), |_| panic!("stable must never validate a nightly root")).unwrap();
|
||||
assert_eq!(launch, Launch { profile: Profile::Stable, args: argv });
|
||||
}
|
||||
}
|
||||
struct TempDir(PathBuf);
|
||||
|
||||
#[test]
|
||||
fn exact_version_and_root_are_parsed_without_reinterpreting_file_names() {
|
||||
let mut argv = nightly();
|
||||
argv.extend(args(&["--profile-root", "image with spaces.psd"]));
|
||||
let launch = parse(argv).unwrap();
|
||||
assert_eq!(launch.profile, Profile::NightlyV1(PathBuf::from(absolute())));
|
||||
assert_eq!(launch.args, args(&["--", "--profile-root", "image with spaces.psd"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_duplicate_unknown_and_conflicting_profile_arguments_are_refused() {
|
||||
for argv in [
|
||||
args(&["--launch-profile", VERSION]),
|
||||
args(&["--profile-root", absolute()]),
|
||||
args(&["--launch-profile", "future-v2", "--profile-root", absolute(), "--"]),
|
||||
args(&["--launch-profile", VERSION, "--launch-profile", VERSION, "--profile-root", absolute(), "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--profile-root", absolute(), "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", "relative", "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", "", "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--new-instance", "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute()]),
|
||||
] {
|
||||
assert!(parse(argv).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_launcher_version_check_is_a_version_query_only_in_its_exact_form() {
|
||||
let pair = &["--launch-profile", VERSION, "--profile-root", absolute()];
|
||||
let reversed = &["--profile-root", absolute(), "--launch-profile", VERSION];
|
||||
for flag in ["--version", "-V"] {
|
||||
for form in [pair, reversed] {
|
||||
let mut argv = args(form);
|
||||
argv.push(flag.into());
|
||||
assert!(version_query(&argv), "{argv:?}");
|
||||
impl TempDir {
|
||||
fn new(prefix: &str) -> Self {
|
||||
static NEXT: AtomicU64 = AtomicU64::new(0);
|
||||
let base = std::fs::canonicalize(std::env::temp_dir()).unwrap_or_else(|_| std::env::temp_dir());
|
||||
loop {
|
||||
let candidate = base.join(format!("{prefix}-{}-{}", std::process::id(), NEXT.fetch_add(1, Ordering::Relaxed)));
|
||||
match std::fs::create_dir(&candidate) {
|
||||
Ok(()) => return Self(candidate),
|
||||
Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => continue,
|
||||
Err(error) => panic!("cannot create temp dir: {error}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
for argv in [
|
||||
args(&["--version"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--", "--version"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--version", "--"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--new-instance", "--version"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--version", "--version"]),
|
||||
args(&["--version", "--launch-profile", VERSION, "--profile-root", absolute()]),
|
||||
args(&["--launch-profile", "future-v2", "--profile-root", absolute(), "--version"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", "relative", "--version"]),
|
||||
args(&["--launch-profile", VERSION, "--version"]),
|
||||
args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--help"]),
|
||||
] {
|
||||
assert!(!version_query(&argv), "{argv:?}");
|
||||
|
||||
fn path(&self) -> &Path {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TempDir {
|
||||
fn drop(&mut self) {
|
||||
let _ = std::fs::remove_dir_all(&self.0);
|
||||
}
|
||||
// Outside the query the strict protocol still refuses the version flag.
|
||||
assert!(parse(args(&["--launch-profile", VERSION, "--profile-root", absolute(), "--version"])).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_root_validation_never_reaches_startup_or_falls_back_to_stable() {
|
||||
let reached = Cell::new(false);
|
||||
let result = prepare(parse(nightly()).unwrap(), |_| Err("read-only or unsafe profile".into())).map(|_| reached.set(true));
|
||||
assert!(result.is_err());
|
||||
assert!(!reached.get());
|
||||
fn soundcraft_spec_preserves_stable_fences_and_folder_entries() {
|
||||
let spec = spec();
|
||||
assert_eq!(spec.app_id, "soundcraft");
|
||||
assert_eq!(spec.display_name, "SoundCraft");
|
||||
assert_eq!(spec.stable_dir_names, &["soundcraft", "SoundCraft"]);
|
||||
assert_eq!(spec.stable_package_id, "ai.storyteller.soundcraft");
|
||||
assert_eq!(spec.nightly_package_id, "ai.storyteller.soundcraft.nightly");
|
||||
assert_eq!(spec.profile_root_env, None);
|
||||
assert_eq!(spec.forbidden_env_vars, &["SOUNDCRAFT_CONFIG_DIR"]);
|
||||
assert_eq!(spec.portable_markers, &["portable.txt"]);
|
||||
assert_eq!(spec.folder_only_entries, &["Autosave", "Presets", "logs"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn successful_root_validation_keeps_the_persistent_root_not_the_binary_tag() {
|
||||
let checked = PathBuf::from(absolute()).join("checked");
|
||||
let launch = prepare(parse(nightly()).unwrap(), |_| Ok(checked.clone())).unwrap();
|
||||
assert_eq!(launch.profile.root(), Some(checked.as_path()));
|
||||
assert!(launch.profile.is_nightly());
|
||||
fn direct_nightly_launch_self_isolates_into_canonical_profile_root() {
|
||||
let spec = spec();
|
||||
let expected_root = canonical_profile_root("soundcraft").unwrap();
|
||||
let argv = args(&["--demo", "song.scraft"]);
|
||||
let launch = parse_startup(BuildFlavor::NightlyV1, &spec, argv.clone(), &StartupOptions::new()).unwrap();
|
||||
assert_eq!(launch.profile, Profile::NightlyV1(expected_root));
|
||||
assert_eq!(launch.passthrough_args, argv);
|
||||
assert!(launch.leading_flags.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explicit_launcher_invocation_round_trips_and_preserves_file_arguments() {
|
||||
let spec = spec();
|
||||
let root = PathBuf::from(absolute());
|
||||
let user_args = args(&["--profile-root", "session with spaces.scraft"]);
|
||||
let argv = launch_arguments(&root, &user_args);
|
||||
let launch = parse_startup(BuildFlavor::NightlyV1, &spec, argv, &StartupOptions::new()).unwrap();
|
||||
assert_eq!(launch.profile, Profile::NightlyV1(root));
|
||||
assert_eq!(launch.passthrough_args, user_args);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stable_build_keeps_arguments_and_refuses_nightly_flags() {
|
||||
let spec = spec();
|
||||
for argv in [args(&[]), args(&["--demo", "a.scraft"]), args(&["--", "--launch-profile", "file.scraft"])] {
|
||||
let launch = parse_startup(BuildFlavor::Stable, &spec, argv.clone(), &StartupOptions::new()).unwrap();
|
||||
assert_eq!(launch.profile, Profile::Stable);
|
||||
assert_eq!(launch.passthrough_args, argv);
|
||||
}
|
||||
let nightly = launch_arguments(Path::new(absolute()), &[]);
|
||||
assert!(matches!(parse_startup(BuildFlavor::Stable, &spec, nightly, &StartupOptions::new()), Err(ProfileError::NightlyFlagsInStableBuild)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn version_queries_are_recognized_for_plain_and_launcher_invocations() {
|
||||
let spec = spec();
|
||||
for flag in ["--version", "-V"] {
|
||||
let plain = parse_startup(BuildFlavor::NightlyV1, &spec, args(&[flag]), &StartupOptions::new()).unwrap();
|
||||
assert!(plain.is_version_query());
|
||||
|
||||
for header in [
|
||||
["--launch-profile", NIGHTLY_V1_CONTRACT, "--profile-root", absolute()],
|
||||
["--profile-root", absolute(), "--launch-profile", NIGHTLY_V1_CONTRACT],
|
||||
] {
|
||||
let mut query = args(&header);
|
||||
query.push(flag.into());
|
||||
assert!(parse_startup(BuildFlavor::NightlyV1, &spec, query.clone(), &StartupOptions::new()).unwrap().is_version_query());
|
||||
query.push("recording with spaces.wav".into());
|
||||
let launch = parse_startup(BuildFlavor::NightlyV1, &spec, query, &StartupOptions::new()).unwrap();
|
||||
assert!(!launch.is_version_query());
|
||||
assert_eq!(launch.passthrough_args, args(&[flag, "recording with spaces.wav"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nightly_profile_reopens_with_saved_state_and_enforces_folder_only_entries() {
|
||||
let dir = TempDir::new("soundcraft-nightly-reopen");
|
||||
let root = dir.path().join("profile");
|
||||
let spec = spec();
|
||||
|
||||
let prepared = validate_and_prepare_root(&root, &spec).unwrap();
|
||||
assert_eq!(prepared, root);
|
||||
|
||||
for file in ["ui.json", "nightly-session.lock", "nightly-session.json"] {
|
||||
std::fs::write(prepared.join(file), b"saved profile data").unwrap();
|
||||
}
|
||||
for folder in FOLDER_ONLY_ENTRIES {
|
||||
std::fs::create_dir(prepared.join(folder)).unwrap();
|
||||
}
|
||||
assert_eq!(validate_and_prepare_root(&root, &spec).unwrap(), prepared);
|
||||
|
||||
for file in ["ui.json", "nightly-session.lock", "nightly-session.json"] {
|
||||
assert_eq!(std::fs::read(prepared.join(file)).unwrap(), b"saved profile data", "{file} remains intact after reopen");
|
||||
}
|
||||
for folder in FOLDER_ONLY_ENTRIES {
|
||||
let path = prepared.join(folder);
|
||||
std::fs::remove_dir(&path).unwrap();
|
||||
std::fs::write(&path, b"not a directory").unwrap();
|
||||
assert!(
|
||||
matches!(validate_and_prepare_root(&root, &spec), Err(ProfileError::ExpectedDirectoryEntry(_))),
|
||||
"{folder} must remain a directory"
|
||||
);
|
||||
std::fs::remove_file(&path).unwrap();
|
||||
std::fs::create_dir(&path).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extra_forbidden_roots_fence_soundcraft_install_locations() {
|
||||
let dir = TempDir::new("soundcraft-extra-fence");
|
||||
let custom_forbidden = dir.path().join("forbidden-install");
|
||||
let mut spec = spec();
|
||||
spec.extra_forbidden_roots.push(custom_forbidden.clone());
|
||||
assert!(matches!(validate_and_prepare_root(&custom_forbidden.join("nightly"), &spec), Err(ProfileError::ForbiddenRootOverlap { .. })));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_extra_forbidden_roots_include_expected_paths() {
|
||||
let home = if cfg!(windows) { r"C:\Users\tester" } else { "/Users/tester" };
|
||||
let local = if cfg!(windows) { r"C:\Users\tester\AppData\Local" } else { "/unused" };
|
||||
let program_files = if cfg!(windows) { r"C:\Program Files" } else { "/unused" };
|
||||
let spec = spec_with(|key| match key {
|
||||
"HOME" | "USERPROFILE" => Some(OsString::from(home)),
|
||||
"LOCALAPPDATA" => Some(OsString::from(local)),
|
||||
"ProgramFiles" => Some(OsString::from(program_files)),
|
||||
_ => None,
|
||||
});
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
assert!(spec.extra_forbidden_roots.contains(&PathBuf::from(local).join("Programs").join("ArtCraft").join("SoundCraft")));
|
||||
assert!(spec.extra_forbidden_roots.contains(&PathBuf::from(program_files).join("ArtCraft").join("SoundCraft")));
|
||||
}
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
{
|
||||
assert!(spec.extra_forbidden_roots.contains(&PathBuf::from("/opt/soundcraft")));
|
||||
assert!(spec.extra_forbidden_roots.contains(&PathBuf::from(home).join(".var/app/ai.storyteller.soundcraft")));
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
assert!(spec.extra_forbidden_roots.contains(&PathBuf::from("/Applications/SoundCraft.app")));
|
||||
assert!(spec.extra_forbidden_roots.contains(&PathBuf::from(home).join("Library/Preferences/ai.storyteller.soundcraft.plist")));
|
||||
}
|
||||
let _ = (home, local, program_files, &spec);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-23
@@ -26,7 +26,6 @@ mod logging;
|
||||
mod native_menu;
|
||||
mod nightly_session;
|
||||
mod process_identity;
|
||||
mod profile_root;
|
||||
mod switch;
|
||||
|
||||
use env::Env;
|
||||
@@ -251,36 +250,34 @@ fn report_launch_profile_error(error: &str) {
|
||||
fn prepare_launch() -> Option<Vec<std::ffi::OsString>> {
|
||||
// The trusted Launcher protocol is decided before the logger, updates, fonts or saved state.
|
||||
let argv: Vec<_> = std::env::args_os().skip(1).collect();
|
||||
// Plain `--version`, or the Launcher's `--launch-profile nightly-v1 --profile-root <dir>
|
||||
// --version`: answered before root validation, process identity, IPC or any window, as
|
||||
// `SoundCraft <version> (nightly-v1)` on standard output with nothing on standard error.
|
||||
if build_flavor::COMPILED == build_flavor::BuildFlavor::NightlyV1 && (build_flavor::version_query(&argv) || launch_profile::version_query(&argv))
|
||||
{
|
||||
// Plain `--version` / `-V` on Nightly: answered before canonical root resolution, validation,
|
||||
// process identity, IPC or any window, even in environments without HOME/LOCALAPPDATA.
|
||||
if build_flavor::COMPILED == build_flavor::BuildFlavor::NightlyV1 && build_flavor::version_query(&argv) {
|
||||
use std::io::Write as _;
|
||||
let _ = writeln!(std::io::stdout(), "SoundCraft {}", build_flavor::version(build_flavor::COMPILED, env!("SOUNDCRAFT_BUILT_VERSION")));
|
||||
return None;
|
||||
}
|
||||
let early = launch_profile::parse(argv)
|
||||
.and_then(|launch| {
|
||||
build_flavor::require_profile(build_flavor::COMPILED, &launch.profile)?;
|
||||
initialize_nightly_process_identity().map_err(|error| error.to_string())?;
|
||||
Ok(launch)
|
||||
})
|
||||
.and_then(|launch| {
|
||||
launch_profile::prepare(launch, |root| {
|
||||
launch_profile::validate_root(root, |key| std::env::var_os(key), std::env::current_exe().ok().as_deref())
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|error| {
|
||||
report_launch_profile_error(&error);
|
||||
std::process::exit(2)
|
||||
});
|
||||
let early = launch_profile::prepare(argv).unwrap_or_else(|error| {
|
||||
report_launch_profile_error(&error.to_string());
|
||||
std::process::exit(2)
|
||||
});
|
||||
// Launcher's `--launch-profile nightly-v1 --profile-root <dir> [--] --version`:
|
||||
// `craft_nightly::prepare_launch` skips root validation and profile installation for version queries.
|
||||
if build_flavor::COMPILED == build_flavor::BuildFlavor::NightlyV1 && early.is_version_query() {
|
||||
use std::io::Write as _;
|
||||
let _ = writeln!(std::io::stdout(), "SoundCraft {}", build_flavor::version(build_flavor::COMPILED, env!("SOUNDCRAFT_BUILT_VERSION")));
|
||||
return None;
|
||||
}
|
||||
if let Err(error) = initialize_nightly_process_identity() {
|
||||
report_launch_profile_error(&error.to_string());
|
||||
std::process::exit(2);
|
||||
}
|
||||
let identity = if early.profile.is_nightly() { os_window::LaunchIdentity::NightlyV1 } else { os_window::LaunchIdentity::Stable };
|
||||
if let Err(error) = launch_profile::install(early.profile).and_then(|()| os_window::select_identity(identity)) {
|
||||
if let Err(error) = os_window::select_identity(identity) {
|
||||
report_launch_profile_error(&error);
|
||||
std::process::exit(2);
|
||||
}
|
||||
Some(early.args)
|
||||
Some(early.passthrough_args)
|
||||
}
|
||||
|
||||
fn main() -> eframe::Result {
|
||||
|
||||
@@ -1,705 +0,0 @@
|
||||
//! App-owned nightly profile fences; no stable fallback, migration or process environment changes.
|
||||
|
||||
use std::ffi::OsString;
|
||||
|
||||
use crate::config::{PORTABLE_DATA_DIR, portable_marker};
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
|
||||
/// The Nightly Flatpak's own app id (packaging/linux/flatpak-bundle.sh). Inside that instance the
|
||||
/// sandbox is the isolation, so it is the one Flatpak whose environment a Nightly launch accepts.
|
||||
const NIGHTLY_FLATPAK_ID: &str = "ai.storyteller.soundcraft.nightly";
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum Platform {
|
||||
Windows,
|
||||
Linux,
|
||||
Mac,
|
||||
}
|
||||
|
||||
impl Platform {
|
||||
fn current() -> Result<Self, String> {
|
||||
match std::env::consts::OS {
|
||||
"windows" => Ok(Self::Windows),
|
||||
"linux" => Ok(Self::Linux),
|
||||
"macos" => Ok(Self::Mac),
|
||||
_ => Err("nightly-v1 is not defined for this operating system".into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn ignores_case(self) -> bool {
|
||||
self != Self::Linux
|
||||
}
|
||||
}
|
||||
|
||||
fn absolute(path: PathBuf, label: &str) -> Result<PathBuf, String> {
|
||||
if !path.is_absolute() || path.components().any(|c| matches!(c, Component::ParentDir)) {
|
||||
return Err(format!("{label} must be absolute and contain no parent traversal"));
|
||||
}
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
fn required_base(env: &impl Fn(&str) -> Option<OsString>, key: &str) -> Result<PathBuf, String> {
|
||||
let value = env(key).filter(|v| !v.is_empty()).ok_or_else(|| format!("cannot establish the stable {key} boundary"))?;
|
||||
absolute(PathBuf::from(value), key)
|
||||
}
|
||||
|
||||
fn xdg_base(env: &impl Fn(&str) -> Option<OsString>, key: &str, fallback: &str) -> Result<PathBuf, String> {
|
||||
match env(key).filter(|v| !v.is_empty()) {
|
||||
Some(value) => absolute(PathBuf::from(value), key),
|
||||
None => Ok(required_base(env, "HOME")?.join(fallback)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Resolve existing ancestors before creating anything. A dangling link or inaccessible ancestor
|
||||
/// is not a missing directory that may be replaced or followed later.
|
||||
fn canonical_future(path: &Path) -> Result<PathBuf, String> {
|
||||
let mut parent = path;
|
||||
let mut missing = Vec::new();
|
||||
loop {
|
||||
match std::fs::symlink_metadata(parent) {
|
||||
Ok(_) => break,
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
|
||||
missing.push(parent.file_name().ok_or("the profile root has no existing ancestor")?.to_os_string());
|
||||
parent = parent.parent().ok_or("the profile root has no existing ancestor")?;
|
||||
}
|
||||
Err(error) => return Err(format!("cannot inspect the profile boundary: {error}")),
|
||||
}
|
||||
}
|
||||
let mut resolved = std::fs::canonicalize(parent).map_err(|e| format!("cannot resolve the profile boundary: {e}"))?;
|
||||
for part in missing.into_iter().rev() {
|
||||
resolved.push(part);
|
||||
}
|
||||
Ok(resolved)
|
||||
}
|
||||
|
||||
fn overlaps(a: &Path, b: &Path, platform: Platform) -> bool {
|
||||
let parts = |p: &Path| {
|
||||
p.components()
|
||||
.map(|c| {
|
||||
let value = c.as_os_str().to_string_lossy().into_owned();
|
||||
if platform.ignores_case() { value.to_lowercase() } else { value }
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let (a, b) = (parts(a), parts(b));
|
||||
a.starts_with(&b) || b.starts_with(&a)
|
||||
}
|
||||
|
||||
fn installation_boundary(platform: Platform, exe: &Path) -> Result<PathBuf, String> {
|
||||
let parent = exe.parent().ok_or("cannot establish the installation boundary")?;
|
||||
if platform == Platform::Mac {
|
||||
// A profile in Resources is still inside the versioned install, not beside MacOS.
|
||||
if let Some(bundle) = exe.ancestors().find(|p| p.extension().is_some_and(|ext| ext.eq_ignore_ascii_case("app"))) {
|
||||
return Ok(bundle.to_path_buf());
|
||||
}
|
||||
}
|
||||
Ok(parent.to_path_buf())
|
||||
}
|
||||
|
||||
fn forbidden_roots(platform: Platform, env: &impl Fn(&str) -> Option<OsString>, exe: &Path) -> Result<Vec<PathBuf>, String> {
|
||||
let mut roots = match platform {
|
||||
Platform::Windows => {
|
||||
let mut roots = ["APPDATA", "LOCALAPPDATA"]
|
||||
.into_iter()
|
||||
.map(|key| required_base(env, key).map(|p| p.join("SoundCraft")))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
// The MSI's default per-user and per-machine folders (install-policy.wxi). A custom
|
||||
// install folder is not known here; the executable's own folder is fenced below.
|
||||
roots.push(required_base(env, "LOCALAPPDATA")?.join("Programs").join("ArtCraft").join("SoundCraft"));
|
||||
for key in ["ProgramW6432", "ProgramFiles", "ProgramFiles(x86)"] {
|
||||
if let Some(base) = env(key).filter(|v| !v.is_empty()) {
|
||||
roots.push(absolute(PathBuf::from(base), key)?.join("ArtCraft").join("SoundCraft"));
|
||||
}
|
||||
}
|
||||
roots
|
||||
}
|
||||
Platform::Linux => {
|
||||
let mut roots =
|
||||
[("XDG_CONFIG_HOME", ".config"), ("XDG_DATA_HOME", ".local/share"), ("XDG_CACHE_HOME", ".cache"), ("XDG_STATE_HOME", ".local/state")]
|
||||
.into_iter()
|
||||
.map(|(key, fallback)| xdg_base(env, key, fallback).map(|p| p.join("soundcraft")))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
roots.extend(["/usr/bin/soundcraft", "/usr/local/bin/soundcraft", "/opt/soundcraft"].map(PathBuf::from));
|
||||
// The stable Flatpak keeps its data in its own per-app folder.
|
||||
roots.push(required_base(env, "HOME")?.join(".var/app/ai.storyteller.soundcraft"));
|
||||
roots
|
||||
}
|
||||
Platform::Mac => {
|
||||
let home = required_base(env, "HOME")?;
|
||||
let library = home.join("Library");
|
||||
vec![
|
||||
library.join("Application Support/SoundCraft"),
|
||||
library.join("Caches/SoundCraft"),
|
||||
library.join("Caches/ai.storyteller.soundcraft"),
|
||||
library.join("Preferences/SoundCraft"),
|
||||
library.join("Preferences/ai.storyteller.soundcraft.plist"),
|
||||
library.join("Saved Application State/ai.storyteller.soundcraft.savedState"),
|
||||
home.join("Applications/SoundCraft.app"),
|
||||
PathBuf::from("/Applications/SoundCraft.app"),
|
||||
]
|
||||
}
|
||||
};
|
||||
roots.push(installation_boundary(platform, exe)?);
|
||||
roots.into_iter().map(|p| canonical_future(&p)).collect()
|
||||
}
|
||||
|
||||
fn private_subdirectory(root: &Path, name: impl AsRef<Path>, label: &str) -> Result<PathBuf, String> {
|
||||
let chosen = canonical_future(&absolute(root.to_path_buf(), "the nightly profile root")?)?;
|
||||
let child = canonical_future(&chosen.join(name))?;
|
||||
if child == chosen || !child.starts_with(&chosen) {
|
||||
return Err(format!("the nightly {label} must stay inside its selected profile"));
|
||||
}
|
||||
match std::fs::symlink_metadata(&child) {
|
||||
Ok(metadata) if !metadata.is_dir() => return Err(format!("the nightly {label} must be a directory")),
|
||||
Ok(_) => {}
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
|
||||
Err(error) => return Err(format!("cannot inspect the nightly {label}: {error}")),
|
||||
}
|
||||
Ok(child)
|
||||
}
|
||||
|
||||
/// Every existing entry directly in the profile (Presets, logs, settings and so on) must resolve
|
||||
/// inside it, so a link there cannot point Nightly's writes at another app's data.
|
||||
fn entries_stay_inside(root: &Path) -> Result<(), String> {
|
||||
let entries = match std::fs::read_dir(root) {
|
||||
Ok(entries) => entries,
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),
|
||||
Err(error) => return Err(format!("cannot inspect the nightly profile: {error}")),
|
||||
};
|
||||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("cannot inspect the nightly profile: {e}"))?;
|
||||
let path = entry.path();
|
||||
let metadata = std::fs::symlink_metadata(&path).map_err(|e| format!("cannot inspect the nightly profile: {e}"))?;
|
||||
// Settings and session state are ordinary files, not directories. Keep the existing
|
||||
// directory-boundary check for folders (including the known folder-only entries).
|
||||
let folder_only = PROFILE_FOLDERS.iter().any(|name| entry.file_name().eq_ignore_ascii_case(name));
|
||||
if metadata.is_file() && !folder_only {
|
||||
private_regular_file(&path, &metadata)?;
|
||||
} else {
|
||||
private_subdirectory(root, entry.file_name(), "profile entry")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Persisted files must have their own ordinary file identity, not an alias to other data.
|
||||
fn private_regular_file(path: &Path, metadata: &std::fs::Metadata) -> Result<(), String> {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::MetadataExt as _;
|
||||
if metadata.nlink() != 1 {
|
||||
return Err("the nightly profile file must not be shared".into());
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use winsafe::{HFILE, co};
|
||||
let (file, _) = HFILE::CreateFile(
|
||||
path.to_str().ok_or("the nightly profile file path is not textual")?,
|
||||
co::GENERIC::default(),
|
||||
Some(co::FILE_SHARE::READ | co::FILE_SHARE::WRITE | co::FILE_SHARE::DELETE),
|
||||
None,
|
||||
co::DISPOSITION::OPEN_EXISTING,
|
||||
co::FILE_ATTRIBUTE::NORMAL,
|
||||
Some(co::FILE_FLAG::OPEN_REPARSE_POINT),
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
let info = file.GetFileInformationByHandle().map_err(|e| e.to_string())?;
|
||||
if info.dwFileAttributes.has(co::FILE_ATTRIBUTE::REPARSE_POINT | co::FILE_ATTRIBUTE::DIRECTORY) {
|
||||
return Err("the nightly profile file must not be an alias or directory".into());
|
||||
}
|
||||
if info.nNumberOfLinks != 1 {
|
||||
return Err("the nightly profile file must not be shared".into());
|
||||
}
|
||||
}
|
||||
let _ = (path, metadata);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Recognise the shared portable data namespace in both the supplied and resolved path.
|
||||
/// This is not an inventory of arbitrary custom Stable overrides or a Launcher ownership proof.
|
||||
fn is_portable_layout(path: &Path, platform: Platform) -> bool {
|
||||
// A folder under a portable copy belongs to that copy too. Above the chosen folder itself, a
|
||||
// marker only counts beside a SoundCraft executable, so an unrelated portable.txt higher up
|
||||
// (in a user folder or at a drive root) does not refuse the profile.
|
||||
path.ancestors().enumerate().any(|(depth, ancestor)| {
|
||||
portable_marker(ancestor).is_some() && (depth == 0 || ["soundcraft.exe", "soundcraft"].iter().any(|exe| ancestor.join(exe).is_file()))
|
||||
}) || path.components().any(|component| match component {
|
||||
Component::Normal(name) if platform.ignores_case() => name.to_string_lossy().eq_ignore_ascii_case(PORTABLE_DATA_DIR),
|
||||
Component::Normal(name) => name == PORTABLE_DATA_DIR,
|
||||
_ => false,
|
||||
})
|
||||
}
|
||||
|
||||
/// The writable hook is the app's existing exclusive probe. Keeping it injected lets filesystem
|
||||
/// boundary tests exercise the real policy without starting the app or changing global state.
|
||||
pub fn validate(
|
||||
root: &Path,
|
||||
env: impl Fn(&str) -> Option<OsString>,
|
||||
exe: Option<&Path>,
|
||||
writable: impl FnOnce(&Path) -> std::io::Result<()>,
|
||||
) -> Result<PathBuf, String> {
|
||||
validate_for(Platform::current()?, root, env, exe, writable)
|
||||
}
|
||||
|
||||
fn validate_for(
|
||||
platform: Platform,
|
||||
root: &Path,
|
||||
env: impl Fn(&str) -> Option<OsString>,
|
||||
exe: Option<&Path>,
|
||||
writable: impl FnOnce(&Path) -> std::io::Result<()>,
|
||||
) -> Result<PathBuf, String> {
|
||||
absolute(root.to_path_buf(), "the nightly profile root")?;
|
||||
if env("SOUNDCRAFT_CONFIG_DIR").is_some_and(|v| !v.is_empty()) {
|
||||
// The Launcher protocol is the one root the app validates. A wrapper that isolates with
|
||||
// the stable override variable instead passes the profile explicitly; the message names
|
||||
// that, because this is what a Linux nightly launcher hits when it exports the variable.
|
||||
return Err(
|
||||
"nightly-v1 cannot be combined with SOUNDCRAFT_CONFIG_DIR; pass --launch-profile nightly-v1 --profile-root <dir> -- instead".into()
|
||||
);
|
||||
}
|
||||
// These rows are native tar/app-bundle launches, not a Flatpak package. Inheriting its
|
||||
// runtime socket namespace could point another profile at the stable app's socket. The
|
||||
// Nightly Flatpak is the exception: its own app id is the sandbox, so $HOME and the XDG
|
||||
// folders in there are already this package's own.
|
||||
if platform != Platform::Windows
|
||||
&& let Some(instance) = env("FLATPAK_ID").filter(|v| !v.is_empty())
|
||||
&& instance.to_string_lossy() != NIGHTLY_FLATPAK_ID
|
||||
{
|
||||
return Err("nightly-v1 native packages cannot inherit a Flatpak instance; launch through the native Launcher".into());
|
||||
}
|
||||
let chosen = canonical_future(root)?;
|
||||
if is_portable_layout(root, platform) || is_portable_layout(&chosen, platform) {
|
||||
return Err("the nightly root must not use a portable SoundCraft installation or its SoundCraftData settings folder".into());
|
||||
}
|
||||
let exe = absolute(exe.ok_or("cannot establish the installation boundary")?.to_path_buf(), "the executable")?;
|
||||
let forbidden = forbidden_roots(platform, &env, &exe)?;
|
||||
if forbidden.iter().any(|stable| overlaps(&chosen, stable, platform)) {
|
||||
return Err("the nightly root must not overlap stable data or an installation".into());
|
||||
}
|
||||
entries_stay_inside(&chosen)?;
|
||||
// Autosave is swept and rewritten on start and Presets are written in place: never let either
|
||||
// alias leave this private profile, including toward a Stable portable directory we cannot know.
|
||||
private_subdirectory(&chosen, "Autosave", "autosave folder")?;
|
||||
private_subdirectory(&chosen, "Presets", "presets folder")?;
|
||||
let mut create = std::fs::DirBuilder::new();
|
||||
create.recursive(true);
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::DirBuilderExt as _;
|
||||
create.mode(0o700);
|
||||
}
|
||||
create.create(&chosen).map_err(|e| format!("cannot create the nightly profile: {e}"))?;
|
||||
let confirmed = std::fs::canonicalize(&chosen).map_err(|e| format!("cannot resolve the created nightly profile: {e}"))?;
|
||||
if confirmed != chosen || forbidden.iter().any(|stable| overlaps(&confirmed, stable, platform)) {
|
||||
return Err("the nightly profile changed while it was being validated".into());
|
||||
}
|
||||
private_subdirectory(&confirmed, "Autosave", "autosave folder")?;
|
||||
private_subdirectory(&confirmed, "Presets", "presets folder")?;
|
||||
entries_stay_inside(&confirmed)?;
|
||||
writable(&confirmed).map_err(|e| format!("the nightly profile is not writable: {e}"))?;
|
||||
Ok(confirmed)
|
||||
}
|
||||
|
||||
const PROFILE_FOLDERS: [&str; 3] = ["Autosave", "Presets", "logs"];
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
struct Fixture {
|
||||
root: PathBuf,
|
||||
env: BTreeMap<String, OsString>,
|
||||
exe: PathBuf,
|
||||
}
|
||||
|
||||
impl Fixture {
|
||||
fn new() -> Self {
|
||||
static NEXT: AtomicU64 = AtomicU64::new(0);
|
||||
let root = loop {
|
||||
let candidate =
|
||||
std::env::temp_dir().join(format!("soundcraft-profile-policy-{}-{}", std::process::id(), NEXT.fetch_add(1, Ordering::Relaxed)));
|
||||
match std::fs::create_dir(&candidate) {
|
||||
Ok(()) => break std::fs::canonicalize(candidate).unwrap(),
|
||||
Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => continue,
|
||||
Err(error) => panic!("cannot create owned fixture: {error}"),
|
||||
}
|
||||
};
|
||||
let home = root.join("home");
|
||||
let exe = root.join("install/soundcraft");
|
||||
std::fs::create_dir_all(&home).unwrap();
|
||||
std::fs::create_dir_all(exe.parent().unwrap()).unwrap();
|
||||
std::fs::write(&exe, b"fixture executable, never run").unwrap();
|
||||
let env = [("HOME", home), ("APPDATA", root.join("roaming")), ("LOCALAPPDATA", root.join("local"))]
|
||||
.into_iter()
|
||||
.map(|(key, value)| (key.into(), value.into_os_string()))
|
||||
.collect();
|
||||
Self { root, env, exe }
|
||||
}
|
||||
|
||||
fn get(&self, key: &str) -> Option<OsString> {
|
||||
self.env.get(key).cloned()
|
||||
}
|
||||
|
||||
fn check(&self, platform: Platform, root: &Path) -> Result<PathBuf, String> {
|
||||
validate_for(
|
||||
platform,
|
||||
root,
|
||||
|key| self.get(key),
|
||||
Some(&self.exe),
|
||||
|dir| {
|
||||
let probe = dir.join("exclusive-test-probe");
|
||||
let file = std::fs::OpenOptions::new().write(true).create_new(true).open(&probe)?;
|
||||
drop(file);
|
||||
std::fs::remove_file(probe)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn home(&self) -> PathBuf {
|
||||
PathBuf::from(self.get("HOME").unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Fixture {
|
||||
fn drop(&mut self) {
|
||||
// Only the directory successfully created by this fixture is owned for removal.
|
||||
std::fs::remove_dir_all(&self.root).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn portable_settings_from_another_install_are_refused_before_any_probe() {
|
||||
let fixture = Fixture::new();
|
||||
let stable_install = fixture.root.join("stable portable install");
|
||||
let stable_data = stable_install.join(PORTABLE_DATA_DIR);
|
||||
std::fs::create_dir_all(&stable_data).unwrap();
|
||||
std::fs::write(stable_install.join("portable.txt"), b"owned portable fixture").unwrap();
|
||||
std::fs::write(stable_data.join("settings.json"), b"stable settings must not change").unwrap();
|
||||
for platform in [Platform::Windows, Platform::Linux, Platform::Mac] {
|
||||
for candidate in [&stable_data, &stable_data.join("nested nightly")] {
|
||||
let probed = std::cell::Cell::new(false);
|
||||
let result = validate_for(
|
||||
platform,
|
||||
candidate,
|
||||
|key| fixture.get(key),
|
||||
Some(&fixture.exe),
|
||||
|_| {
|
||||
probed.set(true);
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
assert!(result.is_err(), "a different portable install is not a private Nightly profile");
|
||||
assert!(!probed.get(), "reject portable data before a writable probe");
|
||||
assert!(!stable_data.join("nested nightly").exists());
|
||||
assert_eq!(std::fs::read(stable_data.join("settings.json")).unwrap(), b"stable settings must not change");
|
||||
assert_eq!(std::fs::read_dir(&stable_data).unwrap().count(), 1);
|
||||
}
|
||||
}
|
||||
let private = fixture.root.join("SoundCraftData-backup-name/nightly");
|
||||
assert!(fixture.check(Platform::Linux, &private).is_ok(), "a merely similar name is not a portable settings component");
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn autosave_aliases_cannot_redirect_to_stable_missing_or_profile_root_data() {
|
||||
let fixture = Fixture::new();
|
||||
let stable = fixture.home().join(".local/state/soundcraft");
|
||||
std::fs::create_dir_all(&stable).unwrap();
|
||||
std::fs::write(stable.join("stable-autosave"), b"stable recovery bytes").unwrap();
|
||||
for (index, target) in [stable.clone(), fixture.root.join("missing recovery target")].into_iter().enumerate() {
|
||||
let private = fixture.root.join(format!("nightly-{index}"));
|
||||
std::fs::create_dir(&private).unwrap();
|
||||
std::os::unix::fs::symlink(&target, private.join("Autosave")).unwrap();
|
||||
let probed = std::cell::Cell::new(false);
|
||||
let result = validate_for(
|
||||
Platform::Linux,
|
||||
&private,
|
||||
|key| fixture.get(key),
|
||||
Some(&fixture.exe),
|
||||
|_| {
|
||||
probed.set(true);
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
assert!(result.is_err(), "Autosave must not escape the private profile or follow a dangling alias");
|
||||
assert!(!probed.get());
|
||||
}
|
||||
let private = fixture.root.join("nightly-self");
|
||||
std::fs::create_dir(&private).unwrap();
|
||||
std::os::unix::fs::symlink(&private, private.join("Autosave")).unwrap();
|
||||
assert!(fixture.check(Platform::Linux, &private).is_err(), "Autosave cannot treat all profile settings as autosaves");
|
||||
assert_eq!(std::fs::read(stable.join("stable-autosave")).unwrap(), b"stable recovery bytes");
|
||||
assert_eq!(std::fs::read_dir(stable).unwrap().count(), 1);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn autosave_alias_to_a_private_subfolder_keeps_the_profile_usable() {
|
||||
let fixture = Fixture::new();
|
||||
let private = fixture.root.join("nightly-private");
|
||||
let autosave = private.join("private-recovery");
|
||||
std::fs::create_dir_all(&autosave).unwrap();
|
||||
std::os::unix::fs::symlink(&autosave, private.join("Autosave")).unwrap();
|
||||
assert!(fixture.check(Platform::Linux, &private).is_ok());
|
||||
assert_eq!(std::fs::canonicalize(private.join("Autosave")).unwrap(), autosave);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overlap_check_handles_ancestor_descendant_and_prefix_lookalikes() {
|
||||
let fixture = Fixture::new();
|
||||
let root = fixture.home().join("nightly/profiles/soundcraft");
|
||||
for platform in [Platform::Windows, Platform::Linux, Platform::Mac] {
|
||||
assert!(overlaps(&root, &root.join("Autosave"), platform));
|
||||
assert!(overlaps(&root.join("Autosave"), &root, platform));
|
||||
assert!(!overlaps(&root, &root.with_file_name("soundcraft-other"), platform));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linux_fences_app_xdg_subtrees_but_allows_launcher_sibling() {
|
||||
let mut fixture = Fixture::new();
|
||||
for key in ["XDG_CONFIG_HOME", "XDG_DATA_HOME", "XDG_CACHE_HOME", "XDG_STATE_HOME"] {
|
||||
fixture.env.insert(key.into(), fixture.root.join(key).into_os_string());
|
||||
}
|
||||
for key in ["XDG_CONFIG_HOME", "XDG_DATA_HOME", "XDG_CACHE_HOME", "XDG_STATE_HOME"] {
|
||||
let stable = PathBuf::from(fixture.get(key).unwrap()).join("soundcraft");
|
||||
std::fs::create_dir_all(&stable).unwrap();
|
||||
std::fs::write(stable.join("stable-sentinel"), b"stable bytes").unwrap();
|
||||
for candidate in [stable.clone(), stable.join("nightly"), stable.parent().unwrap().to_path_buf()] {
|
||||
assert!(fixture.check(Platform::Linux, &candidate).unwrap_err().contains("overlap"));
|
||||
}
|
||||
assert_eq!(std::fs::read(stable.join("stable-sentinel")).unwrap(), b"stable bytes");
|
||||
}
|
||||
let data = PathBuf::from(fixture.get("XDG_DATA_HOME").unwrap());
|
||||
let nightly = data.join("ArtCraftLauncher/nightly/profiles/soundcraft");
|
||||
assert_eq!(fixture.check(Platform::Linux, &nightly).unwrap(), nightly);
|
||||
assert_eq!(std::fs::read_dir(nightly).unwrap().count(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nightly_profile_reopens_after_saving_settings_and_session_state() {
|
||||
let fixture = Fixture::new();
|
||||
for platform in [Platform::Mac, Platform::Linux, Platform::Windows] {
|
||||
let private = fixture.root.join(format!("nightly-reopen-{platform:?}"));
|
||||
assert_eq!(fixture.check(platform, &private).unwrap(), private);
|
||||
for name in ["ui.json", "nightly-session.lock", "nightly-session.json"] {
|
||||
std::fs::write(private.join(name), b"saved profile data").unwrap();
|
||||
}
|
||||
for name in PROFILE_FOLDERS {
|
||||
std::fs::create_dir(private.join(name)).unwrap();
|
||||
}
|
||||
assert_eq!(fixture.check(platform, &private).unwrap(), private);
|
||||
assert_eq!(std::fs::read(private.join("ui.json")).unwrap(), b"saved profile data");
|
||||
for name in PROFILE_FOLDERS {
|
||||
let path = private.join(name);
|
||||
std::fs::remove_dir(&path).unwrap();
|
||||
std::fs::write(&path, b"not a directory").unwrap();
|
||||
assert!(fixture.check(platform, &private).is_err(), "{name} must stay a directory");
|
||||
std::fs::remove_file(&path).unwrap();
|
||||
std::fs::create_dir(&path).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mac_fences_only_app_library_subtrees_and_the_entire_bundle() {
|
||||
let mut fixture = Fixture::new();
|
||||
fixture.exe = fixture.root.join("install/SoundCraft Nightly.app/Contents/MacOS/SoundCraft");
|
||||
std::fs::create_dir_all(fixture.exe.parent().unwrap()).unwrap();
|
||||
std::fs::write(&fixture.exe, b"fixture executable, never run").unwrap();
|
||||
let library = fixture.home().join("Library");
|
||||
for suffix in [
|
||||
"Application Support/SoundCraft",
|
||||
"Caches/SoundCraft",
|
||||
"Caches/ai.storyteller.soundcraft",
|
||||
"Preferences/SoundCraft",
|
||||
"Saved Application State/ai.storyteller.soundcraft.savedState",
|
||||
] {
|
||||
let stable = library.join(suffix);
|
||||
assert!(fixture.check(Platform::Mac, &stable.join("nightly")).unwrap_err().contains("overlap"));
|
||||
assert!(!stable.exists());
|
||||
}
|
||||
let inside_resources = fixture.exe.parent().unwrap().parent().unwrap().join("Resources/profile");
|
||||
assert!(fixture.check(Platform::Mac, &inside_resources).unwrap_err().contains("overlap"));
|
||||
assert!(!inside_resources.exists());
|
||||
let valid = library.join("Application Support/ArtCraftLauncher/nightly/profiles/soundcraft");
|
||||
assert_eq!(fixture.check(Platform::Mac, &valid).unwrap(), valid);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn windows_roaming_local_and_install_fences_remain_active() {
|
||||
let fixture = Fixture::new();
|
||||
for key in ["APPDATA", "LOCALAPPDATA"] {
|
||||
let stable = PathBuf::from(fixture.get(key).unwrap()).join("SoundCraft");
|
||||
assert!(fixture.check(Platform::Windows, &stable.join("nightly")).unwrap_err().contains("overlap"));
|
||||
assert!(!stable.exists());
|
||||
}
|
||||
assert!(fixture.check(Platform::Windows, &fixture.exe.parent().unwrap().join("profile")).is_err());
|
||||
assert!(fixture.check(Platform::Windows, &fixture.root.join("Launcher/profiles/soundcraft")).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn windows_default_msi_install_folders_are_fenced() {
|
||||
let mut fixture = Fixture::new();
|
||||
let local = PathBuf::from(fixture.get("LOCALAPPDATA").unwrap());
|
||||
let per_user = local.join("Programs").join("ArtCraft").join("SoundCraft");
|
||||
assert!(fixture.check(Platform::Windows, &per_user.join("nightly")).unwrap_err().contains("overlap"));
|
||||
for key in ["ProgramW6432", "ProgramFiles", "ProgramFiles(x86)"] {
|
||||
let base = fixture.root.join(format!("machine {key}"));
|
||||
fixture.env.insert(key.into(), base.clone().into_os_string());
|
||||
let machine = base.join("ArtCraft").join("SoundCraft");
|
||||
assert!(fixture.check(Platform::Windows, &machine.join("nightly")).unwrap_err().contains("overlap"));
|
||||
assert!(!machine.exists());
|
||||
}
|
||||
let sibling = local.join("Programs").join("ArtCraft").join("ArtCraftLauncher").join("nightly").join("soundcraft");
|
||||
assert!(fixture.check(Platform::Windows, &sibling).is_ok(), "the Launcher's own Programs sibling is not SoundCraft's install");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn folders_under_a_stable_portable_copy_are_refused_before_any_probe() {
|
||||
let fixture = Fixture::new();
|
||||
let portable = fixture.root.join("D/PC");
|
||||
std::fs::create_dir_all(&portable).unwrap();
|
||||
std::fs::write(portable.join("portable.txt"), b"stable portable copy").unwrap();
|
||||
std::fs::write(portable.join("soundcraft.exe"), b"stable portable executable, never run").unwrap();
|
||||
for platform in [Platform::Windows, Platform::Linux, Platform::Mac] {
|
||||
for candidate in [portable.join("nightly"), portable.join("deeper/nightly")] {
|
||||
let probed = std::cell::Cell::new(false);
|
||||
let result = validate_for(
|
||||
platform,
|
||||
&candidate,
|
||||
|key| fixture.get(key),
|
||||
Some(&fixture.exe),
|
||||
|_| {
|
||||
probed.set(true);
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
assert!(result.unwrap_err().contains("portable"));
|
||||
assert!(!probed.get());
|
||||
assert!(!candidate.exists());
|
||||
}
|
||||
}
|
||||
// A portable.txt that no SoundCraft executable sits beside is someone else's file.
|
||||
let unrelated = fixture.root.join("user folder");
|
||||
std::fs::create_dir_all(&unrelated).unwrap();
|
||||
std::fs::write(unrelated.join("portable.txt"), b"another app's marker").unwrap();
|
||||
assert!(fixture.check(Platform::Windows, &unrelated.join("Launcher/nightly/soundcraft")).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linux_fences_the_stable_flatpak_data_folder() {
|
||||
let fixture = Fixture::new();
|
||||
let flatpak = fixture.home().join(".var/app/ai.storyteller.soundcraft");
|
||||
for candidate in [flatpak.clone(), flatpak.join("data/nightly")] {
|
||||
assert!(fixture.check(Platform::Linux, &candidate).unwrap_err().contains("overlap"));
|
||||
}
|
||||
assert!(!flatpak.exists());
|
||||
assert!(fixture.check(Platform::Linux, &fixture.home().join(".var/app/ai.storyteller.launcher/nightly")).is_ok());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn any_profile_entry_alias_must_stay_inside_the_profile() {
|
||||
let fixture = Fixture::new();
|
||||
let stable = fixture.home().join(".config/soundcraft/Presets");
|
||||
std::fs::create_dir_all(&stable).unwrap();
|
||||
std::fs::write(stable.join("stable-preset"), b"stable preset bytes").unwrap();
|
||||
for name in ["Presets", "logs", "settings.json"] {
|
||||
let private = fixture.root.join(format!("nightly-{name}"));
|
||||
std::fs::create_dir(&private).unwrap();
|
||||
std::os::unix::fs::symlink(&stable, private.join(name)).unwrap();
|
||||
let probed = std::cell::Cell::new(false);
|
||||
let result = validate_for(
|
||||
Platform::Linux,
|
||||
&private,
|
||||
|key| fixture.get(key),
|
||||
Some(&fixture.exe),
|
||||
|_| {
|
||||
probed.set(true);
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
assert!(result.is_err(), "{name} must not lead outside the profile");
|
||||
assert!(!probed.get());
|
||||
}
|
||||
let private = fixture.root.join("nightly-inside");
|
||||
std::fs::create_dir_all(private.join("real-presets")).unwrap();
|
||||
std::fs::write(private.join("settings.json"), b"{}").unwrap();
|
||||
std::os::unix::fs::symlink(private.join("real-presets"), private.join("Presets")).unwrap();
|
||||
assert!(fixture.check(Platform::Linux, &private).is_ok(), "regular files and links that stay inside are fine");
|
||||
assert_eq!(std::fs::read(stable.join("stable-preset")).unwrap(), b"stable preset bytes");
|
||||
assert_eq!(std::fs::read_dir(&stable).unwrap().count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ambiguous_environment_and_non_native_sandbox_are_refused_before_creation() {
|
||||
let mut fixture = Fixture::new();
|
||||
let candidate = fixture.home().join("nightly/profiles/soundcraft");
|
||||
fixture.env.insert("XDG_CACHE_HOME".into(), "relative/cache".into());
|
||||
assert!(fixture.check(Platform::Linux, &candidate).unwrap_err().contains("absolute"));
|
||||
fixture.env.remove("XDG_CACHE_HOME");
|
||||
fixture.env.insert("SOUNDCRAFT_CONFIG_DIR".into(), fixture.home().join("custom-stable").into_os_string());
|
||||
assert!(fixture.check(Platform::Linux, &candidate).unwrap_err().contains("SOUNDCRAFT_CONFIG_DIR"));
|
||||
fixture.env.remove("SOUNDCRAFT_CONFIG_DIR");
|
||||
fixture.env.insert("FLATPAK_ID".into(), "ai.storyteller.soundcraft".into());
|
||||
assert!(fixture.check(Platform::Linux, &candidate).unwrap_err().contains("Flatpak"));
|
||||
// The Nightly Flatpak is its own instance: the profile inside it is a sandbox-local folder.
|
||||
fixture.env.insert("FLATPAK_ID".into(), "ai.storyteller.soundcraft.nightly".into());
|
||||
let sandboxed = fixture.home().join(".var/app/ai.storyteller.soundcraft.nightly/config/soundcraft-nightly");
|
||||
assert_eq!(fixture.check(Platform::Linux, &sandboxed).unwrap(), sandboxed);
|
||||
fixture.env.remove("FLATPAK_ID");
|
||||
fixture.env.remove("HOME");
|
||||
assert!(fixture.check(Platform::Linux, &candidate).unwrap_err().contains("HOME"));
|
||||
assert!(!candidate.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn non_directory_and_failed_write_probe_never_fall_back_to_stable() {
|
||||
let fixture = Fixture::new();
|
||||
let file = fixture.home().join("not-a-directory");
|
||||
std::fs::write(&file, b"do not replace me").unwrap();
|
||||
assert!(fixture.check(Platform::Linux, &file).is_err());
|
||||
assert_eq!(std::fs::read(file).unwrap(), b"do not replace me");
|
||||
let candidate = fixture.home().join("nightly");
|
||||
let calls = std::cell::Cell::new(0);
|
||||
let result = validate_for(
|
||||
Platform::Linux,
|
||||
&candidate,
|
||||
|key| fixture.get(key),
|
||||
Some(&fixture.exe),
|
||||
|_| {
|
||||
calls.set(calls.get() + 1);
|
||||
Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "injected write refusal"))
|
||||
},
|
||||
);
|
||||
assert!(result.unwrap_err().contains("not writable"));
|
||||
assert_eq!(calls.get(), 1);
|
||||
assert!(!fixture.home().join(".config/soundcraft").exists());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn symlink_and_dangling_aliases_cannot_create_or_modify_stable_data() {
|
||||
use std::os::unix::fs::symlink;
|
||||
let fixture = Fixture::new();
|
||||
let stable = fixture.home().join(".config/soundcraft");
|
||||
std::fs::create_dir_all(&stable).unwrap();
|
||||
std::fs::write(stable.join("sentinel"), b"untouched").unwrap();
|
||||
let alias = fixture.home().join("alias");
|
||||
symlink(&stable, &alias).unwrap();
|
||||
assert!(fixture.check(Platform::Linux, &alias.join("nightly")).unwrap_err().contains("overlap"));
|
||||
let missing = fixture.home().join("missing-target");
|
||||
let dangling = fixture.home().join("dangling");
|
||||
symlink(&missing, &dangling).unwrap();
|
||||
assert!(fixture.check(Platform::Linux, &dangling.join("nightly")).is_err());
|
||||
assert!(!missing.exists());
|
||||
assert!(!stable.join("nightly").exists());
|
||||
assert_eq!(std::fs::read(stable.join("sentinel")).unwrap(), b"untouched");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 46 KiB |
Binary file not shown.
@@ -0,0 +1,93 @@
|
||||
Copyright © 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
+20
-4
@@ -18,13 +18,27 @@ fn midi_offset(s: &Session, t: &Track) -> i64 {
|
||||
.map_or(0, |v| v as i64)
|
||||
}
|
||||
|
||||
/// Send note on/offs and controllers for MIDI clips overlapping the block.
|
||||
/// Send note on/offs and controllers for MIDI clips overlapping the block. With `chase` (the
|
||||
/// first block after a start or seek), notes already sounding at `pos` are struck at the block
|
||||
/// start too, so a chord that began before a seek is heard rather than skipped until the next one.
|
||||
///
|
||||
/// `live` holds the notes played live on the same instrument. Instruments end notes by pitch, so
|
||||
/// a clip note-off is not sent while a live key holds that pitch: the key's own release ends it.
|
||||
/// A note-off held back that way is told to `live`: when the key goes up earlier in the same
|
||||
/// block, the note still lasts until the clip's note-off.
|
||||
pub(crate) fn schedule_notes(s: &Session, t: &Track, pos: Samples, frames: usize, inst: &mut PluginSlot, held: &mut Vec<u8>, live: &mut LiveNotes) {
|
||||
// The block, the instrument, its held and live notes, and whether this block chases: one call per
|
||||
// block from `render_instrument`, so a struct would only repack these.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn schedule_notes(
|
||||
s: &Session,
|
||||
t: &Track,
|
||||
pos: Samples,
|
||||
frames: usize,
|
||||
inst: &mut PluginSlot,
|
||||
held: &mut Vec<u8>,
|
||||
live: &mut LiveNotes,
|
||||
chase: bool,
|
||||
) {
|
||||
let sr = s.sample_rate;
|
||||
// MIDI Track Offsets: the track's notes sound `offset` samples later (earlier if negative), so
|
||||
// the block looks that far back into the clips.
|
||||
@@ -36,7 +50,9 @@ pub(crate) fn schedule_notes(s: &Session, t: &Track, pos: Samples, frames: usize
|
||||
continue;
|
||||
}
|
||||
let ClipContent::Midi { sequence } = &clip.content else { continue };
|
||||
if !clip.range().overlaps(&Range { start: pos, end }) {
|
||||
// A note-off clamped to the clip end falls on the first sample after the
|
||||
// clip, so a block starting exactly there still releases its notes.
|
||||
if !clip.range().overlaps(&Range { start: pos, end }) && clip.end() != pos {
|
||||
continue;
|
||||
}
|
||||
let base = s.tempo.samples_to_ticks(clip.start, sr);
|
||||
@@ -71,7 +87,7 @@ pub(crate) fn schedule_notes(s: &Session, t: &Track, pos: Samples, frames: usize
|
||||
if on >= clip.end() {
|
||||
continue;
|
||||
}
|
||||
if on >= pos && on < end {
|
||||
if (on >= pos && on < end) || (chase && on < pos && off > pos) {
|
||||
inst.plugin.note_on(usize::try_from(on - pos).unwrap_or(0), n.pitch, n.velocity);
|
||||
if !held.contains(&n.pitch) && held.len() < 128 {
|
||||
held.push(n.pitch);
|
||||
|
||||
+10
-3
@@ -60,6 +60,9 @@ pub(crate) struct Strip {
|
||||
pub(crate) live: LiveNotes,
|
||||
/// The instrument's next block starts somewhere new: send it the controllers in effect there.
|
||||
pub(crate) chase: bool,
|
||||
/// Live controllers moved the instrument and were let go: the next block sends it the clips'
|
||||
/// controllers again, without striking the notes already sounding (that is `chase`).
|
||||
pub(crate) restore_controllers: bool,
|
||||
/// The last block played the clips: stopped monitoring has their sustain pedal to let go of.
|
||||
pub(crate) clips_played: bool,
|
||||
pub(crate) muted: bool,
|
||||
@@ -164,6 +167,7 @@ impl Strip {
|
||||
held: Vec::new(),
|
||||
live: LiveNotes::default(),
|
||||
chase: true,
|
||||
restore_controllers: false,
|
||||
clips_played: false,
|
||||
muted: false,
|
||||
gr: 0.0,
|
||||
@@ -343,7 +347,10 @@ fn render_instrument(s: &Session, t: &Track, strip: &mut Strip, live: &LiveInput
|
||||
}
|
||||
inst.plugin.set_transport(transport);
|
||||
// Whether the clips' controller values were sent to the instrument for this block.
|
||||
let mut chased = std::mem::take(&mut strip.chase);
|
||||
// A start or seek: notes already sounding are struck again too (not when only a live
|
||||
// source went away, below; those notes are still held).
|
||||
let chase = std::mem::take(&mut strip.chase);
|
||||
let mut chased = chase | std::mem::take(&mut strip.restore_controllers);
|
||||
if chased {
|
||||
let from_clips = chase_controllers(s, t, pos, inst);
|
||||
strip.live.restore_defaults(from_clips, inst.plugin.as_mut());
|
||||
@@ -364,7 +371,7 @@ fn render_instrument(s: &Session, t: &Track, strip: &mut Strip, live: &LiveInput
|
||||
chased = true;
|
||||
}
|
||||
if !live.monitor_only {
|
||||
schedule_notes(s, t, pos, frames, inst, &mut strip.held, &mut strip.live);
|
||||
schedule_notes(s, t, pos, frames, inst, &mut strip.held, &mut strip.live, chase);
|
||||
strip.clips_played = true;
|
||||
} else {
|
||||
// Stopped: the clips are silent, only live MIDI input plays. Playback that ran to its
|
||||
@@ -389,7 +396,7 @@ fn render_instrument(s: &Session, t: &Track, strip: &mut Strip, live: &LiveInput
|
||||
strip.live.play(t, inst.plugin.as_mut(), live.midi, live.ports, frames);
|
||||
} else if strip.live.touched() && strip.live.release(inst.plugin.as_mut()) {
|
||||
// Live controllers moved the instrument: the next block sets them from the clips.
|
||||
strip.chase = true;
|
||||
strip.restore_controllers = true;
|
||||
}
|
||||
if strip.buf.len() >= 2 {
|
||||
inst.plugin.process(&mut strip.buf, frames);
|
||||
|
||||
@@ -47,6 +47,20 @@ fn delay_line_change_keeps_buffers_and_history() {
|
||||
assert_eq!(ptrs, after, "delay line reallocated going back to its size");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn note_off_at_the_clip_end_on_a_block_boundary_releases_the_note() {
|
||||
// The note ends with its 24,000-sample clip; 480-frame blocks put that
|
||||
// note-off at the first sample of the block after the clip.
|
||||
let mut s = synth_session(-6.0);
|
||||
if let Some(ins) = s.tracks[0].instrument.as_mut() {
|
||||
ins.params.insert("amp_release".into(), 20.0);
|
||||
}
|
||||
let out = render_range(&s, Range::new(0, 48_000), 480);
|
||||
let peak = |r: std::ops::Range<usize>| out[0].get(r).unwrap_or_default().iter().fold(0.0_f32, |p, x| p.max(x.abs()));
|
||||
assert!(peak(12_000..24_000) > 0.01, "the synth should sound");
|
||||
assert!(peak(30_000..48_000) < 1e-4, "the note must be released at the clip end");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stored_instrument_params_reach_the_plugin() {
|
||||
// #152: a saved instrument level of -12 dB must render quieter than -6 dB.
|
||||
@@ -529,6 +543,36 @@ impl Plugin for Ears {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notes_held_across_a_seek_are_struck_again() {
|
||||
let mut s = Session::default();
|
||||
let t = s.add_track(TrackKind::Instrument, ChannelFormat::Stereo, None);
|
||||
s.track_mut(t).unwrap().instrument = Some(Insert::new("clap:test.keys"));
|
||||
let mut seq = soundcraft_midi::Sequence::default();
|
||||
// A two-note chord over the first two beats at 120 BPM (0..48_000), then a note from beat 3.
|
||||
for pitch in [60, 64] {
|
||||
seq.notes.push(soundcraft_midi::Note { pitch, velocity: 90, release_velocity: 64, channel: 0, start: 0, length: 1920 });
|
||||
}
|
||||
seq.notes.push(soundcraft_midi::Note { pitch: 67, velocity: 90, release_velocity: 64, channel: 0, start: 1920, length: 960 });
|
||||
let cid = s.new_clip_id();
|
||||
s.track_mut(t).unwrap().playlist_mut().unwrap().clips.push(Clip::midi(cid, "m", 0, 96_000, seq));
|
||||
let heard = Arc::new(std::sync::Mutex::new(Vec::new()));
|
||||
let keys = Keys { inner: soundcraft_dsp::create("gain").unwrap(), heard: Arc::clone(&heard) };
|
||||
let mut eng = MixEngine::new(48_000.0, 512);
|
||||
eng.set_external_instances(true);
|
||||
eng.adopt(vec![PreparedInstance { track: t, slot: INSTRUMENT_SLOT, id: "clap:test.keys".into(), ch: 2, plugin: Box::new(keys) }]);
|
||||
render_block(&mut eng, &s, 0);
|
||||
assert_eq!(std::mem::take(&mut *heard.lock().unwrap()), vec![(60, 90), (64, 90)]);
|
||||
render_block(&mut eng, &s, 512);
|
||||
assert!(heard.lock().unwrap().is_empty(), "continuing playback does not strike held notes again");
|
||||
// Seek into the middle of the chord: both notes sound again from the block start.
|
||||
render_block(&mut eng, &s, 24_000);
|
||||
assert_eq!(std::mem::take(&mut *heard.lock().unwrap()), vec![(60, 90), (64, 90)]);
|
||||
// Seek past the chord into the later note: only that one is chased.
|
||||
render_block(&mut eng, &s, 60_000);
|
||||
assert_eq!(std::mem::take(&mut *heard.lock().unwrap()), vec![(67, 90)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn controllers_play_at_their_offsets_and_are_chased_after_a_seek() {
|
||||
let mut s = Session::default();
|
||||
|
||||
@@ -1793,6 +1793,7 @@ pub(super) fn translate(source: &str) -> Option<&'static str> {
|
||||
"SoundFlow" => "SoundFlow",
|
||||
"Space Clips…" => "Espaciar clips…",
|
||||
"Spanish" => "Español",
|
||||
"Simplified Chinese" => "Chino simplificado",
|
||||
"Speed Ramp" => "Speed Ramp",
|
||||
"Splice" => "Splice",
|
||||
"Split into Mono" => "Dividir en mono",
|
||||
|
||||
@@ -1181,6 +1181,7 @@ pub(super) fn translate(source: &str) -> Option<&'static str> {
|
||||
"SoundFlow" => "SoundFlow",
|
||||
"Space Clips…" => "Espacer les clips…",
|
||||
"Spanish" => "Espagnol",
|
||||
"Simplified Chinese" => "Chinois simplifié",
|
||||
"Speed Ramp" => "Speed Ramp",
|
||||
"Splice" => "Splice",
|
||||
"Split into Mono" => "Scinder en mono",
|
||||
|
||||
@@ -1784,6 +1784,7 @@ fn menu_translate(source: &str) -> Option<&'static str> {
|
||||
"Portuguese (Brazil)" => "Português (Brasil)",
|
||||
"French" => "Francês",
|
||||
"Spanish" => "Espanhol",
|
||||
"Simplified Chinese" => "Chinês simplificado",
|
||||
"key:Space" => "Espaço",
|
||||
"key:Up" => "Cima",
|
||||
"key:Down" => "Baixo",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+196
-20
@@ -1,10 +1,13 @@
|
||||
//! Fonts: egui's bundled defaults, plus the operating system's own UI fonts loaded at runtime when
|
||||
//! present (never redistributed). A "bold" family is always defined so the UI can use it.
|
||||
//! present (never redistributed). The web build, which reaches no operating-system fonts, bundles a
|
||||
//! small Open Font License subset of Noto Sans SC instead (see `assets/fonts/` and
|
||||
//! `ATTRIBUTION.md`). A "bold" family is always defined so the UI can use it.
|
||||
|
||||
use egui::{FontData, FontDefinitions, FontFamily};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// (path, ttc index) candidates for regular and bold UI text, by platform.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const REGULAR: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/HelveticaNeue.ttc", 0),
|
||||
("/System/Library/Fonts/Helvetica.ttc", 0),
|
||||
@@ -17,6 +20,7 @@ const REGULAR: &[(&str, u32)] = &[
|
||||
("/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf", 0),
|
||||
("/usr/share/fonts/liberation-sans-fonts/LiberationSans-Regular.ttf", 0),
|
||||
];
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const BOLD: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/HelveticaNeue.ttc", 1),
|
||||
("/System/Library/Fonts/Helvetica.ttc", 1),
|
||||
@@ -31,6 +35,7 @@ const BOLD: &[(&str, u32)] = &[
|
||||
];
|
||||
/// Hangul fallback, appended after every family so Korean session, track and clip names draw
|
||||
/// whatever the interface language. The Noto Sans CJK collection's face 1 is its Korean face.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const HANGUL: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/AppleSDGothicNeo.ttc", 0),
|
||||
("/System/Library/Fonts/Supplemental/AppleGothic.ttf", 0),
|
||||
@@ -42,9 +47,40 @@ const HANGUL: &[(&str, u32)] = &[
|
||||
("/usr/share/fonts/truetype/nanum/NanumGothic.ttf", 0),
|
||||
("/usr/share/fonts/naver-nanum/NanumGothic.ttf", 0),
|
||||
];
|
||||
/// Han fallback (Simplified Chinese first), placed before [`HANGUL`] for every interface language
|
||||
/// except Korean, so a Chinese interface and Chinese session, track and clip names draw in Chinese
|
||||
/// shapes instead of boxes. On Linux the first resolvable CJK face is often Noto Sans CJK's Korean
|
||||
/// face, whose Han glyphs are Korean-styled; the first face with a glyph wins, so Han must come
|
||||
/// first. Face 2 of the Noto Sans CJK collection is its Simplified Chinese face (face 0 is
|
||||
/// Japanese, 1 Korean), and `Source Han Sans SC` / `Noto Sans CJK SC` ship as single-face files.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const HAN: &[(&str, u32)] = &[
|
||||
("/System/Library/Fonts/PingFang.ttc", 0),
|
||||
("/System/Library/Fonts/Supplemental/Songti.ttc", 0),
|
||||
("/System/Library/Fonts/STHeiti Light.ttc", 0),
|
||||
("C:\\Windows\\Fonts\\msyh.ttc", 0),
|
||||
("C:\\Windows\\Fonts\\msyh.ttf", 0),
|
||||
("C:\\Windows\\Fonts\\simhei.ttf", 0),
|
||||
("/usr/share/fonts/opentype/source-han-cjk/SourceHanSansSC-Regular.otf", 0),
|
||||
("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc", 2),
|
||||
("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", 2),
|
||||
("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc", 2),
|
||||
("/usr/share/fonts/opentype/noto/NotoSansCJKsc-Regular.otf", 0),
|
||||
("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc", 0),
|
||||
("/usr/share/fonts/wqy-microhei/wqy-microhei.ttc", 0),
|
||||
("/usr/share/fonts/truetype/arphic/uming.ttc", 0),
|
||||
];
|
||||
/// Font files larger than this are skipped: egui keeps the whole file in memory.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const MAX_FONT_BYTES: u64 = 64 << 20;
|
||||
/// The Han-capable TrueType font bundled for the web build only: egui's default fonts carry no Han
|
||||
/// glyphs and a browser cannot reach the operating system's fonts, so a Chinese interface would
|
||||
/// draw boxes. It is a Noto Sans SC (OFL-1.1) subset at weight 400 covering a superset of the UI
|
||||
/// glyph set; regenerate it with `docs/i18n/tools/subset_web_font.py`. See `assets/fonts/OFL.txt`
|
||||
/// and `ATTRIBUTION.md`. Native builds never embed it: the include is compiled out of them
|
||||
/// (`test` keeps it available to the glyph-coverage tests).
|
||||
#[cfg(any(target_arch = "wasm32", test))]
|
||||
const BUNDLED_HAN: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/fonts/NotoSansSC-SoundCraftSubset.ttf"));
|
||||
|
||||
/// Asks fontconfig for the desktop's font matching `pattern`. Only TrueType/OpenType results are
|
||||
/// used: egui cannot read Type 1 or bitmap fonts, which `fc-match` may return on minimal systems.
|
||||
@@ -103,34 +139,79 @@ fn load(cands: &[(&str, u32)], pattern: &str, lang: Option<&str>, system_fonts:
|
||||
None
|
||||
}
|
||||
|
||||
/// The web build has no operating-system fonts: the bundled subset is the CJK fallback.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn load(_: &[(&str, u32)], _: &str, _: Option<&str>, _: bool) -> Option<FontData> {
|
||||
None
|
||||
fn bundled_han() -> FontData {
|
||||
FontData::from_static(BUNDLED_HAN)
|
||||
}
|
||||
|
||||
/// The font set: the bundled faces, plus the system ones when `system_fonts` is true.
|
||||
/// Appends `name` as the lowest-priority fallback of every family. Only appends, so the order the
|
||||
/// faces are added in is the order glyphs are looked up in.
|
||||
fn add_fallback(fonts: &mut FontDefinitions, name: &'static str, font: FontData) {
|
||||
fonts.font_data.insert(name.into(), Arc::new(font));
|
||||
for family in fonts.families.values_mut() {
|
||||
family.push(name.into());
|
||||
}
|
||||
}
|
||||
|
||||
/// Should a Chinese-shaped Han face claim the Han glyphs before the Korean face? The first face
|
||||
/// with a glyph wins, so a Chinese interface must come first (on Linux fontconfig often resolves
|
||||
/// Noto Sans CJK's Korean face, whose Han glyphs are Korean-styled). Every interface language
|
||||
/// except Korean orders Han first; Korean reverses the two, so Hangul and Hanja draw from the
|
||||
/// Korean face. A future `zh-Hant` (Traditional Chinese) or `ja` (Japanese) is expected to keep
|
||||
/// Han first as well; only a language-suitable Han face would change (the [`HAN`] list is
|
||||
/// Simplified-first today).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn han_before_hangul(language: &str) -> bool {
|
||||
language.split(['-', '_']).next() != Some("ko")
|
||||
}
|
||||
|
||||
/// The font set: egui's bundled defaults, the operating system's faces where present and when
|
||||
/// `system_fonts` is true, and (web only) the bundled Han face as the last fallback of every
|
||||
/// family. The interface language decides the order of the two CJK fallbacks.
|
||||
pub fn definitions(system_fonts: bool) -> FontDefinitions {
|
||||
let mut fonts = FontDefinitions::default();
|
||||
let base: Vec<String> = fonts.families.get(&FontFamily::Proportional).cloned().unwrap_or_default();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let mut bold_family = base.clone();
|
||||
if let Some(reg) = load(REGULAR, "sans-serif", None, system_fonts) {
|
||||
fonts.font_data.insert("system-regular".into(), Arc::new(reg));
|
||||
if let Some(f) = fonts.families.get_mut(&FontFamily::Proportional) {
|
||||
f.insert(0, "system-regular".into());
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
if let Some(reg) = load(REGULAR, "sans-serif", None, system_fonts) {
|
||||
fonts.font_data.insert("system-regular".into(), Arc::new(reg));
|
||||
if let Some(f) = fonts.families.get_mut(&FontFamily::Proportional) {
|
||||
f.insert(0, "system-regular".into());
|
||||
}
|
||||
}
|
||||
if let Some(b) = load(BOLD, "sans-serif:style=Bold", None, system_fonts) {
|
||||
fonts.font_data.insert("system-bold".into(), Arc::new(b));
|
||||
bold_family.insert(0, "system-bold".into());
|
||||
} else if fonts.font_data.contains_key("system-regular") {
|
||||
bold_family.insert(0, "system-regular".into());
|
||||
}
|
||||
fonts.families.insert(FontFamily::Name("bold".into()), bold_family);
|
||||
// The first face with a glyph wins, so the interface language decides whether a Han or a
|
||||
// Korean face claims the Han glyphs a Chinese interface draws (see `han_before_hangul`).
|
||||
let language = crate::localization::current_language().id();
|
||||
let hangul = load(HANGUL, "sans-serif:lang=ko", Some("ko"), system_fonts);
|
||||
let han = load(HAN, "sans-serif:lang=zh-cn", Some("zh-cn"), system_fonts);
|
||||
let ordered = if han_before_hangul(language) {
|
||||
[("system-han", han), ("system-hangul", hangul)]
|
||||
} else {
|
||||
[("system-hangul", hangul), ("system-han", han)]
|
||||
};
|
||||
for (name, font) in ordered {
|
||||
if let Some(font) = font {
|
||||
add_fallback(&mut fonts, name, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(b) = load(BOLD, "sans-serif:style=Bold", None, system_fonts) {
|
||||
fonts.font_data.insert("system-bold".into(), Arc::new(b));
|
||||
bold_family.insert(0, "system-bold".into());
|
||||
} else if fonts.font_data.contains_key("system-regular") {
|
||||
bold_family.insert(0, "system-regular".into());
|
||||
}
|
||||
fonts.families.insert(FontFamily::Name("bold".into()), bold_family);
|
||||
if let Some(h) = load(HANGUL, "sans-serif:lang=ko", Some("ko"), system_fonts) {
|
||||
fonts.font_data.insert("system-hangul".into(), Arc::new(h));
|
||||
for family in fonts.families.values_mut() {
|
||||
family.push("system-hangul".into());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
// No system fonts in the browser: the bundled Han face keeps a Chinese interface, and
|
||||
// Chinese session, track and clip names, readable instead of drawing boxes.
|
||||
let _ = system_fonts;
|
||||
fonts.families.insert(FontFamily::Name("bold".into()), base);
|
||||
add_fallback(&mut fonts, "web-han", bundled_han());
|
||||
}
|
||||
fonts
|
||||
}
|
||||
@@ -226,4 +307,99 @@ mod tests {
|
||||
assert!(ctx.fonts_mut(|f| f.has_glyphs(&font, "가한국어세션")), "{family:?} has no Hangul");
|
||||
}
|
||||
}
|
||||
|
||||
/// The interface language orders the two CJK fallbacks: a Chinese interface draws Han glyphs
|
||||
/// from the Han face first, Korean draws them from the Korean face.
|
||||
#[test]
|
||||
fn cjk_fallback_order_follows_the_interface_language() {
|
||||
assert!(han_before_hangul("zh-Hans"));
|
||||
assert!(han_before_hangul("en"));
|
||||
// A future Traditional Chinese or Japanese catalog keeps Han first; only the Han face
|
||||
// itself would become Traditional Chinese or Japanese.
|
||||
assert!(han_before_hangul("zh-Hant"));
|
||||
assert!(han_before_hangul("ja"));
|
||||
assert!(!han_before_hangul("ko"));
|
||||
assert!(!han_before_hangul("ko-kr"));
|
||||
}
|
||||
|
||||
/// Chinese names draw in every family, not as boxes; skipped when the system has no Han font.
|
||||
#[test]
|
||||
fn every_family_draws_han_with_a_system_han_font() {
|
||||
let defs = definitions(true);
|
||||
if !defs.font_data.contains_key("system-han") {
|
||||
eprintln!("skipping: no Han system font");
|
||||
return;
|
||||
}
|
||||
let families: Vec<FontFamily> = defs.families.keys().cloned().collect();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.set_fonts(defs);
|
||||
let mut output = ctx.run_ui(egui::RawInput::default(), |_| {});
|
||||
output.textures_delta.clear();
|
||||
for family in families {
|
||||
let font = egui::FontId::new(13.0, family.clone());
|
||||
assert!(ctx.fonts_mut(|f| f.has_glyphs(&font, "轨道片段混音")), "{family:?} has no Han");
|
||||
}
|
||||
}
|
||||
|
||||
/// Under a Chinese interface every family that resolved both faces puts Han before Hangul, so
|
||||
/// Chinese text never draws in Korean-styled shapes.
|
||||
#[test]
|
||||
fn chinese_interface_puts_han_before_hangul_in_every_family() {
|
||||
let _language = crate::localization::enter(crate::localization::Language::SimplifiedChinese);
|
||||
let defs = definitions(true);
|
||||
let mut compared = 0;
|
||||
for (family, family_fonts) in &defs.families {
|
||||
let han = family_fonts.iter().position(|font| font == "system-han");
|
||||
let hangul = family_fonts.iter().position(|font| font == "system-hangul");
|
||||
if let (Some(han), Some(hangul)) = (han, hangul) {
|
||||
assert!(han < hangul, "{family:?} puts Hangul before Han: {family_fonts:?}");
|
||||
compared += 1;
|
||||
}
|
||||
}
|
||||
if compared == 0 {
|
||||
eprintln!("skipping: no system Han and Hangul fonts resolved");
|
||||
}
|
||||
}
|
||||
|
||||
/// The web fallback chain (egui defaults + the bundled face) draws the entire zh-Hans catalog in
|
||||
/// every family: the property that keeps the browser build free of boxes.
|
||||
#[test]
|
||||
fn bundled_web_font_draws_the_zh_hans_catalog_in_every_family() {
|
||||
let Some(catalog) = zh_hans_catalog() else { return };
|
||||
let mut defs = definitions(false);
|
||||
add_fallback(&mut defs, "web-han", FontData::from_static(BUNDLED_HAN));
|
||||
let mut sample: Vec<char> = catalog.chars().filter(|c| !['\t', '\r', '\n'].contains(c)).collect();
|
||||
sample.sort_unstable();
|
||||
sample.dedup();
|
||||
let sample: String = sample.into_iter().collect();
|
||||
let families: Vec<FontFamily> = defs.families.keys().cloned().collect();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.set_fonts(defs);
|
||||
let mut output = ctx.run_ui(egui::RawInput::default(), |_| {});
|
||||
output.textures_delta.clear();
|
||||
for family in families {
|
||||
let font = egui::FontId::new(13.0, family.clone());
|
||||
let missing: Vec<char> = sample.chars().filter(|c| !ctx.fonts_mut(|fonts| fonts.has_glyphs(&font, &c.to_string()))).collect();
|
||||
assert!(missing.is_empty(), "{family:?} cannot draw {missing:?} of the zh-Hans catalog even with the bundled web font");
|
||||
}
|
||||
}
|
||||
|
||||
/// The asset must not silently grow into a full CJK font, which would bloat the web download.
|
||||
#[test]
|
||||
fn bundled_web_font_stays_within_its_size_budget() {
|
||||
const BUDGET: usize = 2 << 20; // 2 MiB
|
||||
assert!(BUNDLED_HAN.len() <= BUDGET, "the bundled web font is {} bytes; its budget is {BUDGET}", BUNDLED_HAN.len());
|
||||
}
|
||||
|
||||
/// The source of the zh-Hans catalog, or `None` (skip) when it is not checked out.
|
||||
fn zh_hans_catalog() -> Option<String> {
|
||||
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/src/i18n/zh-hans.tsv");
|
||||
match std::fs::read_to_string(path) {
|
||||
Ok(catalog) => Some(catalog),
|
||||
Err(err) => {
|
||||
eprintln!("skipping: cannot read {path}: {err}");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
SoundCraft UI translations — license and provenance
|
||||
====================================================
|
||||
|
||||
`crates/ui-egui/src/i18n/zh-hans.tsv` holds SoundCraft's own Simplified Chinese translation of the
|
||||
English source strings in the code. `crates/ui-egui/locales/zh-Hans/mod.rs` is generated from it by
|
||||
`docs/i18n/tools/gen_zh_hans_locale.py`; edit the TSV, never the module.
|
||||
|
||||
License: MIT OR Apache-2.0, the same terms as the SoundCraft code (see LICENSE-MIT and
|
||||
LICENSE-APACHE in the repository root). The translations are bundled only in the SoundCraft UI; the
|
||||
English source strings in the code remain the canonical text.
|
||||
|
||||
Provenance: the rows are original wording written for SoundCraft. No translated string, glossary or
|
||||
translation memory from another product was copied. Wording decisions and their reasoning are
|
||||
recorded in `docs/i18n/glossary.md`, so a reviewer can challenge a term without leaving the
|
||||
repository.
|
||||
|
||||
Review status: AI-authored, not yet read by a native-speaking audio engineer.
|
||||
|
||||
Rules when editing: keep the format documented at the top of the TSV, keep every `{name}` and `{}`
|
||||
placeholder (and its format spec) exactly, keep a trailing `…` in menu items, and run
|
||||
`python3 docs/i18n/tools/gen_zh_hans_locale.py` followed by
|
||||
`cargo test -p soundcraft-ui-egui --lib`.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@ mod es;
|
||||
mod fr;
|
||||
#[path = "../locales/pt-BR/mod.rs"]
|
||||
mod pt_br;
|
||||
#[path = "../locales/zh-Hans/mod.rs"]
|
||||
mod zh_hans;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
@@ -25,11 +27,13 @@ pub enum Language {
|
||||
French,
|
||||
#[serde(rename = "es")]
|
||||
Spanish,
|
||||
#[serde(rename = "zh-Hans")]
|
||||
SimplifiedChinese,
|
||||
}
|
||||
|
||||
impl Language {
|
||||
/// All supported languages, in the order they are shown in the language menu.
|
||||
pub const ALL: [Self; 4] = [Self::English, Self::PortugueseBrazil, Self::French, Self::Spanish];
|
||||
pub const ALL: [Self; 5] = [Self::English, Self::PortugueseBrazil, Self::French, Self::Spanish, Self::SimplifiedChinese];
|
||||
|
||||
/// Stable language tag used in preferences and control commands.
|
||||
pub const fn id(self) -> &'static str {
|
||||
@@ -38,6 +42,7 @@ impl Language {
|
||||
Self::PortugueseBrazil => "pt-BR",
|
||||
Self::French => "fr",
|
||||
Self::Spanish => "es",
|
||||
Self::SimplifiedChinese => "zh-Hans",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +53,7 @@ impl Language {
|
||||
Self::PortugueseBrazil => "Portuguese (Brazil)",
|
||||
Self::French => "French",
|
||||
Self::Spanish => "Spanish",
|
||||
Self::SimplifiedChinese => "Simplified Chinese",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +66,7 @@ impl Language {
|
||||
match self {
|
||||
Self::English => number.to_owned(),
|
||||
Self::PortugueseBrazil | Self::French | Self::Spanish => number.replace('.', ","),
|
||||
Self::SimplifiedChinese => number.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +77,7 @@ impl Language {
|
||||
Self::PortugueseBrazil => pt_br::translate(source).unwrap_or(source),
|
||||
Self::French => fr::translate(source).unwrap_or(source),
|
||||
Self::Spanish => es::translate(source).unwrap_or(source),
|
||||
Self::SimplifiedChinese => zh_hans::translate(source).unwrap_or(source),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,6 +113,7 @@ fn error_text_in(language: Language, message: &str, depth: usize) -> String {
|
||||
Language::PortugueseBrazil => pt_br::ERROR_TEMPLATES,
|
||||
Language::French => fr::ERROR_TEMPLATES,
|
||||
Language::Spanish => es::ERROR_TEMPLATES,
|
||||
Language::SimplifiedChinese => zh_hans::ERROR_TEMPLATES,
|
||||
};
|
||||
let mut best: Option<(usize, &str, Vec<(String, String)>)> = None;
|
||||
for (template, translation) in templates {
|
||||
@@ -372,12 +381,14 @@ mod tests {
|
||||
assert_eq!(Language::parse(" PT-br "), Some(Language::PortugueseBrazil));
|
||||
assert_eq!(Language::parse(" FR "), Some(Language::French));
|
||||
assert_eq!(Language::parse("de"), None);
|
||||
assert_eq!(Language::parse(" ZH-hans "), Some(Language::SimplifiedChinese));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn language_translations_fall_back_to_the_english_source() {
|
||||
assert_ne!(Language::PortugueseBrazil.text("Appearance"), "Appearance");
|
||||
assert_eq!(Language::PortugueseBrazil.text("A source string with no catalog entry"), "A source string with no catalog entry");
|
||||
assert_ne!(Language::SimplifiedChinese.text("Appearance"), "Appearance");
|
||||
assert_eq!(Language::English.text("Appearance"), "Appearance");
|
||||
for language in [Language::French, Language::Spanish] {
|
||||
assert_ne!(language.text("Appearance"), "Appearance", "{language:?}");
|
||||
@@ -385,6 +396,25 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simplified_chinese_translates_the_language_menu() {
|
||||
// `Language::native_name` is English source text; the menu draws it through the catalog, so
|
||||
// a Chinese interface must name every language it offers in Chinese.
|
||||
for language in Language::ALL {
|
||||
assert_ne!(Language::SimplifiedChinese.text(language.native_name()), language.native_name(), "{language:?}");
|
||||
}
|
||||
assert_eq!(Language::SimplifiedChinese.text("Simplified Chinese"), "简体中文");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simplified_chinese_catalog_covers_every_menu_label() {
|
||||
for path in include_str!("../../engine/catalog/menus.txt").lines() {
|
||||
for label in path.split(" > ").map(str::trim).filter(|label| !label.is_empty()) {
|
||||
assert!(super::zh_hans::translate(label).is_some(), "missing zh-Hans menu label: {label}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn language_scope_restores_the_previous_language() {
|
||||
assert_eq!(text("Appearance"), "Appearance");
|
||||
@@ -564,21 +594,22 @@ mod tests {
|
||||
assert_eq!(pt.text("Strip"), "Canal", "the Channel Strip plug-in's short name keeps its own key");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_localized_source_string_has_a_catalog_entry() {
|
||||
fn visit(dir: &std::path::Path, missing: &mut Vec<String>) {
|
||||
/// Every string passed to `text` / `localized_format!` in this crate must have an entry in
|
||||
/// `catalog`; `locale` names it in the failure.
|
||||
fn assert_catalog_covers_the_source(catalog: fn(&str) -> Option<&'static str>, locale: &str) {
|
||||
fn visit(dir: &std::path::Path, missing: &mut Vec<String>, catalog: fn(&str) -> Option<&'static str>) {
|
||||
let Ok(read) = std::fs::read_dir(dir) else { return };
|
||||
for entry in read.flatten() {
|
||||
let path = entry.path();
|
||||
if path.is_dir() {
|
||||
visit(&path, missing);
|
||||
visit(&path, missing, catalog);
|
||||
} else if path.extension().is_some_and(|e| e == "rs") && !path.ends_with("localization.rs") {
|
||||
let Ok(text) = std::fs::read_to_string(&path) else { continue };
|
||||
for marker in ["localization::text(\"", "localized_format!(\""] {
|
||||
for (at, _) in text.match_indices(marker) {
|
||||
let start = at + marker.len() - 1;
|
||||
if let Some((source, _)) = literal(&text[start..])
|
||||
&& super::pt_br::translate(&source).is_none()
|
||||
&& catalog(&source).is_none()
|
||||
{
|
||||
missing.push(format!("{}: {source:?}", path.display()));
|
||||
}
|
||||
@@ -588,7 +619,17 @@ mod tests {
|
||||
}
|
||||
}
|
||||
let mut missing = Vec::new();
|
||||
visit(&std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src"), &mut missing);
|
||||
assert!(missing.is_empty(), "strings without a pt-BR entry:\n{}", missing.join("\n"));
|
||||
visit(&std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src"), &mut missing, catalog);
|
||||
assert!(missing.is_empty(), "strings without a {locale} entry:\n{}", missing.join("\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_localized_source_string_has_a_catalog_entry() {
|
||||
assert_catalog_covers_the_source(super::pt_br::translate, "pt-BR");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_localized_source_string_has_a_zh_hans_entry() {
|
||||
assert_catalog_covers_the_source(super::zh_hans::translate, "zh-Hans");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,6 +594,8 @@ mod tests {
|
||||
assert!(app.run("ui.language", json!({"language": "xx"})).is_err());
|
||||
assert_eq!(app.ui.language, crate::localization::Language::PortugueseBrazil);
|
||||
assert!(crate::menus::UI_COMMANDS.iter().any(|command| command.0 == "ui.language"));
|
||||
assert_eq!(app.run("ui.language", json!({"language": "zh-Hans"})), Ok(json!({"language": "zh-Hans"})));
|
||||
assert_eq!(app.ui.language, crate::localization::Language::SimplifiedChinese);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+20
-14
@@ -1,6 +1,6 @@
|
||||
# Where SoundCraft falls short of Pro Tools
|
||||
|
||||
> **Last reviewed:** 2026-11-14 · **Last updated:** 2026-11-25 · **Change:** minor (G-01: the Playback Engine shows the current device choice after a command changes it, and a buffer size the driver does not take is reported; previously trivial: G-04: Number of Loops accepts up to 1,000; crossfade remains open; previously minor: G-06: recording to disk is done (#84, long takes #888); streaming sources remain; previously minor: G-02 shrunk: MIDI input devices work; G-03: strict external-WAV AAF import; previously minor: G-05: plugin editors on Linux/X11; previously trivial: G-09: the pt-BR catalog now covers helper-passed tooltips, the status bar, the remove-session prompt and engine error text; G-08: Frequency Shifter, 28 processors; G-04: volume automation read at every sample, #1354; G-01: `setup.playback_engine` applies the device buffer in the desktop app; G-04: Clip Looping crossfade and loop count) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
> **Last reviewed:** 2026-11-14 · **Last updated:** 2026-11-28 · **Change:** minor (G-09: the zh-Hans catalog now covers the fixed UI strings, with a Han fallback and a web subset; previously minor: G-05: the signed macOS app and CLI carry the plugin-loading entitlements; previously minor: G-01: the Playback Engine shows the current device choice after a command changes it, and a buffer size the driver does not take is reported; previously trivial: G-04: Number of Loops accepts up to 1,000; crossfade remains open; previously minor: G-06: recording to disk is done (#84, long takes #888); streaming sources remain; previously minor: G-02 shrunk: MIDI input devices work; G-03: strict external-WAV AAF import; previously minor: G-05: plugin editors on Linux/X11; previously trivial: G-09: the pt-BR catalog now covers helper-passed tooltips, the status bar, the remove-session prompt and engine error text; G-08: Frequency Shifter, 28 processors; G-04: volume automation read at every sample, #1354; G-01: `setup.playback_engine` applies the device buffer in the desktop app; G-04: Clip Looping crossfade and loop count) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
|
||||
Every known shortfall, one entry each, ranked by how much it stops a Pro Tools user from doing
|
||||
real work in SoundCraft. This is the work list: pick from the top. Rows marked **alpha blocker**
|
||||
@@ -23,7 +23,7 @@ When you close a gap, delete its entry (or shrink it) in the same PR, and bump t
|
||||
| G-06 | Sources decoded whole into RAM (recording to disk is done: #84, #888) | Performance | [hardware-parity.md](hardware-parity.md) | 15–25 |
|
||||
| G-07 | Nothing is compared against Pro Tools' output (no fidelity harness) | Features | this file | 20–30 |
|
||||
| G-08 | Built-in plugin catalogue thin and unverified | Features | [plugin-parity.md](plugin-parity.md) | 80–120 |
|
||||
| G-09 | English-first UI with a pt-BR catalog (not native-reviewed); all fixed UI strings covered, no CJK/RTL rendering | Localization | [localization-parity.md](localization-parity.md) | 20–40 |
|
||||
| G-09 | English-first UI with pt-BR and zh-Hans catalogs (neither native-reviewed); all fixed UI strings covered, CJK fallback ships, no other Pro Tools languages and no RTL/complex-script shaping | Localization | [localization-parity.md](localization-parity.md) | 55–90 |
|
||||
| G-10 | No control surfaces (HUI/MCU, EUCON) | Hardware | [hardware-parity.md](hardware-parity.md) | 40–70 |
|
||||
| G-11 | No external sync (MTC, LTC, MIDI clock, video reference) | Hardware | [hardware-parity.md](hardware-parity.md) | 15–25 |
|
||||
| G-12 | Immersive delivery: no Dolby Atmos/ADM BWF, MPEG-H, binaural | Features | [file-format-parity.md](file-format-parity.md) | 50–80 |
|
||||
@@ -150,11 +150,14 @@ launch #142; Linux #45, #107.
|
||||
|
||||
### G-05. Plugin hosting on macOS
|
||||
|
||||
- **Missing:** the `com.apple.security.cs.disable-library-validation` entitlement in the signed
|
||||
build, so hardened runtime refuses third-party VST3 bundles (#153, #149). AU editor views
|
||||
- **Fixed (pending release):** the `com.apple.security.cs.disable-library-validation` and
|
||||
`com.apple.security.cs.allow-unsigned-executable-memory` entitlements are now in
|
||||
`entitlements.plist` and applied to the app and the CLI (#153, #149); verify on a signed build
|
||||
with `codesign -d --entitlements - SoundCraft.app` and a third-party VST3.
|
||||
- **Missing:** AU editor views
|
||||
(`crates/au-host/src/lib.rs` header: "Not hosted yet: Audio Unit editor views"). Embedded CLAP
|
||||
GUIs on macOS (#485). VST3 and embedded CLAP editors are hosted on Windows and Linux/X11.
|
||||
- **Estimate:** ≈ 10–15 h (entitlement ≈ 1 h; AU Cocoa views and embedded CLAP on macOS most of it).
|
||||
- **Estimate:** ≈ 9–14 h (AU Cocoa views and embedded CLAP on macOS).
|
||||
|
||||
### G-06. Memory-bound media
|
||||
|
||||
@@ -182,15 +185,17 @@ parametric request #139. ≈ 80–120 h.
|
||||
|
||||
### G-09. Localization
|
||||
|
||||
See [`localization-parity.md`](localization-parity.md): a pt-BR catalog covers the menu labels and
|
||||
every fixed UI string passed to `text` / `localized_format!` or localized inside a button, toggle or
|
||||
close button (test-checked), including the Edit-window status bar, the remove-session question and
|
||||
the send help text; engine errors are matched against catalog templates at display time by
|
||||
`error_text`. What remains is independent native-speaker review plus egui's lack of complex-script
|
||||
shaping and RTL, and the missing other Pro Tools languages; values built at run time (file, track
|
||||
and device names) and engine command parameter documentation stay untranslated. egui has no
|
||||
complex-script shaping or RTL; no CJK font fallback (PR #141 open). ≈ 70–110 h plus
|
||||
native-speaker review.
|
||||
See [`localization-parity.md`](localization-parity.md): pt-BR and zh-Hans catalogs cover the menu
|
||||
labels and every fixed UI string passed to `text` / `localized_format!` or localized inside a button,
|
||||
toggle or close button (test-checked), including the Edit-window status bar, the remove-session
|
||||
question and the send help text; pt-BR also matches engine errors against catalog templates through
|
||||
`error_text`, while zh-Hans keeps diagnostics English. Chinese has a Han font fallback on the desktop
|
||||
(a system face, never redistributed) and an OFL subset in the web build, ordered ahead of the Hangul
|
||||
fallback except under a Korean interface. What remains is independent native-speaker review of both
|
||||
catalogs, the other Pro Tools languages (Spanish, French, German, Japanese, Korean, Traditional
|
||||
Chinese, Hindi/Arabic for the non-target languages), and egui's lack of complex-script shaping and
|
||||
RTL; values built at run time (file, track and device names) and engine command parameter
|
||||
documentation stay untranslated. ≈ 55–90 h plus native-speaker review.
|
||||
|
||||
### G-10. Control surfaces
|
||||
|
||||
@@ -266,6 +271,7 @@ missing. Out of scope unless the owner decides otherwise.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-28 | minor | G-05: library-validation and unsigned-executable-memory entitlements for the macOS app and CLI, so signed builds load third-party plugins (#153, #149); G-05 estimate ≈ 9–14 h |
|
||||
| 2026-11-25 | minor | G-01: the Playback Engine shows the current device choice after a command changes it, and Apply keeps it; a buffer size the driver does not take is reported, with the driver's range (#1757); estimates unchanged |
|
||||
| 2026-11-23 | trivial | G-04: Clip Looping Number of Loops accepts up to 1,000; crossfade remains open; estimates unchanged |
|
||||
| 2026-11-14 | minor | G-03: strict external-WAV AAF import with bounded property caching; AAF/OMF export, OMF import and `.ptx` remain; estimates unchanged |
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# i18n tools and notes
|
||||
|
||||
Working files for SoundCraft's own catalog (`zh-Hans`). The runtime mechanism and the language list
|
||||
are described in [`../localization.md`](../localization.md); the translator workflow in
|
||||
[`../localization-zh-hans.md`](../localization-zh-hans.md); wording decisions in
|
||||
[`glossary.md`](glossary.md).
|
||||
|
||||
| Path | What |
|
||||
|---|---|
|
||||
| `tools/gen_zh_hans_locale.py` | turns `crates/ui-egui/src/i18n/zh-hans.tsv` into `crates/ui-egui/locales/zh-Hans/mod.rs`; `--check` is the CI/`xtask`-style staleness gate |
|
||||
| `tools/subset_web_font.py` | rebuilds `assets/fonts/NotoSansSC-SoundCraftSubset.ttf` from the catalog's glyph set and the pinned Noto Sans SC source |
|
||||
|
||||
## Why the catalog lives here
|
||||
|
||||
The org keeps shared translations in `storytold/craft-i18n`, read through an optional
|
||||
`CRAFT_I18N_DIR` build input. SoundCraft has not cut over (roadmap stage 3d), so — like the pt-BR
|
||||
catalog — this one ships in the repository, and the TSV is the pre-cutover file that
|
||||
`craft-i18n`'s `tools/sync_app.py` consumes when the app does migrate. Nothing here depends on the
|
||||
other repository being present.
|
||||
|
||||
## Clean room, restated
|
||||
|
||||
Write every row from the plain meaning of the English source. Do not read, copy or "check against"
|
||||
another product's translated interface or translation files, and do not download copyleft or
|
||||
proprietary string tables for reference. If a term needs a decision, write the reasoning in
|
||||
[`glossary.md`](glossary.md) instead of citing a source we must not use.
|
||||
|
||||
The translations are original work by SoundCraft contributors (AI-assisted), licensed like the rest
|
||||
of the repository (MIT OR Apache-2.0); see `crates/ui-egui/src/i18n/LICENSE-translations.txt`.
|
||||
@@ -0,0 +1,69 @@
|
||||
# i18n glossary
|
||||
|
||||
The decisions behind SoundCraft's Simplified Chinese wording. The strings themselves live in
|
||||
`crates/ui-egui/src/i18n/zh-hans.tsv`; the mechanism is in
|
||||
[`../localization.md`](../localization.md) and the translator workflow in
|
||||
[`../localization-zh-hans.md`](../localization-zh-hans.md).
|
||||
|
||||
**Clean room.** Every entry is written from the plain meaning of the English source text. Do not
|
||||
consult another product's translation files, string tables or localized interface — not proprietary
|
||||
ones and not copyleft ones. Where a term is hard, argue it here with the reasoning, not with a
|
||||
source we are not allowed to read.
|
||||
|
||||
## 1. Terms we keep
|
||||
|
||||
| English | Ours | Why |
|
||||
|---|---|---|
|
||||
| Session | 会话 | the ordinary word for a DAW project in Chinese; 工程 reads as engineering |
|
||||
| Track | 轨道 | covers audio and MIDI tracks; 音轨 reads as audio-only |
|
||||
| Clip | 片段 | a piece of audio or MIDI on the timeline |
|
||||
| Region | 区域 | kept distinct from clip |
|
||||
| Bus | 总线 | signal-routing bus |
|
||||
| Solo / Mute | 独奏 / 静音 | |
|
||||
| Automation | 自动化 | |
|
||||
| Export / Import | 导出 / 导入 | |
|
||||
| Snap to Grid | 吸附到网格 | |
|
||||
| Normalize | 标准化 | not 归一化, which is the loudness-community word |
|
||||
| Sample rate | 采样率 | |
|
||||
| Mono / Stereo | 单声道 / 立体声 | |
|
||||
| Quantize | 量化 | |
|
||||
| Undo / Redo | 撤销 / 重做 | 撤销 (not 撤消) is the standard spelling |
|
||||
| Preferences | 首选项 | the majority DAW wording in Chinese |
|
||||
| Meter (level) | 电平表 | the level meter |
|
||||
| Meter (time signature) | 拍号 | same English word, different sense: the catalog carries both |
|
||||
| Tempo | 速度 | |
|
||||
| Velocity | 力度 | MIDI note velocity |
|
||||
| Pan | 声像 | the 规范 acoustics term (sound image) |
|
||||
|
||||
## 2. Deliberate choices that differ from the obvious translation
|
||||
|
||||
| English | Ours | Why |
|
||||
|---|---|---|
|
||||
| Transport | 走带 | the standard Chinese audio-engineering word for the transport section |
|
||||
| Bypass | 旁通 | the community word for bypassing a plug-in |
|
||||
| Record / Record Enable | 录音 / 启用录音 | the action, not the medium |
|
||||
| Latch / Touch (automation) | 锁存 / 触碰 | |
|
||||
| Start / End (clip boundary) | 开头 / 结尾 | positions keep 起点 / 终点 |
|
||||
| Key (signature) | 调号 | musical sense |
|
||||
| Trim (edit) / Trim (automation) | 修剪 / 微调 | two senses, kept apart |
|
||||
| Slip / Spot | 滑动 / 定位 | |
|
||||
| Bounce | 导出 | Bounce Mix = 导出混音 |
|
||||
| Big Counter | 大计数器 | the transport readout |
|
||||
|
||||
## 3. Shape of a translated string
|
||||
|
||||
- Chinese punctuation: use full-width `:`、`,`、`(`、`)`、`。`、`?` inside sentences; keep ASCII
|
||||
`·`、`·`、`—`、`/` and the `>` `›` path separators as they are.
|
||||
- Keep a leading space when the English has one: such fragments are appended to a label at run time
|
||||
(`" It is used by {users}"`).
|
||||
- Preserve every `{placeholder}`, including format specs (`{ms:.1}`, `{seconds:.2}`) and positional
|
||||
`{}`; a test compares placeholder sets.
|
||||
- Keep trailing `…` in menu items (`首选项…`), and keep UI symbols (`+`, `−`, `−∞`, `⬆`) as they are.
|
||||
- No spaces around Chinese text; one space between Chinese and Latin words is fine where it helps
|
||||
(`24 位`, `MIDI 轨道`).
|
||||
|
||||
## 4. Review status
|
||||
|
||||
The catalog is AI-authored from the English source and has not been reviewed by a native-speaking
|
||||
audio engineer. Treat wording as provisional until it is; changes go in the TSV, and the module is
|
||||
regenerated.
|
||||
@@ -0,0 +1,139 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate `crates/ui-egui/locales/zh-Hans/mod.rs` from the translator-facing TSV.
|
||||
|
||||
The TSV (`crates/ui-egui/src/i18n/zh-hans.tsv`) is the source translators edit: one row per
|
||||
string, `context<TAB>English source<TAB>Simplified Chinese`. The UI reads the Rust module, because
|
||||
that is how every locale in this repository ships (see `locales/pt-BR/mod.rs`); this script is the
|
||||
only thing that turns one into the other, so the two never drift.
|
||||
|
||||
Usage (from the repository root):
|
||||
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py # write the module
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py --check # fail if it is out of date
|
||||
|
||||
`@plural` rows carry `singular|plural` in the source column, because English inflects where
|
||||
Simplified Chinese does not; both English keys map to the same Chinese row. The columns use the
|
||||
catalog's escapes (`\n`, `\t`, `\\`), which this script decodes before writing the Rust literal.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
TSV = ROOT / "crates/ui-egui/src/i18n/zh-hans.tsv"
|
||||
OUT = ROOT / "crates/ui-egui/locales/zh-Hans/mod.rs"
|
||||
|
||||
HEADER = """\
|
||||
//! Simplified Chinese (`zh-Hans`) catalog, keyed by the English source string.
|
||||
//!
|
||||
//! Generated by `docs/i18n/tools/gen_zh_hans_locale.py` from
|
||||
//! `crates/ui-egui/src/i18n/zh-hans.tsv`; edit the TSV, then rerun the script. Engine diagnostics
|
||||
//! stay English by design, so this catalog has no error templates.
|
||||
|
||||
/// Returns the Simplified Chinese translation for a source-language UI string.
|
||||
#[rustfmt::skip]
|
||||
pub(super) fn translate(source: &str) -> Option<&'static str> {
|
||||
Some(match source {
|
||||
"""
|
||||
|
||||
FOOTER = """\
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Engine error messages with `{name}` placeholders standing for the values they embed. Simplified
|
||||
/// Chinese keeps engine diagnostics in English by design (see `docs/localization-zh-hans.md`).
|
||||
pub(super) const ERROR_TEMPLATES: &[(&str, &str)] = &[];
|
||||
"""
|
||||
|
||||
|
||||
def unescape(text: str) -> str:
|
||||
"""Decode the catalog's `\\n`, `\\t` and `\\\\` escapes (the TSV is one row per string)."""
|
||||
out = []
|
||||
index = 0
|
||||
while index < len(text):
|
||||
ch = text[index]
|
||||
if ch == "\\" and index + 1 < len(text):
|
||||
nxt = text[index + 1]
|
||||
if nxt == "n":
|
||||
out.append("\n")
|
||||
elif nxt == "t":
|
||||
out.append("\t")
|
||||
elif nxt == "\\":
|
||||
out.append("\\")
|
||||
else:
|
||||
out.append(ch)
|
||||
out.append(nxt)
|
||||
index += 2
|
||||
continue
|
||||
out.append(ch)
|
||||
index += 1
|
||||
return "".join(out)
|
||||
|
||||
|
||||
def rust_literal(text: str) -> str:
|
||||
"""A Rust string literal for `text`; the catalogs contain quotes, braces and newlines."""
|
||||
out = []
|
||||
for ch in text:
|
||||
if ch == "\\":
|
||||
out.append("\\\\")
|
||||
elif ch == '"':
|
||||
out.append('\\"')
|
||||
elif ch == "\n":
|
||||
out.append("\\n")
|
||||
elif ch == "\t":
|
||||
out.append("\\t")
|
||||
elif ch == "\r":
|
||||
out.append("\\r")
|
||||
elif ord(ch) < 0x20:
|
||||
out.append(f"\\u{{{ord(ch):x}}}")
|
||||
else:
|
||||
out.append(ch)
|
||||
return '"' + "".join(out) + '"'
|
||||
|
||||
|
||||
def rows() -> dict[str, str]:
|
||||
"""Every English source string mapped to its Chinese translation."""
|
||||
pairs: dict[str, str] = {}
|
||||
for number, line in enumerate(TSV.read_text(encoding="utf-8").splitlines(), start=1):
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
columns = line.split("\t", 2)
|
||||
if len(columns) != 3:
|
||||
raise SystemExit(f"{TSV}:{number}: expected three tab-separated columns")
|
||||
context, source, translation = (unescape(column) for column in columns)
|
||||
if not source or not translation:
|
||||
raise SystemExit(f"{TSV}:{number}: empty source or translation")
|
||||
# A `@plural` row names both English forms; Chinese has one form for both.
|
||||
sources = source.split("|") if context.startswith("@") else [source]
|
||||
for key in sources:
|
||||
previous = pairs.get(key)
|
||||
if previous is not None and previous != translation:
|
||||
raise SystemExit(f"{TSV}:{number}: {key!r} translated twice, differently")
|
||||
pairs[key] = translation
|
||||
return pairs
|
||||
|
||||
|
||||
def render(pairs: dict[str, str]) -> str:
|
||||
arms = "".join(f" {rust_literal(source)} => {rust_literal(pairs[source])},\n" for source in sorted(pairs))
|
||||
return HEADER + arms + FOOTER
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
rendered = render(rows())
|
||||
if "--check" in argv:
|
||||
if not OUT.exists() or OUT.read_text(encoding="utf-8") != rendered:
|
||||
print(f"{OUT} is out of date; run python3 docs/i18n/tools/gen_zh_hans_locale.py", file=sys.stderr)
|
||||
return 1
|
||||
print(f"{OUT}: up to date")
|
||||
return 0
|
||||
OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
OUT.write_text(rendered, encoding="utf-8")
|
||||
print(f"wrote {OUT.relative_to(ROOT)} ({len(rows())} strings)")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
@@ -0,0 +1,162 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerate `assets/fonts/NotoSansSC-SoundCraftSubset.ttf`.
|
||||
|
||||
Usage (run from the repo root):
|
||||
python3 docs/i18n/tools/subset_web_font.py NotoSansSC-VariableFont_wght.ttf
|
||||
python3 docs/i18n/tools/subset_web_font.py --check
|
||||
|
||||
The web build has no operating-system fonts, so it bundles a small subset of
|
||||
Noto Sans SC (SIL OFL-1.1, see `assets/fonts/OFL.txt` and `ATTRIBUTION.md`),
|
||||
pinned at weight 400. The full variable font is a noto-cjk release:
|
||||
https://github.com/notofonts/noto-cjk (Sans/Variable/OTF or the "Subset"
|
||||
OTC — any file whose family is Noto Sans SC with a wght axis).
|
||||
|
||||
The codepoint set is a superset of the UI glyph set:
|
||||
|
||||
- printable ASCII (U+0020-007E) and Latin-1 (U+00A0-00FF);
|
||||
- the GB 2312 level-1 common Han characters (3,755, rows 16-55), so the
|
||||
catalog can grow new everyday words without touching this script;
|
||||
- every BMP, non-control character used in `crates/ui-egui/src/i18n/*.tsv`
|
||||
(sources, translations and comments — emoji outside the BMP come from
|
||||
egui's bundled emoji fonts, see `fonts.rs`);
|
||||
- `EXTRA_SYMBOLS` below: the punctuation, arrows and symbols the UI draws
|
||||
outside the catalogs (meters, transport, musical notation).
|
||||
|
||||
`--check` compares that set against the shipped subset and exits non-zero on
|
||||
any difference; the catalog-side guarantee (every catalog glyph present) is
|
||||
enforced by the `bundled_web_font_*` tests in `crates/ui-egui/src/fonts.rs`.
|
||||
|
||||
Requires fontTools (`pip install fonttools`). Steps: pin weight 400 with
|
||||
`fontTools.varLib.instancer`, then subset with `fontTools.subset`, keeping the
|
||||
name table (the OFL copyright notice rides along) and all layout features.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
REPO = Path(__file__).resolve().parents[3]
|
||||
CATALOG_DIR = REPO / "crates/ui-egui/src/i18n"
|
||||
SHIPPED = REPO / "assets/fonts/NotoSansSC-SoundCraftSubset.ttf"
|
||||
|
||||
# Punctuation, arrows and symbols the UI draws outside the catalogs. Comment
|
||||
# each addition; the `--check` run against the shipped font catches drift.
|
||||
EXTRA_SYMBOLS = (
|
||||
"ΔΣπ" # Greek letters used in math/technical readouts
|
||||
"–‘’′″›※" # dashes, quotes, primes and reference marks
|
||||
"←↑→↓↔⬆" # arrows (transport, nudge, navigation)
|
||||
"∈√∞≈≤≥" # math symbols
|
||||
"⌘" # command-key hint glyphs
|
||||
"─★" # box drawing and rating star
|
||||
"♩♯" # musical notation
|
||||
"〈〉《》「」『』【】〔〕" # CJK brackets
|
||||
"!¥" # fullwidth exclamation mark, yen sign
|
||||
)
|
||||
|
||||
|
||||
def collect_codepoints() -> set[int]:
|
||||
"""The full codepoint set the subset must carry."""
|
||||
points = set(range(0x20, 0x7F)) | set(range(0xA0, 0x100))
|
||||
# GB 2312 level-1 Han: rows 16-55, decoded straight from the encoding so
|
||||
# no external table is needed (row 55 stops at column 89).
|
||||
for row in range(16, 56):
|
||||
for col in range(1, 95):
|
||||
try:
|
||||
points.add(ord(bytes([0xA0 + row, 0xA0 + col]).decode("gb2312")))
|
||||
except UnicodeDecodeError:
|
||||
continue
|
||||
for path in sorted(CATALOG_DIR.glob("*.tsv")):
|
||||
for ch in path.read_text(encoding="utf-8"):
|
||||
cp = ord(ch)
|
||||
if cp <= 0xFFFF and not ch.isspace() and not unicodedata_category_cc(ch):
|
||||
points.add(cp)
|
||||
points |= {ord(ch) for ch in EXTRA_SYMBOLS}
|
||||
return points
|
||||
|
||||
|
||||
def unicodedata_category_cc(ch: str) -> bool:
|
||||
import unicodedata
|
||||
|
||||
return unicodedata.category(ch) == "Cc"
|
||||
|
||||
|
||||
def shipped_codepoints() -> set[int]:
|
||||
from fontTools.ttLib import TTFont
|
||||
|
||||
return set(TTFont(SHIPPED).getBestCmap())
|
||||
|
||||
|
||||
def check(points: set[int]) -> int:
|
||||
shipped = shipped_codepoints()
|
||||
missing = sorted(points - shipped)
|
||||
stale = sorted(shipped - points)
|
||||
for label, diff in (("missing from the shipped subset", missing), ("no longer needed", stale)):
|
||||
if diff:
|
||||
print(f"{label}: {len(diff)}")
|
||||
for cp in diff[:40]:
|
||||
print(f" U+{cp:04X} {chr(cp)}")
|
||||
if missing:
|
||||
print("regenerate: python3 docs/i18n/tools/subset_web_font.py <NotoSansSC variable font>")
|
||||
return 1
|
||||
if stale:
|
||||
print("the recipe and the shipped subset drifted — regenerate or update EXTRA_SYMBOLS")
|
||||
return 1
|
||||
print(f"ok: the shipped subset matches the recipe exactly ({len(points)} codepoints)")
|
||||
return 0
|
||||
|
||||
|
||||
def regenerate(font: Path, points: set[int], out: Path) -> int:
|
||||
from fontTools import subset
|
||||
from fontTools.varLib import instancer
|
||||
|
||||
font_path = font.resolve()
|
||||
out_path = out.resolve()
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
instanced = Path(tmp) / "NotoSansSC-400.ttf"
|
||||
instancer.main([str(font_path), "wght=400", "-o", str(instanced)])
|
||||
unicodes = ",".join(f"U+{cp:04X}" for cp in sorted(points))
|
||||
subset.main([
|
||||
str(instanced),
|
||||
f"--output-file={out_path}",
|
||||
f"--unicodes={unicodes}",
|
||||
"--layout-features=*",
|
||||
"--glyph-names",
|
||||
"--name-IDs=*",
|
||||
"--name-legacy",
|
||||
"--name-languages=*",
|
||||
"--notdef-glyph",
|
||||
"--notdef-outline",
|
||||
"--recommended-glyphs",
|
||||
])
|
||||
size = out_path.stat().st_size
|
||||
print(f"wrote {out_path} ({size} bytes, {len(points)} codepoints)")
|
||||
if size > 2 * 1024 * 1024:
|
||||
print("warning: over the 2 MiB web budget enforced by the fonts.rs tests")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("font", type=Path, nargs="?", help="Noto Sans SC variable font (a noto-cjk release)")
|
||||
ap.add_argument("--out", type=Path, default=SHIPPED)
|
||||
ap.add_argument("--check", action="store_true", help="compare the recipe against the shipped subset and exit")
|
||||
args = ap.parse_args()
|
||||
|
||||
points = collect_codepoints()
|
||||
if args.check:
|
||||
return check(points)
|
||||
if args.font is None:
|
||||
ap.error("a Noto Sans SC variable font is required (or use --check)")
|
||||
return 2
|
||||
if not args.font.is_file():
|
||||
print(f"error: {args.font} is not a file", file=sys.stderr)
|
||||
return 1
|
||||
return regenerate(args.font, points, args.out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
+34
-27
@@ -1,26 +1,25 @@
|
||||
# Localization parity
|
||||
|
||||
> **Last reviewed:** 2026-11-13 · **Last updated:** 2026-11-27 · **Change:** minor (Spanish catalog completed, with native-speaker terminology review; previously minor: French and Spanish catalogs, partial; previously minor: pt-BR catalog completed: all fixed UI strings translated and covered by tests; native-speaker review, CJK/RTL font fallbacks and RTL script shaping still pending) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
> **Last reviewed:** 2026-11-13 · **Last updated:** 2026-11-28 · **Change:** minor (zh-Hans catalog covers the fixed UI strings, with a Han system-font fallback and an OFL web subset; previously minor: Spanish catalog completed, with native-speaker terminology review; previously minor: French and Spanish catalogs, partial; previously minor: pt-BR catalog completed: all fixed UI strings translated and covered by tests; native-speaker review, CJK/RTL font fallbacks and RTL script shaping still pending) · **Target:** Avid Pro Tools Ultimate 2026.4.1
|
||||
|
||||
SoundCraft defaults to English and supports selecting Brazilian Portuguese, French and Spanish. The
|
||||
Spanish catalog covers the same fixed UI strings and engine errors as pt-BR; the French catalog is
|
||||
partial (missing strings show in English). The pt-BR catalog
|
||||
covers all fixed UI strings found in the current source: command labels, menus, Appearance,
|
||||
SoundCraft defaults to English and supports selecting Brazilian Portuguese, French, Spanish and
|
||||
Simplified Chinese. The Spanish catalog covers the same fixed UI strings and engine errors as pt-BR;
|
||||
the French catalog is partial (missing strings show in English). The pt-BR and zh-Hans catalogs
|
||||
cover all fixed UI strings found in the current source: command labels, menus, Appearance,
|
||||
About/Credits, Audio Health, Playback Engine, System Usage, Workspace, plugin parameter and display
|
||||
names, dialogs and buttons, tooltips (including those localized inside buttons and toggles),
|
||||
accessibility names, the Edit-window status bar, the remove-session question and formatted
|
||||
messages. Engine errors are matched against catalog templates at display time by
|
||||
`localization::error_text`. Values built at run time (file, track and device names), engine command
|
||||
parameter documentation and third-party plugin names stay as they are, and the catalog has not been
|
||||
independently or native-speaker reviewed. Pro Tools ships its UI in **8 languages** (bundle
|
||||
`.lproj` folders: English, German, Spanish, French, Japanese, Korean, Simplified Chinese,
|
||||
Traditional Chinese).
|
||||
`localization::error_text`; zh-Hans keeps engine diagnostics in English. Values built at run time
|
||||
(file, track and device names), engine command parameter documentation and third-party plugin names
|
||||
stay as they are, and neither the pt-BR nor the zh-Hans catalog has been independently or
|
||||
native-speaker reviewed. Pro Tools ships its UI in **8 languages** (bundle `.lproj` folders:
|
||||
English, German, Spanish, French, Japanese, Korean, Simplified Chinese, Traditional Chinese).
|
||||
|
||||
**Localization: ~12 %** (measured: 1 of the target's 8 UI languages, and English is the only one
|
||||
complete). Remaining ≈ 70–110 h: a catalog and extraction pass (≈ 15–25 h), a font fallback for
|
||||
CJK/Devanagari/Arabic (PR #141 open), RTL layout and complex-script shaping (egui has neither:
|
||||
≈ 25–40 h, or ship Arabic/Hindi menus-only), then ≈ 3–5 h of agent translation per language, plus
|
||||
native-speaker review (human).
|
||||
**Localization: ~19 %** (measured: 2 of the target's 8 UI languages, and neither translation has had
|
||||
a native-speaker pass). Remaining ≈ 55–90 h: RTL layout and complex-script shaping (egui has
|
||||
neither: ≈ 25–40 h, or ship Arabic/Hindi menus-only), the remaining catalogs (≈ 3–5 h of agent
|
||||
translation each), the Japanese/Korean font faces, and native-speaker review (human).
|
||||
|
||||
Open work: completing the French catalog (rows also kept in storytold/craft-i18n for
|
||||
when SoundCraft reads it), PR #141 (bundled multilingual font fallbacks), issue #67 (Ukrainian).
|
||||
@@ -28,32 +27,39 @@ when SoundCraft reads it), PR #141 (bundled multilingual font fallbacks), issue
|
||||
| Language | Code | UI strings translated | Dialogs / tooltips / help | Script support | Native review | Status | Est. to full (h) | In Pro Tools |
|
||||
|---|---|---|---|---|---|---|---:|---|
|
||||
| English | en | all (source) | ✅ | Latin ✅ | — | **full** | 0 | ✅ |
|
||||
| Simplified Chinese | zh-Hans | 0 (0 %) | ❌ | ❌ no CJK font fallback, no IME testing | no | none | 6–10 | ✅ |
|
||||
| Simplified Chinese | zh-Hans | ✅ 100 % of fixed UI strings: menus, dialogs, buttons, tooltips, accessibility names, status bar, formatted messages | ✅ | Han ✅ (system font on the desktop, OFL subset on the web) | no | **full** | 0–4 (native review) | ✅ |
|
||||
| Spanish | es | ✅ 100 % of fixed UI strings (1,960) and engine errors (254), as pt-BR; catalog and menu-coverage tests pass | 🟡 partial | Latin ✅ | yes (es-ES, sound engineer; terminology reviewed) | full | 0–2 | ✅ |
|
||||
| Hindi | hi | 0 (0 %) | ❌ | ❌ no Devanagari font or shaping | no | none | 8–15 | ❌ |
|
||||
| Arabic | ar | 0 (0 %) | ❌ | ❌ no RTL layout, no shaping | no | none | 15–25 | ❌ |
|
||||
| French | fr | 🟡 1,368 of ~2,210 catalog strings (≈ 62 %); engine errors not yet translated | 🟡 partial | Latin ✅ | no | partial | 1–3 | ✅ |
|
||||
|| Portuguese (Brazil) | pt-BR | ✅ 100 % of fixed UI strings: menus, dialogs, buttons, tooltips, accessibility names, status bar, formatted messages and engine errors; catalog tests pass | 🟡 partial | Latin ✅ | no (native review pending) | full | 0–4 | ❌ |
|
||||
| Portuguese (Brazil) | pt-BR | ✅ 100 % of fixed UI strings: menus, dialogs, buttons, tooltips, accessibility names, status bar, formatted messages and engine errors; catalog tests pass | 🟡 partial | Latin ✅ | no (native review pending) | full | 0–4 | ❌ |
|
||||
| Indonesian | id | 0 (0 %) | ❌ | Latin ✅ | no | none | 3–5 | ❌ |
|
||||
| Japanese | ja | 0 (0 %) | ❌ | ❌ no CJK font fallback, no IME testing | no | none | 6–10 | ✅ |
|
||||
| Japanese | ja | 0 (0 %) | ❌ | 🟡 Han fallback draws Japanese kanji, no kana face and no IME testing | no | none | 6–10 | ✅ |
|
||||
| German | de | 0 (0 %) | ❌ | Latin ✅ | no | none | 3–5 | ✅ |
|
||||
| Korean | ko | 0 (0 %) | ❌ | ❌ no Hangul font fallback | no | none | 6–10 | ✅ |
|
||||
| Korean | ko | 0 (0 %) | ❌ | 🟡 Hangul system-font fallback, no IME testing | no | none | 6–10 | ✅ |
|
||||
| Vietnamese | vi | 0 (0 %) | ❌ | 🟡 Latin with stacked diacritics, untested | no | none | 3–5 | ❌ |
|
||||
|
||||
Other languages shipped: **0**. (Pro Tools also ships Traditional Chinese, zh-Hant.)
|
||||
Other languages shipped: **2**. (Pro Tools also ships Traditional Chinese, zh-Hant.)
|
||||
|
||||
Per-language hours exclude the shared catalog and script work above.
|
||||
Per-language hours exclude the shared catalog and script work above. A Han face now ships for the
|
||||
desktop (system font, never redistributed) and the web (an OFL subset); Traditional Chinese and
|
||||
Japanese would need their own Han faces, since the fallback list is Simplified-first.
|
||||
|
||||
## Usage
|
||||
|
||||
- Pick the language in Appearance ▸ Language, or run the `ui.language` command with
|
||||
`{"language": "pt-BR"}` (or `"en"`, `"fr"`, `"es"`); with no parameter it reports the current language.
|
||||
Example: `soundcraft-cli run --demo --cmd 'ui.language={"language":"pt-BR"}'`.
|
||||
`{"language": "pt-BR"}` (or `"en"`, `"fr"`, `"es"`, `"zh-Hans"`); with no parameter it reports the
|
||||
current language. Example: `soundcraft-cli run --demo --cmd 'ui.language={"language":"zh-Hans"}'`.
|
||||
- The choice is a global preference saved with the UI state (like the theme); recalling a saved
|
||||
window configuration does not change it.
|
||||
- Strings missing from the catalog fall back to English. Add one with a `"English text" => "translated text"`
|
||||
arm in `crates/ui-egui/locales/<tag>/mod.rs`; tests check placeholder parity, duplicates and that every
|
||||
string passed to `text` / `localized_format!` has a pt-BR entry.
|
||||
- Strings missing from the catalog fall back to English, and the tests check placeholder parity,
|
||||
duplicate keys and that every string passed to `text` / `localized_format!` has a pt-BR and a
|
||||
zh-Hans entry.
|
||||
- How a catalog is edited depends on how it is kept. pt-BR, fr and es are hand-written: add a
|
||||
`"English text" => "translated text"` arm to `crates/ui-egui/locales/<tag>/mod.rs`. zh-Hans is
|
||||
generated: add the row to `crates/ui-egui/src/i18n/zh-hans.tsv` and run
|
||||
`python3 docs/i18n/tools/gen_zh_hans_locale.py` — never edit the generated module by hand. See
|
||||
[localization.md](localization.md).
|
||||
|
||||
## Revision history
|
||||
|
||||
@@ -61,6 +67,7 @@ Per-language hours exclude the shared catalog and script work above.
|
||||
|---|---|---|
|
||||
| 2026-11-27 | minor | Completed the Spanish catalog (all fixed UI strings and engine errors) with a native-speaker terminology review; Spanish menu-coverage test; the path prompt's `File path` and `Folder path` fields are translated apart from the Auto Pan `Path` parameter |
|
||||
| 2026-11-24 | minor | French and Spanish catalogs (`locales/fr`, `locales/es`, 1,368 strings each) from PR #143, on the `localization` layer; Appearance ▸ Language lists them; estimates unchanged |
|
||||
| 2026-11-22 | minor | Added the Simplified Chinese catalog on the shared `localization` module (1,383 strings, all menu labels and every `text`/`localized_format!` source covered), a Han system-font fallback ordered ahead of Hangul except for Korean, and a 1.1 MiB OFL Noto Sans SC subset for the web build; catalog and font tests added; localization estimate ~12 % → ~19 % |
|
||||
| 2026-11-13 | minor | Completed the pt-BR catalog: tooltips passed to buttons and toggles, `Not available yet.`, the send hover help, `no instrument`, the search placeholders, the Edit-window status bar (bit depth, track count, undo, ms/frame), the remove-session question and the transport/sample-rate readouts; engine errors now reach the status line through `error_text` |
|
||||
| 2026-11-05 | minor | Added persisted language selection, the `ui.language` command, English fallback and a pt-BR catalog (menus, dialogs, tooltips, accessibility text, formatted messages); added a Usage section and catalog tests |
|
||||
| 2026-10-10 | major | Created: English only, no catalog; the twelve key languages at 0 %; Pro Tools' 8 languages listed from its bundle |
|
||||
| 2026-10-10 | major | Created: English only, no catalog; the twelve key languages at 0 %; Pro Tools' 8 languages listed from its bundle |
|
||||
@@ -0,0 +1,121 @@
|
||||
# Simplified Chinese UI
|
||||
|
||||
SoundCraft's interface can be shown in **简体中文**. The catalog is compiled into the binary
|
||||
(`crates/ui-egui/locales/zh-Hans/mod.rs`), so there is nothing to install and no locale files to
|
||||
find at run time. It covers **every string the UI looks up literally** — menu items and path
|
||||
segments, command labels, dialogs, window titles, tooltips, status-bar and accessibility text and
|
||||
the formatted messages — and every reference menu label in `crates/engine/catalog/menus.txt`.
|
||||
Engine diagnostics and machine-facing surfaces stay English (see
|
||||
[What is translated](#what-is-translated)).
|
||||
|
||||
The mechanism is described in [`localization.md`](localization.md); wording decisions are in
|
||||
[`i18n/glossary.md`](i18n/glossary.md).
|
||||
|
||||
## Selecting the language
|
||||
|
||||
**Setup ▸ Appearance ▸ Language** lists **English** and **简体中文**. Choosing a language applies
|
||||
immediately — menus, panels, dialogs and window titles switch on the next frame, no restart.
|
||||
|
||||
Without the window, use the command:
|
||||
|
||||
```sh
|
||||
soundcraft-cli run --demo --cmd 'ui.language={"language":"zh-Hans"}'
|
||||
```
|
||||
|
||||
`ui.language` with no parameter reports the current language (`{"language":"en"}`), and an unknown
|
||||
tag is an error. The choice is a global preference saved with the UI state (like the theme), so it
|
||||
survives a restart; recalling a saved window configuration never changes it. In the browser the
|
||||
interface starts from `navigator.language`, and the saved preference wins once one exists.
|
||||
|
||||
## What is translated
|
||||
|
||||
English source strings stay in the code and are the lookup keys; the catalog maps them at draw
|
||||
time. Command ids, menu paths used for lookup, preference keys and values, file formats, the
|
||||
control protocol, the CLI and MCP never see translated text, and neither do values built at run
|
||||
time (file, track and device names) or third-party plugin names.
|
||||
|
||||
Engine error messages stay English: a half-translated diagnostic is worse than a whole one, and the
|
||||
`error_text` templates pt-BR carries are deliberately omitted here.
|
||||
|
||||
## Files
|
||||
|
||||
| Path | What |
|
||||
|---|---|
|
||||
| `crates/ui-egui/src/i18n/zh-hans.tsv` | the translator-facing catalog: `context<TAB>English<TAB>translation`, escapes `\n`, `\t`, `\\` |
|
||||
| `crates/ui-egui/locales/zh-Hans/mod.rs` | generated from the TSV; the UI reads this |
|
||||
| `docs/i18n/tools/gen_zh_hans_locale.py` | regenerates the module (`--check` fails when stale) |
|
||||
| `assets/fonts/NotoSansSC-SoundCraftSubset.ttf` | web-only Han font subset, OFL-1.1 |
|
||||
| `docs/i18n/tools/subset_web_font.py` | regenerates the subset from the catalog's glyphs |
|
||||
|
||||
## Editing translations
|
||||
|
||||
```sh
|
||||
# 1. edit crates/ui-egui/src/i18n/zh-hans.tsv (one row per string)
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py # 2. regenerate the module
|
||||
cargo test -p soundcraft-ui-egui --lib # 3. catalog and font tests
|
||||
```
|
||||
|
||||
Keep the English placeholders (`{name}`, `{}`, `{ms:.1}`) exactly as they are: a test compares them.
|
||||
Rows are keyed by the English source, so rewording English text requires updating the row with it.
|
||||
`@plural` rows pair `singular|plural` on one row because Chinese has no plural inflection.
|
||||
|
||||
Look the result up, don't guess: `cargo run -p soundcraft-ui-egui --example ui_shot -- out.png` with a
|
||||
script that sets the language, then read the PNG (and the accessibility tree) before claiming a
|
||||
screen is right.
|
||||
|
||||
## Terminology
|
||||
|
||||
The short table; the reasoning is in [`i18n/glossary.md`](i18n/glossary.md).
|
||||
|
||||
| English | 中文 | Note |
|
||||
|---|---|---|
|
||||
| Session | 会话 | |
|
||||
| Track | 轨道 | audio and MIDI alike; 音轨 reads as audio only |
|
||||
| Clip | 片段 | |
|
||||
| Bus | 总线 | |
|
||||
| Transport | 走带 | standard audio-engineering word |
|
||||
| Pan | 声像 | 规范 acoustics term |
|
||||
| Bypass | 旁通 | |
|
||||
| Record | 录音 | Record Enable = 启用录音 |
|
||||
| Preferences | 首选项 | |
|
||||
| Bounce | 导出 | |
|
||||
| Slip / Spot | 滑动 / 定位 | |
|
||||
| Meter (level) / Meter (time signature) | 电平表 / 拍号 | two senses, two words |
|
||||
| Undo / Redo | 撤销 / 重做 | |
|
||||
|
||||
## Fonts
|
||||
|
||||
egui's bundled faces carry no Han glyphs, so `crates/ui-egui/src/fonts.rs` appends a Han fallback in
|
||||
every family: the operating system's own face on the desktop (fontconfig `lang=zh-cn`, plus
|
||||
per-platform candidates), and the bundled Noto Sans SC subset in the browser, which has no system
|
||||
fonts. Han is ordered before the Hangul fallback for every language except Korean, so Chinese text
|
||||
never draws Korean-styled shapes on Linux where fontconfig resolves Noto Sans CJK's Korean face
|
||||
first.
|
||||
|
||||
The web subset is 1.1 MiB and must stay under 2 MiB (test-enforced). After a catalog change,
|
||||
rebuild it from a Noto Sans SC variable font (a `noto-cjk` release, Sans/Variable/OTF) and check the
|
||||
result:
|
||||
|
||||
```sh
|
||||
# <font>: a Noto Sans SC variable font (family "Noto Sans SC", wght axis) from a noto-cjk release
|
||||
python3 docs/i18n/tools/subset_web_font.py <font> # writes assets/fonts/…
|
||||
python3 docs/i18n/tools/subset_web_font.py --check # fails on drift
|
||||
```
|
||||
|
||||
The test that draws the whole catalog in every family fails until the subset covers the new
|
||||
characters.
|
||||
|
||||
## Validation
|
||||
|
||||
- every localized source string has a zh-Hans entry (test lists what is missing);
|
||||
- placeholders match the English source, keys are unique, every menu label is covered;
|
||||
- the bundled web face draws the whole catalog in every family and fits its budget;
|
||||
- with a system Han font installed, every family draws 轨道片段混音.
|
||||
|
||||
## Known gaps
|
||||
|
||||
- Engine diagnostics stay English.
|
||||
- No native-speaker review yet; the catalog is AI-authored and should be read by a Chinese-speaking
|
||||
audio engineer before it is called finished.
|
||||
- Traditional Chinese (`zh-Hant`) is not shipped; the Han face list is Simplified-first.
|
||||
- No IME testing beyond what the platform provides, and no complex-script shaping (egui has none).
|
||||
@@ -0,0 +1,121 @@
|
||||
# Localization
|
||||
|
||||
SoundCraft's interface ships in English and 简体中文 (Simplified Chinese), and English source text
|
||||
is the key: the strings in the code are what the catalogs translate, so a missing translation falls
|
||||
back to readable English instead of an empty label. Catalogs are compiled into the binary; a
|
||||
release has no catalog files to install or find, and the web build carries them too.
|
||||
|
||||
This page describes the mechanism. For the Chinese catalog itself see
|
||||
[`localization-zh-hans.md`](localization-zh-hans.md); for terminology see
|
||||
[`i18n/glossary.md`](i18n/glossary.md); for coverage against the incumbent see
|
||||
[`localization-parity.md`](localization-parity.md).
|
||||
|
||||
## Supported languages
|
||||
|
||||
| Language | Code | Catalog | Notes |
|
||||
|---|---|---|---|
|
||||
| English (source) | `en` | — (the strings live in the code) | fallback for every catalog |
|
||||
| 简体中文 — Simplified Chinese | `zh-Hans` | [`crates/ui-egui/locales/zh-Hans/mod.rs`](../crates/ui-egui/locales/zh-Hans/mod.rs) | generated from [`zh-hans.tsv`](../crates/ui-egui/src/i18n/zh-hans.tsv) |
|
||||
| Português (Brasil) — Portuguese (Brazil) | `pt-BR` | [`crates/ui-egui/locales/pt-BR/mod.rs`](../crates/ui-egui/locales/pt-BR/mod.rs) | hand-written |
|
||||
|
||||
The registry is the `Language` enum in
|
||||
[`crates/ui-egui/src/localization.rs`](../crates/ui-egui/src/localization.rs): `ALL` is the order
|
||||
the Appearance window offers, `id()` is the tag stored in preferences, and `native_name()` is the
|
||||
English source name the menu draws through the catalog.
|
||||
|
||||
## How a string is localized
|
||||
|
||||
- `localization::text("English source")` returns the translation for the language entered for the
|
||||
current frame, or the source when the catalog has no entry.
|
||||
- `localized_format!("{name} send level", name = …)` translates the template and then fills it; the
|
||||
translation keeps the same placeholders (a test enforces that).
|
||||
- `localization::error_text(message)` matches an engine error against the catalog's error templates
|
||||
and carries the embedded values over, so a low-level library error stays in English rather than
|
||||
turning into a half-translated sentence.
|
||||
- A catalog module exposes `pub(super) fn translate(source: &str) -> Option<&'static str>` and, if
|
||||
it translates engine errors, `pub(super) const ERROR_TEMPLATES`.
|
||||
|
||||
Values built at run time (file, track and device names), command ids, menu paths used for lookup,
|
||||
preference keys and values, file formats, the control protocol and third-party plugin names are
|
||||
never translated. Engine diagnostics are English in the zh-Hans catalog by design; pt-BR carries
|
||||
error templates.
|
||||
|
||||
The zh-Hans module is generated: edit
|
||||
[`crates/ui-egui/src/i18n/zh-hans.tsv`](../crates/ui-egui/src/i18n/zh-hans.tsv) (one row per
|
||||
string, `context<TAB>English<TAB>translation`) and rerun
|
||||
|
||||
```sh
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py # rewrite the locale module
|
||||
python3 docs/i18n/tools/gen_zh_hans_locale.py --check # fail when it is out of date
|
||||
```
|
||||
|
||||
The TSV is also the file `storytold/craft-i18n`'s `tools/sync_app.py` reads, so the catalog can move
|
||||
to the shared repository when SoundCraft takes that step.
|
||||
|
||||
## Choosing the language
|
||||
|
||||
`Setup ▸ Appearance ▸ Language` (or the `ui.language` command) selects it while the app runs, and
|
||||
the choice is a global preference saved with the UI state:
|
||||
|
||||
```sh
|
||||
soundcraft-cli run --demo --cmd 'ui.language={"language":"zh-Hans"}'
|
||||
```
|
||||
|
||||
With no parameter, `ui.language` reports the current language; an unknown tag is an error. In the
|
||||
browser the language starts from `navigator.language` and follows the saved preference once one
|
||||
exists.
|
||||
|
||||
## Fonts
|
||||
|
||||
egui's bundled faces carry no Han glyphs, so the interface needs a CJK fallback
|
||||
([`crates/ui-egui/src/fonts.rs`](../crates/ui-egui/src/fonts.rs)):
|
||||
|
||||
- Native builds append the operating system's own Han face after every family, resolved through
|
||||
fontconfig (`lang=zh-cn`) with a list of per-platform candidates; nothing is redistributed.
|
||||
- The web build cannot reach system fonts, so it embeds `assets/fonts/NotoSansSC-SoundCraftSubset.ttf`,
|
||||
a Noto Sans SC (OFL-1.1) subset at weight 400 covering the UI glyph set. Regenerate it after a
|
||||
catalog change with
|
||||
|
||||
```sh
|
||||
# <font>: a Noto Sans SC variable font from a noto-cjk release — any file whose family is
|
||||
# "Noto Sans SC" and that carries a wght axis
|
||||
python3 docs/i18n/tools/subset_web_font.py <font>
|
||||
python3 docs/i18n/tools/subset_web_font.py --check
|
||||
```
|
||||
|
||||
and keep [`ATTRIBUTION.md`](../ATTRIBUTION.md) in step; `cargo xtask assets` enforces that.
|
||||
- Han comes before the Hangul fallback for every interface language except Korean, so a Chinese
|
||||
interface and Chinese names draw Chinese shapes even where fontconfig would resolve the Korean
|
||||
face of Noto Sans CJK first.
|
||||
|
||||
## Tests and gates
|
||||
|
||||
`cargo test -p soundcraft-ui-egui` covers the catalog and the fonts:
|
||||
|
||||
- every catalog entry parses, keys are unique and translations keep the English placeholders;
|
||||
- every string passed to `localization::text` / `localized_format!` in `crates/ui-egui/src` has an
|
||||
entry in every shipped catalog, and every reference menu label is translated;
|
||||
- the bundled web face draws the whole zh-Hans catalog in every family and stays inside its 2 MiB
|
||||
budget;
|
||||
- with a system Han font installed, every family draws Chinese text.
|
||||
|
||||
`cargo xtask ci` runs those with the rest of the gates (fmt, clippy, assets, layers, wasm).
|
||||
|
||||
## Adding another language
|
||||
|
||||
1. Add a `locales/<tag>/mod.rs` with `translate` (and `ERROR_TEMPLATES` when engine errors should be
|
||||
translated), plus the `#[path]` module declaration in `localization.rs`.
|
||||
2. Add the `Language` variant: `ALL`, `id()`, `native_name()`, `text()`, and the `error_text`
|
||||
template arm.
|
||||
3. Translate `every_localized_source_string_has_a_catalog_entry`'s set (the test lists what is
|
||||
missing by file and string) and the menu labels.
|
||||
4. Add a font fallback for the script, and for the web build either bundle a subset or document the
|
||||
gap; extend `ATTRIBUTION.md` when a file is added.
|
||||
5. Update [`localization-parity.md`](localization-parity.md), `ROADMAP.md` and `docs/gaps.md`.
|
||||
|
||||
## Relation to `storytold/craft-i18n`
|
||||
|
||||
The org keeps shared translations in `craft-i18n` and reads them through an optional `CRAFT_I18N_DIR`
|
||||
build input. SoundCraft has not cut over (roadmap stage 3d): like pt-BR, this catalog lives in the
|
||||
repository, and its TSV is the pre-cutover file the sync script consumes, so a later migration only
|
||||
moves data.
|
||||
+6
-2
@@ -90,8 +90,12 @@ plugins), and WebAudio in the browser.
|
||||
the default player. `NSMicrophoneUsageDescription` explains the recording prompt.
|
||||
- **Signing** goes inside-out with the hardened runtime and a secure timestamp. The executable is
|
||||
signed first, then the bundle. There's no `--deep` on the final signature. `entitlements.plist`
|
||||
holds a single exception, `com.apple.security.device.audio-input`, without which the hardened
|
||||
runtime blocks recording.
|
||||
holds three exceptions: `com.apple.security.device.audio-input`, without which the hardened
|
||||
runtime blocks recording; `com.apple.security.cs.disable-library-validation`, without which
|
||||
`dlopen` refuses every third-party VST3/CLAP/AU bundle (signed by another Team ID); and
|
||||
`com.apple.security.cs.allow-unsigned-executable-memory`, without which plugin runtimes that
|
||||
create executable memory without `MAP_JIT` (UADx/PACE) are killed at load. The CLI is signed
|
||||
with the same entitlements because it hosts plugins too.
|
||||
- **Notarization:** the app is zipped and sent with `xcrun notarytool submit --wait`, then the
|
||||
ticket is stapled to the app. The app goes on a DMG (`hdiutil`, with an `Applications` link).
|
||||
The DMG is signed, notarized and stapled too.
|
||||
|
||||
+2
-1
@@ -49,7 +49,7 @@ Status: ✅ done · 🟡 in progress · ⬜ not started.
|
||||
| M12 | **Hardware**: audio interfaces, MIDI devices, sync, control surfaces | ⬜ | 110–180 |
|
||||
| M13 | **Interchange**: AAF/OMF import/export, disk streaming | 🟡 strict external-WAV AAF import; export, OMF and disk streaming missing | 65–115 |
|
||||
| M14 | **Fidelity harness** against Pro Tools (null tests, plugin responses) | ⬜ | 20–30 |
|
||||
| M15 | **Localization**: catalog, fonts/RTL, the 8 Pro Tools languages first | 🟡 partial (pt-BR catalog; Spanish complete; French partial; pt-BR needs native review; PR #141 open) | 45–80 |
|
||||
| M15 | **Localization**: catalog, fonts/RTL, the 8 Pro Tools languages first | 🟡 partial (pt-BR and zh-Hans catalogs, zh-Hans with a CJK fallback; Spanish complete; French partial; pt-BR and zh-Hans need native review; PR #141 open) | 45–80 |
|
||||
| M16 | Built-in plugin depth, sidechain, ARA | ⬜ | 110–170 |
|
||||
| M17 | Immersive delivery (ADM BWF, object renderer, binaural) and video depth | ⬜ | 80–130 |
|
||||
|
||||
@@ -90,6 +90,7 @@ There is no `cargo xtask scorecard` in this repo; the measured number is `cargo
|
||||
|---|---|---|
|
||||
| 2026-11-27 | trivial | M15: Spanish catalog complete (UI strings and engine errors, native-speaker review). Estimates unchanged |
|
||||
| 2026-11-24 | trivial | M15: French and Spanish catalogs (partial, ≈ 62 %) on the `localization` layer (#143). Estimates unchanged |
|
||||
| 2026-11-22 | trivial | M15: the zh-Hans catalog covers the fixed UI strings, with a Han font fallback on the desktop and an OFL web subset; native review still pending |
|
||||
| 2026-11-18 | minor | MIDI input devices landed (G-02 shrunk); the MIDI gate row is unverified until checked on macOS and Windows |
|
||||
| 2026-11-14 | minor | M13 is in progress with strict external-WAV AAF import; the exchange gate still fails without AAF export, OMF or `.ptx`; estimates unchanged |
|
||||
| 2026-11-09 | trivial | 28 built-in processors with the Frequency Shifter |
|
||||
|
||||
@@ -87,7 +87,7 @@ post-production, tracking) can switch. "Ready" is depth, correctness and fidelit
|
||||
| Performance | 5 % | **~35 %** | estimated (unmeasured) | 40–70 | [hardware-parity.md](hardware-parity.md) | Parallel strip rendering and PDC exist; whole files decoded into RAM, recording to disk (#84; long takes #888), no track-count or latency benchmarks |
|
||||
| Ecosystem / plugins | 4 % | **~30 %** | estimated | in Features + Hardware | [plugin-parity.md](plugin-parity.md) | CLAP/VST3/AU hosting; no AAX (Pro Tools' only format), no ARA, no sidechain, no control-surface ecosystem, no content library |
|
||||
| Platforms | 3 % | **~65 %** | estimated | 20–40 | [ROADMAP.md](../ROADMAP.md) | Builds for macOS, Windows x64/x86/arm64, Linux, FreeBSD, Web (Pro Tools: macOS, Windows), but only macOS is exercised at runtime; Web lacks file pickers (#63, #64) |
|
||||
| Localization | 2 % | **~12 %** | measured (catalog count) | 70–110 | [localization-parity.md](localization-parity.md) | English plus a pt-BR catalog (not native-reviewed); Pro Tools ships 8 UI languages; FR/ES PR #143 open |
|
||||
| Localization | 2 % | **~19 %** | measured (catalog count) | 55–90 | [localization-parity.md](localization-parity.md) | English, pt-BR, es, fr (partial) and zh-Hans catalogs (es native-reviewed); Han fallback on the desktop and an OFL subset on the web; Pro Tools ships 8 UI languages |
|
||||
| AI features | 1 % | **~5 %** | estimated | 30–50 | [gaps.md](gaps.md) | Pro Tools has speech-to-text transcription (upgraded in 2026.4); we have only an audio-to-MIDI pitch tracker |
|
||||
| **Weighted** | 100 % | **~40 %** | | **~950–1,450** (overlaps removed) | | |
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ echo "==> SoundCraft $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL
|
||||
# host's disk before anything here could check it.
|
||||
MAX_UNPACKED_BYTES=$((2 * 1024 * 1024 * 1024))
|
||||
UNPACKED="$(tar --numeric-owner -tzvf "$TARBALL" | awk '{ s += $3 } END { print s + 0 }')"
|
||||
[ "$UNPACKED" -le "$MAX_UNPACKED_BYTES" ] || { echo "error: $TARBALL unpacks to $UNPACKED bytes, more than $MAX_UNPACKED_BYTES" >&2; exit 1; }
|
||||
[[ "$UNPACKED" -le "$MAX_UNPACKED_BYTES" ]] || { echo "error: $TARBALL unpacks to $UNPACKED bytes, more than $MAX_UNPACKED_BYTES" >&2; exit 1; }
|
||||
|
||||
WORK="$CARGO_TARGET_DIR/flatpak-bundle"
|
||||
rm -rf "$WORK"
|
||||
|
||||
@@ -100,6 +100,9 @@ sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$SOUNDCRAFT_BUILD_DATE/g" \
|
||||
"$HERE/$APP_ID.metainfo.xml.in" >"$STAGE/usr/share/metainfo/$APP_ID.metainfo.xml"
|
||||
mkdir -p "$STAGE/usr/share/icons"
|
||||
cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/usr/share/icons/"
|
||||
# The compile-time embedded nightly icon lives in assets/app-icon/hicolor for include_bytes!;
|
||||
# exclude it from staged FHS icons so stable and nightly packages never collide on it.
|
||||
rm -f "$STAGE/usr/share/icons/hicolor/256x256/apps/$APP_ID-nightly.png"
|
||||
mkdir -p "$STAGE/usr/share/doc/soundcraft"
|
||||
copy_docs "$STAGE/usr/share/doc/soundcraft"
|
||||
# soundcraft-cli's man pages and shell completions, from its clap definition, written by the
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!-- Hardened-runtime entitlements for SoundCraft. The app is pure Rust, loads no unsigned code,
|
||||
needs no JIT, and is not sandboxed (it opens files by path, from the command line and
|
||||
<!-- Hardened-runtime entitlements for SoundCraft. The host is Rust, loads third-party plugins,
|
||||
and is not sandboxed (it opens files by path, from the command line and
|
||||
drag-and-drop). Add exceptions here only with a reason in a comment. -->
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- VST3/CLAP/AU plugins are signed by their own developers (or ad hoc for local builds).
|
||||
Library validation otherwise rejects these modules in the signed host, even when
|
||||
discovery succeeds in an unpackaged build. -->
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
<!-- Third-party plugin runtimes can create executable memory without MAP_JIT. UADx/PACE
|
||||
initialisation is killed with CODESIGNING/Invalid Page without this exception; allow-jit
|
||||
alone does not suffice. Keep executable-page protection and the hardened runtime enabled. -->
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<!-- Recording: the hardened runtime blocks audio input (CoreAudio via cpal) without this,
|
||||
even after the user grants microphone access (NSMicrophoneUsageDescription). -->
|
||||
<key>com.apple.security.device.audio-input</key>
|
||||
|
||||
@@ -212,7 +212,9 @@ CLI_DIR="$WORK/soundcraft-cli-$VERSION-macos-$ARCH"
|
||||
mkdir -p "$CLI_DIR"
|
||||
cp "$WORK/bin/soundcraft-cli" "$CLI_DIR/"
|
||||
copy_docs "$CLI_DIR"
|
||||
sign --options runtime "$CLI_DIR/soundcraft-cli"
|
||||
# The CLI runs the same engine and hosts plugins too, so it needs the same entitlements (the
|
||||
# plugin exceptions) or third-party plugins fail to load there as well.
|
||||
sign --options runtime --entitlements "$HERE/entitlements.plist" "$CLI_DIR/soundcraft-cli"
|
||||
codesign --verify --strict --verbose=2 "$CLI_DIR/soundcraft-cli"
|
||||
rm -f "$CLI_ZIP"
|
||||
ditto -c -k --keepParent "$CLI_DIR" "$CLI_ZIP"
|
||||
|
||||
@@ -182,8 +182,8 @@ class TrustedSourcePreparation(unittest.TestCase):
|
||||
producer_platforms(source.replace(" " + current + "\n", ""))
|
||||
|
||||
def test_continuation_lines_of_any_scalar_form_reach_the_guard_checks(self):
|
||||
for name, workflow in (("nightly.yml", "nightly.yml"), ("nightly-sign.yml", "nightly-sign.yml")):
|
||||
source = (ROOT / ".github/workflows" / workflow).read_text()
|
||||
for name in ("nightly.yml", "nightly-sign.yml", "nightly-dispatch.yml"):
|
||||
source = (ROOT / ".github/workflows" / name).read_text()
|
||||
expected = NightlyEnabledCallers.GUARDS[name]
|
||||
guard = re.search(r"(?m)^ if: >-\n(?: [^\n]*\n)+", source)[0]
|
||||
for replacement in (guard + " || true\n", " if: " + expected + "\n || true\n"):
|
||||
@@ -192,15 +192,22 @@ class TrustedSourcePreparation(unittest.TestCase):
|
||||
(indicator, expression), = job_conditions(jobs)
|
||||
self.assertFalse(indicator == ">-" and " ".join(expression.split()) == expected)
|
||||
|
||||
def test_no_nightly_schedule_is_registered(self):
|
||||
for name, event in (("nightly.yml", "workflow_dispatch"),
|
||||
("nightly-sign.yml", "workflow_dispatch")):
|
||||
def test_nightly_triggers_and_schedule_match_review(self):
|
||||
expected_triggers = (
|
||||
("nightly.yml", [" schedule:", " workflow_dispatch:"]),
|
||||
("nightly-sign.yml", [" workflow_dispatch:"]),
|
||||
("nightly-dispatch.yml", [" workflow_run:"]),
|
||||
)
|
||||
for name, expected in expected_triggers:
|
||||
source = (ROOT / ".github/workflows" / name).read_text()
|
||||
events = source.split("\non:\n", 1)[1].split("\npermissions:", 1)[0]
|
||||
triggers = [line for line in events.splitlines() if line.startswith(" ")
|
||||
and not line.startswith(" ") and line.strip() and not line.lstrip().startswith("#")]
|
||||
with self.subTest(workflow=name):
|
||||
self.assertEqual(triggers, [f" {event}:"], "schedule/activation needs explicit review")
|
||||
self.assertEqual(triggers, expected, "schedule/activation needs explicit review")
|
||||
producer = (ROOT / ".github/workflows/nightly.yml").read_text()
|
||||
crons = re.findall(r"(?m)^ - cron: '([^']+)'$", producer)
|
||||
self.assertEqual(crons, ["30 5 * * *"], "nightly schedule must match the reviewed cadence")
|
||||
|
||||
def test_signer_serialization_contract_is_enforced(self):
|
||||
assert_nightly_serialization((ROOT / ".github/workflows/nightly-sign.yml").read_text())
|
||||
@@ -221,7 +228,7 @@ class TrustedSourcePreparation(unittest.TestCase):
|
||||
assert_nightly_serialization(source.replace(old, new))
|
||||
|
||||
def test_no_cache_actions_or_cache_setup_options_in_app_trusted_closure(self):
|
||||
for name in ("nightly.yml", "nightly-sign.yml"):
|
||||
for name in ("nightly.yml", "nightly-sign.yml", "nightly-dispatch.yml"):
|
||||
source = (ROOT / ".github/workflows" / name).read_text()
|
||||
executable = "\n".join(line for line in source.splitlines()
|
||||
if not line.lstrip().startswith("#"))
|
||||
@@ -319,6 +326,7 @@ class NightlyEnabledCallers(unittest.TestCase):
|
||||
"github.event_name == 'workflow_dispatch')",
|
||||
"nightly-sign.yml": "github.repository == 'storytold/soundcraft' && github.event_name == 'workflow_dispatch' && "
|
||||
"github.ref == 'refs/heads/nightly-signer' && github.ref_type == 'branch'",
|
||||
"nightly-dispatch.yml": "github.repository == 'storytold/soundcraft' && github.event_name == 'workflow_run'",
|
||||
}
|
||||
|
||||
def test_enabled_jobs_keep_exact_context_guards(self):
|
||||
@@ -335,7 +343,8 @@ class NightlyEnabledCallers(unittest.TestCase):
|
||||
source = (ROOT / ".github/workflows/nightly.yml").read_text()
|
||||
policy = json.loads(INSTALLED_POLICY.read_text())
|
||||
self.assertEqual(reviewed_manual_actors(source, policy), RELEASE_MANAGERS)
|
||||
self.assertEqual(policy["automatic_signer_actors"], [], "no automatic signer without a schedule")
|
||||
self.assertEqual(policy["automatic_signer_actors"], ["github-actions[bot]"],
|
||||
"automatic signer actor must match the scheduled dispatcher")
|
||||
|
||||
def test_an_actor_outside_the_release_managers_is_refused(self):
|
||||
source = (ROOT / ".github/workflows/nightly.yml").read_text()
|
||||
@@ -794,11 +803,22 @@ class NightlySignerBranchTrustClosure(unittest.TestCase):
|
||||
"the signer guard is exactly the reviewed repository, dispatch and signer-branch expression")
|
||||
self.assertEqual(re.findall(r"(?m)^ app-name: (\S+)$", sign), ["soundcraft"],
|
||||
"the shared signer needs the reviewed registry app")
|
||||
self.assertFalse((ROOT / ".github/workflows/nightly-dispatch.yml").exists(),
|
||||
"this app has no automatic transport; adding one needs its own reviewed PR")
|
||||
dispatch_path = ROOT / ".github/workflows/nightly-dispatch.yml"
|
||||
self.assertTrue(dispatch_path.exists(), "scheduled nightly requires the reviewed automatic transport")
|
||||
dispatch = dispatch_path.read_text()
|
||||
producer_name = re.findall(r"(?m)^name: (.+)$", (ROOT / ".github/workflows/nightly.yml").read_text())
|
||||
self.assertEqual(producer_name, ["SoundCraft unsigned nightly"])
|
||||
self.assertIn(f"workflows: [{producer_name[0]}]", dispatch)
|
||||
self.assertIn("branches: [main]", dispatch)
|
||||
self.assertIn("\npermissions: {}\n", dispatch)
|
||||
self.assertIn("'ref': 'refs/heads/" + SIGNER_BRANCH + "'", dispatch)
|
||||
self.assertIn("https://api.github.com/repos/storytold/soundcraft/actions/workflows/nightly-sign.yml/dispatches",
|
||||
dispatch)
|
||||
assert_caller_secrets(dispatch, "dispatch", set())
|
||||
policy = json.loads(INSTALLED_POLICY.read_text())
|
||||
self.assertEqual(policy["release_branch"], SIGNER_BRANCH)
|
||||
self.assertEqual(policy["automatic_signer_actors"], [], "no automatic signer without a schedule")
|
||||
self.assertEqual(policy["automatic_signer_actors"], ["github-actions[bot]"],
|
||||
"automatic signer actor must match the scheduled dispatcher")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -7,3 +7,5 @@ sonar.organization=storytold
|
||||
sonar.cpd.exclusions=crates/ui-egui/locales/**
|
||||
# Packaging verification scripts are standalone test suites, not covered by Rust coverage reports.
|
||||
sonar.coverage.exclusions=packaging/**
|
||||
# Browser test harness under apps/soundcraft-web/tests is test code, not production source.
|
||||
sonar.test.inclusions=apps/soundcraft-web/tests/**
|
||||
|
||||
Reference in New Issue
Block a user