stemedb/.agentive-remediation/timestamp-unification/history.md
jordan 157dbbb9eb feat: Complete Aphoria Phase 8-9 + UAT suite (90/90 tests passing)
## Phase 8: Enterprise Extractor Improvements 
- 14 security extractors (TLS, JWT, SQL injection, XSS, etc.)
- 10 framework-specific extractors (Spring, Django, Rails, etc.)
- Config file security detection (YAML, TOML)

## Phase 9: Autonomous Extractor Generation 
- Shadow mode executor with TP/FP tracking
- Graduation pipeline with confidence thresholds
- Auto-rollback on regression detection
- Cross-project pattern syncing

## UAT Suite Complete (14 scripts, 90 tests)
- test-core-detection.sh (6 tests)
- test-declarative-extractors.sh (5 tests)
- test-domain-frameworks.sh (5 tests)
- test-domain-unreal.sh (3 tests)
- test-llm-extraction.sh (6 tests)
- test-eval-harness.sh (5 tests)
- test-cross-language.sh (3 tests)
- test-precommit-performance.sh (4 tests)
- test-output-formats.sh (8 tests)
- test-drift-detection.sh (6 tests)
- test-exit-codes.sh (12 tests)
+ 3 more scripts

## Other Changes
- Updated roadmap to mark Phase 8-9 complete
- Added .gitignore entries for build artifacts
- Updated pre-commit: 800 line limit, exclude tests/data/cmd

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:50:55 -07:00

72 lines
2.8 KiB
Markdown

# timestamp-unification
## AUDIT (2026-02-06)
Pattern: Multiple implementations of `current_timestamp()` and inline `SystemTime::now()` / `Utc::now().timestamp()` calls.
Found: 11 instances in 6 files (production code)
- 2 duplicate function definitions
- 4 inline implementations
- 5 test-only usages (acceptable)
### Decision
1. Keep `episteme/corpus.rs:current_timestamp()` as canonical, make it `pub`
2. Export from `lib.rs` for easy access
3. Remove duplicate in `research/gap_store.rs`
4. Replace inline implementations with function call
5. Keep `scan/scanner.rs` millis variant separate (different unit)
6. Keep test code as-is (test isolation is acceptable)
## FIX LOG
- [x] episteme/corpus.rs:15 - Made `current_timestamp()` public, added comprehensive docstring, added `current_timestamp_millis()` variant
- [x] episteme/mod.rs - Re-exported `current_timestamp` and `current_timestamp_millis`
- [x] lib.rs - Added `pub use episteme::{current_timestamp, current_timestamp_millis}`
- [x] research/gap_store.rs:297 - Removed duplicate `fn current_timestamp()`, now imports from `crate::current_timestamp`
- [x] corpus_build.rs:63 - Replaced inline `SystemTime::now()` with `current_timestamp()`
- [x] policy.rs:128 - Replaced inline `SystemTime::now()` with `current_timestamp()`
- [x] policy.rs:236 - Replaced inline `SystemTime::now()` with `current_timestamp()`
- [x] expiry.rs:102 - Replaced `Utc::now().timestamp()` with `current_timestamp()`
- [x] scan/scanner.rs:267 - Replaced inline millis with `current_timestamp_millis()`
## VERIFY (2026-02-06)
```bash
cargo test -p aphoria # 782 passed
cargo clippy -p aphoria -- -D warnings # No warnings
```
Remaining instances (all acceptable):
- `episteme/corpus.rs:21,28` - CANONICAL IMPLEMENTATION
- `expiry.rs:132,153,212,219` - Test code in `#[cfg(test)]` module
- `tests/ack_expiry.rs` - Test file
## ENFORCE (2026-02-06)
Updated `.claude/skills/aphoria-dev/skill.md`:
1. Added "Do Not #11": "Write inline timestamp code. Use `crate::current_timestamp()` or `crate::current_timestamp_millis()`"
2. Added to Constraints/NEVER: "Write inline timestamp code (use `current_timestamp()` from crate root)"
3. Added to Constraints/ALWAYS:
- "Use `crate::current_timestamp()` for Unix timestamps in seconds"
- "Use `crate::current_timestamp_millis()` for millisecond precision"
## DOCUMENT (2026-02-06)
Canonical implementation documented in `episteme/corpus.rs:15-28`:
- `current_timestamp()` - Unix timestamp in seconds
- `current_timestamp_millis()` - Unix timestamp in milliseconds
Both functions exported via `crate::` for easy import.
## COMPLETE
Before: 6 production instances of inline/duplicate timestamp code
After: 0 (all use canonical functions)
Enforcement: aphoria-dev skill updated with "Do Not" rule
Documentation: Canonical functions documented with usage examples