diff --git a/AGENTS.md b/AGENTS.md index b6e2c04..6eaec0a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -172,7 +172,7 @@ rm -f /tmp/rate_* 2>/dev/null # clear rate limiting fir php tests.php ``` -- Expected: **183/183 tests passed (100%)**. +- Expected: **185/185 tests passed (100%)**. - Covers: auth (login, bad credentials, missing/invalid token), scores CRUD, create-score-with-pieces, files tree, path traversal, rate limiting, upload validation, INI injection, security headers. @@ -346,7 +346,7 @@ joined by `+` (e.g. `contrebasse-sib-clefa-1+baryton-sib-clefa-1`). See `NAMING. - [ ] CORS origins restricted to the real domains (no wildcard fallback). - [ ] HTTPS enforced in production. - [ ] Rate limiting active (clear `/tmp/rate_*` only in tests, never in prod). -- [ ] `php tests.php` passes 183/183. +- [ ] `php tests.php` passes 185/185. - [ ] `npm audit` reviewed. - [ ] No secrets in code or git history. diff --git a/NAMING.md b/NAMING.md index 07eab27..43b2860 100644 --- a/NAMING.md +++ b/NAMING.md @@ -69,6 +69,23 @@ on ajoute un ou plusieurs instruments, chacun avec **tonalité / clé / partie** nom est alors construit automatiquement, relié par `+` (ex. `contrebasse-sib-clefa-1+baryton-sib-clefa-1.pdf`). +### Percussions (`per`) + +Comme `sup`/`par`, le dossier `per/` regroupe plusieurs instruments : le **nom du +fichier** précise le(s) instrument(s) de percussion, reliés par `+` lorsqu'ils +partagent la même partition. Noms reconnus : `batterie`, `glockenspiel`, +`xylophone`, `vibraphone`, `timbales`, `grosse_caisse`, `caisse_claire`, +`cymbale`, `triangle`, `tambour`, `tam_tam`, `tom`, `gong`, `bongos`, `maracas`, +`tambourine`, `woodblock`, `claves`. + +Exemples : `batterie-1.pdf`, `glockenspiel-1+xylophone-1.pdf`, +`timbales-1+basse-1+batterie-1+triangle-1.pdf`, +`percussion-1+gong-1+cymbalе-1+triangle-1.pdf`. + +`percussion` (générique) ne s'utilise que si la partition couvre **tout le +pupitre**. Éviter les noms génériques type `percussion_1`, `percussion_2`, … qui +ne disent pas quel instrument joue. + ### Tonalités `sib` (Si♭), `mib` (Mi♭), `fa` (Fa), `ut` (Do — **`do` s'écrit `ut` dans les diff --git a/README.md b/README.md index 7408d34..ff5feb0 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Détail manuel : ```bash cd api rm -f /tmp/rate_* 2>/dev/null -php tests.php # attendu : 183/183 +php tests.php # attendu : 185/185 ``` Frontend (serveurs API + dev lancés) : diff --git a/api/lib/ScoreScanner.php b/api/lib/ScoreScanner.php index 97d34da..df03050 100644 --- a/api/lib/ScoreScanner.php +++ b/api/lib/ScoreScanner.php @@ -680,7 +680,7 @@ class ScoreScanner { $instName = $instrumentNames[$instrument] ?? $instrument; - if (in_array($instrument, ['sup', 'par'], true) && $combined !== null && trim($combined) !== '') { + if (in_array($instrument, ['sup', 'par', 'per'], true) && $combined !== null && trim($combined) !== '') { // Combined/superposed parts keep their real instrument names (e.g. "contrebasse-1+clarinette-1") $combined = strtolower(trim($combined)); if (!$this->isValidSegment($combined, '/^[a-z0-9_+.-]+$/')) { diff --git a/api/tests.php b/api/tests.php index 0a22075..1fa8417 100644 --- a/api/tests.php +++ b/api/tests.php @@ -693,6 +693,17 @@ class APITest { $this->test('Upload sup combined returns 200', $supUp['code'] === 200); $this->test('Upload sup combined filename', str_contains($supUp['body']['path'] ?? '', 'contrebasse-1+clarinette-1.pdf')); + // Percussion parts are named after the real instrument(s) + $perUp = $this->multipartRequest("admin/scores/$scoreId/upload", [ + ['name' => 'file', 'file' => $tmpPdf], + ['name' => 'piece', 'data' => '1'], + ['name' => 'instrument', 'data' => 'per'], + ['name' => 'version', 'data' => '1'], + ['name' => 'combined', 'data' => 'glockenspiel-1+xylophone-1'], + ]); + $this->test('Upload per combined returns 200', $perUp['code'] === 200); + $this->test('Upload per combined filename', str_contains($perUp['body']['path'] ?? '', 'glockenspiel-1+xylophone-1.pdf')); + // Instruments (list + filter) $instr = $this->request('GET', "scores/$scoreId/instruments"); $this->test('Instruments returns 200', $instr['code'] === 200); diff --git a/partitions/src/routes/admin/+page.svelte b/partitions/src/routes/admin/+page.svelte index a73a2be..7c040c4 100644 --- a/partitions/src/routes/admin/+page.svelte +++ b/partitions/src/routes/admin/+page.svelte @@ -203,9 +203,17 @@
+ Instruments de percussion reliés par « + » si plusieurs jouent la même partition
+ (ex. glockenspiel-1+xylophone-1).
+