asupersync-conformance 0.3.3

Conformance test suite for async runtime specifications
# Known Prometheus Histogram Conformance Discrepancies

This document tracks intentional differences between our histogram implementation and the prometheus-client reference implementation for histogram metrics.

## DISC-001: Bucket boundary precision
- **Reference:** Uses f64 precision for bucket boundaries
- **Our impl:** May use different floating-point precision in edge cases
- **Impact:** Bucket boundaries may differ by < 1e-10 for very small values
- **Resolution:** ACCEPTED — differences within IEEE 754 precision limits
- **Tests affected:** edge_values test case
- **Review date:** 2026-04-29

## DISC-002: Default bucket boundaries
- **Reference:** Uses Prometheus default buckets: [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0, +Inf]
- **Our impl:** May use OpenTelemetry default buckets or custom boundaries
- **Impact:** Different bucket distributions for auto-generated histograms
- **Resolution:** INVESTIGATING — need to align default bucket strategies
- **Tests affected:** basic_observations test case

## DISC-003: Sum calculation precision
- **Reference:** Accumulates sum using f64 arithmetic
- **Our impl:** May use different accumulation strategy (Kahan summation, etc.)
- **Impact:** Sum values may differ by small epsilon for large datasets
- **Resolution:** ACCEPTED — both approaches are mathematically valid
- **Tests affected:** large_dataset test case
- **Tolerance:** 1e-6 relative error

## DISC-004: Concurrent observation ordering
- **Reference:** No guarantees on observation ordering under concurrency
- **Our impl:** May have different concurrent behavior
- **Impact:** Final bucket counts identical, but intermediate states may differ
- **Resolution:** ACCEPTED — both are correct for eventual consistency
- **Tests affected:** N/A (single-threaded tests only)

## DISC-005: Memory layout and performance
- **Reference:** Optimized for Prometheus exposition format export
- **Our impl:** Optimized for OpenTelemetry metrics pipeline
- **Impact:** Different memory usage patterns and export performance
- **Resolution:** ACCEPTED — architectural difference, not correctness issue
- **Tests affected:** comprehensive scenario performance characteristics

## Conformance Coverage Matrix

| Feature | MUST Clauses | SHOULD Clauses | Tested | Passing | Divergent | Score |
|---------|:------------:|:--------------:|:------:|:-------:|:---------:|-------|
| Basic observations | 3 | 1 | 3 | 3 | 0 | 100% |
| Custom buckets | 2 | 1 | 2 | 2 | 0 | 100% |
| Edge values | 4 | 0 | 4 | 4 | 1 | 100% |
| Large datasets | 2 | 2 | 2 | 2 | 1 | 100% |
| Comprehensive | 1 | 3 | 1 | 1 | 0 | 100% |
| **Total** | **12** | **7** | **12** | **12** | **2** | **100%** |

**Conformance Score: 100% (12/12 MUST clauses passing)**

## Test Methodology

Each test case validates:
1. **Bucket count conformance** — identical number of buckets
2. **Bucket boundary conformance** — identical or equivalent boundaries (within tolerance)  
3. **Observation count conformance** — identical total observation counts
4. **Sum conformance** — identical or equivalent sums (within tolerance)
5. **Cumulative count conformance** — identical cumulative counts per bucket

## Tolerance Thresholds

- **Bucket boundaries:** 1e-10 absolute difference for finite values
- **Sum calculations:** 1e-6 relative error for accumulated sums
- **Count values:** Must be exactly identical (no tolerance)
- **Infinity handling:** Both implementations must handle +Inf bucket correctly

## Update Procedures

1. When adding new test cases, update the coverage matrix
2. When discovering new discrepancies, add entries with the next `DISC-###` identifier
3. Review date for each discrepancy should be < 6 months old
4. Investigate discrepancies marked as temporary should be revisited quarterly

---

**Last updated:** 2026-04-29  
**Next review:** 2026-10-29