Skip to content

fix(neo_feed): missing-distance false ALERT + UTC feed window - #109

Merged
THOClabs merged 1 commit into
mainfrom
fix/neo-feed-distance-utc
Aug 6, 2026
Merged

fix(neo_feed): missing-distance false ALERT + UTC feed window#109
THOClabs merged 1 commit into
mainfrom
fix/neo-feed-distance-utc

Conversation

@THOClabs

@THOClabs THOClabs commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes two correctness issues in the just-merged NEO feed client (#108), both flagged by Cursor Bugbot and independently verified against the source.

  • High — false ALERT on missing distance. _parse_neo_object defaulted distance_au/distance_ld to 0 when miss_distance.astronomical was absent. Since threat_level returns ALERT when distance_ld < 1.0, a NEO with unknown distance was mis-classified as a close pass. Now: prefer astronomical, fall back to deriving AU from kilometers, and skip the object if neither is present.
  • Medium — local vs UTC feed window. The default start_date used date.today() (local) while the CAD client and all NEO timing are UTC, shifting the query window a day near timezone boundaries. Now uses datetime.now(timezone.utc).date().

Testing

  • Two regression tests added: missing-distance is skipped (not a phantom ALERT); km-only distance correctly derives AU.
  • pytest tests/unit/test_neo_feed_client.py tests/unit/test_neo_client.py65 passed

🤖 Generated with Claude Code


Generated by Claude Code


Note

Medium Risk
Changes threat classification inputs for NEO feed data; incorrect parsing could still miss real alerts, but the fix removes a known false-positive path in meteor tracking.

Overview
Fixes two correctness bugs in NEO feed parsing that could mis-rank threats or query the wrong date window.

Miss distance handling no longer treats absent miss_distance as zero AU/LD. The parser prefers astronomical, derives AU from kilometers when needed, and drops objects with no distance so they cannot hit threat_level ALERT via distance_ld < 1.0.

Default feed window now anchors start_date on UTC (datetime.now(timezone.utc).date()) instead of local date.today(), aligning with the CAD client and NEO timing.

Unit tests cover skipped missing-distance and km-only distance derivation.

Reviewed by Cursor Bugbot for commit 042a089. Bugbot is set up for automated code reviews on this repo. Configure here.

… feed window

Addresses two Cursor Bugbot findings on the just-merged NEO feed client:
- High: a NEO object with no miss_distance defaulted distance_au/ld to 0, which
  reads as distance_ld < 1.0 and trips a false ThreatLevel.ALERT. Now: prefer the
  astronomical value, fall back to deriving AU from kilometres, and skip the object
  entirely if neither is present (rather than emitting a phantom close pass).
- Medium: default feed start_date used local date.today() while the CAD client and
  all NEO timing are UTC, shifting the window a day near timezone boundaries. Now
  uses datetime.now(timezone.utc).date().

Adds regression tests: missing-distance is skipped (not alerted); km-only distance
derives AU. 65 NEO tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SKZMQ755R7q38SKqJsCQsg
@THOClabs
THOClabs merged commit f0f7a66 into main Aug 6, 2026
1 check passed
THOClabs added a commit that referenced this pull request Aug 6, 2026
Explains the 87-branch pileup (a March 2026 NEO/hourly-scan swarm of ~59 near-
duplicate AI branches + 15 already-squash-merged-this-session + 12 old reviews +
legacy master) and classifies every branch. All are safe to delete; the NEO core
was salvaged to main (#108/#109). Flags three distinct un-salvaged features
(hourly scanner, event journal, space-weather client) as salvage candidates
before the swarm is deleted. scripts/delete_stale_branches.sh is turnkey (remote
deletion is blocked from the automation sandbox, so it's run locally).


Claude-Session: https://claude.ai/code/session_01SKZMQ755R7q38SKqJsCQsg

Co-authored-by: Claude <noreply@anthropic.com>
THOClabs added a commit that referenced this pull request Aug 7, 2026
…verity (#111)

Recovers the four capabilities flagged by docs/BRANCH_CLEANUP.md before the
swarm branches are deleted, adapted to the post-#108/#109 API on main:

- hourly_scanner.py (from feat/neo-hourly-scanner): autonomous hourly scan of
  CNEOS fireballs, JPL CAD close approaches, and shower calendar. Adapted to
  close_approach_client (field renames), rank-preserving THREAT_LEVEL_MAP
  (JPL WATCH/ALERT -> scanner CLOSE/ALERT), timezone-aware UTC.
- event_journal.py (from nightwatch/neo-tracking-and-event-journal): SQLite
  sky-event journal with Hopi-ring classification; timezone-aware UTC.
- space_weather.py (from feat/neo-space-weather-hourly-scan): NOAA SWPC Kp,
  solar wind, alerts; UTC-aware parsing + warning when the feed is partial so
  outages cannot masquerade as quiet conditions.
- scan_severity.py (from feat/hourly-event-scanner): severity classification
  with tests.
- fireball_client.py: CNEOS lat-dir/lon-dir sign fix (coords are unsigned in
  the API; S/W must negate) from feat/hourly-event-scanner.
- lexicon_prayers.py: generate_prayer_of_approach + status prayer NEO count
  (from the event-journal branch).
- __init__.py: eager event_journal/lexicon exports; lazy loaders for
  hourly scanner, space weather, scan severity.

142 new unit tests, all passing.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
THOClabs added a commit that referenced this pull request Aug 7, 2026
#112)

Preserves the durable content of three open-PR branches before the v0.1.1
branch purge closes them:

- .claude/agents/ (7 review subagents) + .claude/commands/full-review.md
  from PR #93's branch — repo-state-independent review tooling; the stale
  July review reports on that branch are intentionally NOT taken.
- docs/design/ Claude Design frontend prompt pack (3 files) from PR #92's
  branch — targets the v0.2 frontend; NEO data-model sections predate
  #108/#109 and need a refresh before use (noted in its provenance table).
- docs/audits/ archive of AUDIT_LANDSCAPE.md + REVIEW_RECONCILIATION.md
  from PR #90's branch, with HISTORICAL SNAPSHOT headers — findings were
  fixed by #94-#110; preserved as engineering history. Its
  STALE_BRANCH_TRIAGE.md is dropped (superseded by #110).

Part 1/Step 2 of the v0.1.1 main-only consolidation.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
THOClabs added a commit that referenced this pull request Aug 7, 2026
…ry tests (#114)

Recovered from the legacy master branch before its deletion: a purely
additive spiral search-route generator (Waypoint, SearchRoute,
generate_spiral_route, destination_point, initial_bearing) for
hopi_circles, plus the comprehensive test suites for hopi_circles and
trajectory (the only content of master's 8 unique commits not already
superseded by #108/#109/#111). All tests pass against current main.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@THOClabs
THOClabs deleted the fix/neo-feed-distance-utc branch August 7, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants