fix(stats): project trusted mileage source endpoint from metadata
This commit is contained in:
@@ -48,3 +48,21 @@ Both passed.
|
||||
## Commit
|
||||
|
||||
`aa12317b5` - `feat(stats): project elected mileage source`
|
||||
|
||||
## Fix (reviewer findings)
|
||||
|
||||
Applied the reviewer correction for the trusted source endpoint contract:
|
||||
|
||||
- In `go/vehicle-gateway/internal/stats/source_mileage.go`, `projectDailyMileageSQL` now writes `trusted_source_endpoint` from `vehicle_data_source.latest_source_endpoint` via `COALESCE(NULLIF(ds.latest_source_endpoint, ''), s.source_endpoint)` so latest connection metadata is authoritative with a simple fallback.
|
||||
- Replaced hardcoded quality predicate with the existing constant using `s.quality_status = '` + QualityOK + `'` in `projectDailyMileageSQL`.
|
||||
- Updated `go/vehicle-gateway/internal/stats/source_mileage_test.go` to assert both the endpoint expression and constant-based quality predicate.
|
||||
|
||||
Validation commands:
|
||||
|
||||
```bash
|
||||
cd go/vehicle-gateway && go test ./internal/stats -run TestProjectDailyMileageSelectsCandidateAndMarksSource -count=1
|
||||
# PASS: lingniu-vehicle-ingest/go/vehicle-gateway/internal/stats
|
||||
|
||||
cd go/vehicle-gateway && go test ./internal/stats -count=1
|
||||
# PASS: lingniu-vehicle-ingest/go/vehicle-gateway/internal/stats
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user