|
1 | | -# CLAUDE.md - PrePrimer Technical Guide |
| 1 | +# CLAUDE.md - PrePrimer Technical Reference |
2 | 2 |
|
3 | | -Technical guidance for Claude Code when working with the PrePrimer codebase. |
| 3 | +Technical reference for AI assistants working with the PrePrimer codebase. |
4 | 4 |
|
5 | | -## Current State (v0.2.0) |
| 5 | +## Current State (v0.3.0) |
6 | 6 |
|
7 | | -**Status:** Production-ready for v0.2.0 release |
8 | | - |
9 | | -**Release Date:** 2025-10-21 |
| 7 | +**Status:** Production-ready |
10 | 8 |
|
11 | 9 | **Codebase Metrics:** |
12 | | -- **Code**: ~20,000 lines of Python across 59 files |
13 | | -- **Tests**: 611 tests with 96.90% coverage, 100% pass rate |
14 | | -- **Architecture**: Plugin-based with security focus |
15 | | -- **Documentation**: Complete, organized in docs/ |
16 | | - |
17 | | -**Key Capabilities:** |
18 | | -- 4 input formats: VarVAMP, ARTIC, Olivar, STS |
19 | | -- 5 output formats: ARTIC, VarVAMP, Olivar, FASTA, STS |
| 10 | +- **Source Code**: ~6,900 lines of Python across 59 modules |
| 11 | +- **Test Suite**: ~22,300 lines implementing 998 tests |
| 12 | +- **Test Coverage**: 96.90% with 100% pass rate |
| 13 | +- **Architecture**: Plugin-based with security-focused validation |
| 14 | +- **Documentation**: Organized in docs/ directory |
| 15 | + |
| 16 | +**Supported Capabilities:** |
| 17 | +- 4 input format parsers: VarVAMP, ARTIC, Olivar, STS |
| 18 | +- 5 output format writers: ARTIC, VarVAMP, Olivar, FASTA, STS |
20 | 19 | - 20 bidirectional conversion pathways |
21 | | -- **Primer-to-reference alignment**: BLAST, Exonerate, merPCR, me-PCR providers |
| 20 | +- Primer-to-reference alignment: BLAST, Exonerate, merPCR, me-PCR providers |
22 | 21 | - Circular genome topology detection and handling |
23 | 22 | - IUPAC degenerate nucleotide support |
24 | | -- Security hardening with 100% security module coverage |
25 | | - |
26 | | -**What's New in v0.2.0:** |
27 | | -- ✨ **Alignment Functionality**: Integrated 4 alignment providers (BLAST, Exonerate, merPCR, me-PCR) |
28 | | - - `align_primers()` high-level API |
29 | | - - CLI `align` command with multiple output formats |
30 | | - - 36 comprehensive alignment tests |
31 | | -- ✨ **Enhanced STS Format**: Auto-detection of 3/4-column formats, header/headerless files |
32 | | -- ✨ **Comprehensive Validation**: 23 real-data tests with 100% pass rate, validation framework |
33 | | -- ✨ **Improved Documentation**: Reorganized structure with validation reports in docs/technical/validation/ |
34 | | -- ⚠️ **Breaking**: Removed legacy `PrePrimerConfig` - Use `EnhancedConfig` with nested structure |
35 | | -- See [CHANGELOG.md](CHANGELOG.md) for complete details |
| 23 | +- Security validation with 100% security module coverage |
| 24 | + |
| 25 | +**Recent Changes (v0.3.0):** |
| 26 | +- Comprehensive writer test coverage (110/113 tests, 97.3%) |
| 27 | +- BaseWriterTest pattern for reusable test infrastructure |
| 28 | +- Performance baselines established for all writers (51-591µs) |
| 29 | +- Enhanced pytest configuration with test layer markers |
| 30 | + |
| 31 | +See [CHANGELOG.md](CHANGELOG.md) for complete release history |
36 | 32 |
|
37 | 33 | ## Quick Commands |
38 | 34 |
|
@@ -480,37 +476,61 @@ from preprimer.core.security import PathValidator |
480 | 476 | safe_path = PathValidator.sanitize_path("../../etc/passwd") # Should fail |
481 | 477 | ``` |
482 | 478 |
|
483 | | -## Performance Benchmarks (Reference) |
| 479 | +## Performance Benchmarks |
484 | 480 |
|
485 | | -**Current performance** (as of v1.0.0): |
| 481 | +Current performance (v0.3.0): |
486 | 482 | - Parser creation: ~4.2M ops/sec |
487 | 483 | - Format detection: ~45K ops/sec |
488 | 484 | - Small dataset parsing: ~3K ops/sec |
489 | 485 | - Large dataset (2000+ amplicons): ~37 ops/sec |
490 | | -- Memory: ~50MB baseline |
| 486 | +- Memory baseline: ~50MB |
491 | 487 |
|
492 | | -**If making changes that affect performance**, run benchmarks and compare. |
| 488 | +Writer performance: |
| 489 | +- FASTA: 51.3µs (19.5K ops/sec) |
| 490 | +- Olivar: 55.5µs (18.0K ops/sec) |
| 491 | +- STS: 62.9µs (15.9K ops/sec) |
| 492 | +- VarVAMP: 69.2µs (14.4K ops/sec) |
| 493 | +- ARTIC: 591µs (1.7K ops/sec) |
493 | 494 |
|
494 | | -## Key Design Principles |
| 495 | +## Design Principles |
495 | 496 |
|
496 | | -1. **Security First**: All input validated, no path traversal, size limits |
497 | | -2. **Plugin Architecture**: Easy to add new formats without core changes |
498 | | -3. **Topology Aware**: Automatic circular genome detection and handling |
499 | | -4. **Standards Compliant**: Follow primal-page, articbedversion specs |
| 497 | +1. **Security First**: All input validated, no path traversal, size limits enforced |
| 498 | +2. **Plugin Architecture**: New formats added without core changes |
| 499 | +3. **Topology Aware**: Automatic circular genome detection |
| 500 | +4. **Standards Compliant**: Follow primal-page, articbedversion specifications |
500 | 501 | 5. **Well-Tested**: High coverage, comprehensive test suite |
501 | | -6. **User-Friendly Errors**: Informative messages with suggestions |
| 502 | +6. **Clear Errors**: Informative messages with actionable suggestions |
502 | 503 | 7. **Performance**: Sub-second for typical workloads |
503 | 504 |
|
| 505 | +## Test Patterns |
| 506 | + |
| 507 | +### BaseParserTest Pattern |
| 508 | +- Abstract base class: `tests/unit/parsers/test_base_parser.py` |
| 509 | +- 16 inherited tests per parser |
| 510 | +- Contract enforcement, security validation, performance benchmarking |
| 511 | +- 4 parsers migrated: VarVAMP, ARTIC, Olivar, STS |
| 512 | +- 99/99 tests passing (100%) |
| 513 | + |
| 514 | +### BaseWriterTest Pattern |
| 515 | +- Abstract base class: `tests/unit/writers/test_base_writer.py` |
| 516 | +- 12 inherited tests per writer |
| 517 | +- Contract enforcement, validation, performance benchmarking |
| 518 | +- 5 writers migrated: VarVAMP, Olivar, STS, ARTIC, FASTA |
| 519 | +- 110/113 tests passing (97.3%) |
| 520 | + |
| 521 | +See `docs/development/patterns/` for detailed documentation. |
| 522 | + |
504 | 523 | ## When in Doubt |
505 | 524 |
|
506 | | -1. **Check existing tests**: Pattern already exists |
507 | | -2. **Use StandardizedParser**: Base class handles security, validation |
508 | | -3. **Write tests first**: TDD approach prevents bugs |
509 | | -4. **Run full suite**: `pytest` before committing |
510 | | -5. **Check documentation**: Update if behavior changes |
| 525 | +1. **Check existing tests** - Patterns already exist |
| 526 | +2. **Use StandardizedParser** - Base class handles security and validation |
| 527 | +3. **Write tests first** - TDD approach prevents bugs |
| 528 | +4. **Run full suite** - `pytest` before committing |
| 529 | +5. **Update documentation** - Keep docs synchronized with code changes |
511 | 530 |
|
512 | 531 | --- |
513 | 532 |
|
514 | | -**Version**: 0.2.0 |
515 | | -**Last Updated**: 2025-10-21 |
516 | | -**Test Coverage**: 96.90% (611 tests, 100% pass rate) |
| 533 | +**Version**: 0.3.0 |
| 534 | +**Last Updated**: 2025-10-22 |
| 535 | +**Test Coverage**: 96.90% (998 tests, 100% pass rate) |
| 536 | +**Codebase**: ~6,900 lines source + ~22,300 lines tests |
0 commit comments