PD-42 - Matrice de couverture Test-ID → Fichiers
1. Resume
| Metrique | Valeur |
| Tests contractuels implementes | 17/17 (100%) |
| Tests additionnels | 53 |
| Total tests | 70 |
| Couverture code (statements) | 93.04% |
| Couverture code (branches) | 87.5% |
| Couverture code (functions) | 95% |
| Couverture code (lines) | 92.92% |
2. Fichiers implementes
| Fichier | Description | Couverture |
src/crypto/search/types.ts | Types TypeScript PD-42 | N/A (types) |
src/crypto/search/constants.ts | Constantes normatives | 100% |
src/crypto/search/canonicalizer.ts | Module KW-CANON-01 | 94.73% |
src/crypto/search/key-deriver.ts | Module HKDF-SHA256 | 100% |
src/crypto/search/tokenizer.ts | Module HMAC-SHA256-B64T22 | 90% |
src/crypto/search/search-client.ts | API facade | 87.5% |
src/crypto/search/index.ts | Exports publics | N/A (re-exports) |
3. Matrice Test-ID → Implementation
3.1 Tests nominaux (TC-NOM-*)
| Test ID | Description | Fichier de test | Ligne(s) | Status |
| TC-NOM-01 | Determinisme de tokenisation | search.test.ts | 72-106 | ✅ Pass |
| TC-NOM-02 | Canonicalisation KW-CANON-01 | search.test.ts | 108-150 | ✅ Pass |
| TC-NOM-03 | Distinction entre keywords | search.test.ts | 152-177 | ✅ Pass |
| TC-NOM-04 | Recherche par egalite stricte | search.test.ts | 179-211 | ✅ Pass |
| TC-NOM-05 | Isolation K_search (scope USER) | search.test.ts | 213-260 | ✅ Pass |
| TC-NOM-06 | Zero-knowledge serveur | search.test.ts | 262-316 | ✅ Pass |
| TC-NOM-07 | Metadonnees contractuelles | search.test.ts | 318-362 | ✅ Pass |
3.2 Tests d'erreur (TC-ERR-*)
| Test ID | Description | Fichier de test | Ligne(s) | Status |
| TC-ERR-01 | Keyword vide | search.test.ts | 369-399 | ✅ Pass |
| TC-ERR-02 | Keyword non canonicalisable | search.test.ts | 401-437 | ✅ Pass |
| TC-ERR-03 | K_search absent ou invalide | search.test.ts | 439-484 | ✅ Pass |
| TC-ERR-04 | Metadonnees non conformes | search.test.ts | 486-519 | ✅ Pass |
| TC-ERR-05 | Depassement keyword_max_len | search.test.ts | 521-556 | ✅ Pass |
3.3 Tests de non-regression (TC-NR-*)
| Test ID | Description | Fichier de test | Ligne(s) | Status |
| TC-NR-01 | Golden tests (VEC-01/02/03) | search.test.ts | 563-612 | ✅ Pass |
| TC-NR-02 | Index stability | search.test.ts | 614-656 | ✅ Pass |
3.4 Tests adversariaux (TC-NEG-*)
| Test ID | Description | Fichier de test | Ligne(s) | Status |
| TC-NEG-01 | No plaintext keyword leakage | search.test.ts | 663-710 | ✅ Pass |
| TC-NEG-02 | Metadata consistency | search.test.ts | 712-740 | ✅ Pass |
4. Vecteurs de test deterministes
| Vector ID | K_master_user | K_search | Keyword | T_kw | Status |
| VEC-01 | 000102...1f | 1195e4...bbd | "foo bar" | baCw880DWJd8mUmEtqgYQh | ✅ Pass |
| VEC-02 | 000102...1f | 1195e4...bbd | "foo baz" | iu5WbKakmU2t6x3k3239lJ | ✅ Pass |
| VEC-03 | 202122...3f | 88278e...213 | "foo bar" | xBUVIMiGYTXK9cvuR1Wi-E | ✅ Pass |
5. Invariants couverts
| Invariant | Tests | Status |
| INV-01 (Determinisme T_kw) | TC-NOM-01, TC-NR-01 | ✅ |
| INV-02 (Pas de collision) | TC-NOM-03 | ✅ |
| INV-03 (Zero-knowledge) | TC-NOM-06, TC-NEG-01 | ✅ |
| INV-04 (Isolation K_search) | TC-NOM-05 | ✅ |
| INV-05 (Egalite stricte) | TC-NOM-04 | ✅ |
6. Notes d'implementation
6.1 Hypotheses techniques
- H-09 : Le
user_id est gere cote serveur (hors perimetre client) - Les modules serveur (MetadataValidator, SearchIndex, TokenStorage) ne sont PAS implementes dans cette application client (React Native)
6.2 Lignes non couvertes
| Fichier | Lignes | Raison |
canonicalizer.ts | 78 | Catch normalize (cas theorique) |
canonicalizer.ts | 112 | Branche surrogates orphelins |
search-client.ts | 155, 179, 243, 274 | Factory functions peu utilisees |
tokenizer.ts | 47 | Fallback Node.js Buffer |
tokenizer.ts | 81 | tokensEqual longueur differente |
6.3 Tests additionnels (NON-CONTRACTUAL)
53 tests supplementaires pour : - Helper functions (isValidKeyword, isValidMasterKey, isValidToken) - OrThrow variants - Factory functions - Edge cases Unicode - Constant-time comparisons
7. Execution des tests
# Tests unitaires
npm run test:crypto -- --run src/crypto/__tests__/search.test.ts
# Avec couverture
npm run test:crypto:coverage
References
- Spec : PD-42-specification.md
- Tests : PD-42-tests.md
- Plan : PD-42-plan.md
- Code :
src/crypto/search/