Skip to content

Improve archive recovery, multi-station workflows, and weather analysis for v0.4.0 - #9

Merged
lennrt merged 15 commits into
lennrt:mainfrom
agent-lennrt:improve/archive-insights-20261018
Oct 18, 2026
Merged

lennrt merged 15 commits into
lennrt:mainfrom
agent-lennrt:improve/archive-insights-20261018

Conversation

@agent-lennrt

@agent-lennrt agent-lennrt commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Archive owners can repair selected history and continue bounded MCP backfills across daylight-saving changes. Metadata exports support reproducible analysis. Multi-station users can select the exact MCP collection device and find its parent station in the app. Weather views preserve sensor coverage, correct seasonal and pressure trends, expose dense chart readings, and keep table controls across refreshes.

This consolidated batch contains twelve improvements and the 0.4.0 development version bump:

  • CLI range repair: collect --start YYYY-MM-DD --end YYYY-MM-DD fills old gaps even when newer observations exist. Both local dates are included, with a 366-calendar-day limit. Invalid ranges fail before external work. Replay preserves committed rows and ordinary collection metadata, with existing checkpoint and backup rules.

  • Exact MCP continuation: backfill_archive accepts exclusive before_epoch. Pass the returned next_before directly and repeat start and max_days. Explicit requests preserve shared progress. This fixes the one-hour gap that date-only continuation can leave on a 25-hour day.

  • Event-sensor coverage: observation points include rain_readings and lightning_readings. Counts distinguish unknown totals, measured zero, and partial coverage. MCP Apps displays missing readings and an incomplete-coverage notice while preserving original tool results and arbitrary SQL values.

  • Seasonal trend correction: center both time and temperature within each calendar month. An unmatched month no longer dilutes the trend. The regression fixture previously reported about 0.8973°F per decade instead of 36. Repeated constant readings return zero slope, with undefined R² omitted and a “flat” CLI label.

  • Dense chart inspection: pointer, touch, and keyboard controls select every returned point, up to 2,000. The inspector shows the source time and timezone, metric, units, and missing state. It uses actual plotted spacing and preserves selection and focus on resize.

  • Richer exports: opt-in export --metadata appends device identity, report and wind intervals, precipitation type, and source. Default CSV/JSONL output stays unchanged. The new read-only streaming API preserves stored zeroes and missing values, supports older schemas, bounds source text, and enables reproducible solar-energy estimates.

  • Table refresh continuity: compatible results keep the selected dataset, search, sort direction, and valid page. Pending edits, search focus, and text selection survive. Changed structures or new request contexts reset controls; failed refreshes keep the previous view.

  • MCP device selection: mcp --device-id overrides TEMPEST_DEVICE_ID. A positive ID resolves lazily to an accessible Tempest device and its default station. Empty or zero environment values keep discovery. Explicit tool station overrides affect one read only. Unknown or non-Tempest selections cannot collect into or bind the archive, and archive-only reads remain available.

  • Station-device exploration: list_stations gains a derived Devices table with parent station ID/name, device ID/type, and serial. IDs are searchable without separators. The view retains missing fields and duplicates, caps traversal at 2,000 stations and device entries, and marks unsafe browser integers instead of offering rounded IDs. No payload mutation or extra API call is needed.

  • Pressure comparison correction: use indexed candidates on both sides of the requested window start, choose the nearest eligible sample, and prefer the older sample on ties. Pairs must span at least half the window. A sparse fixture previously reported rising pressure (+3 mb/3h) where the nearest reading shows falling pressure (about -6.0335 mb/3h). Actual sample span and freshness rules remain visible.

  • Early report validation: stats and export reject unsupported epochs or ranges above the existing elapsed-span limit before dotenv or archive access, returning usage status 2. Valid local calendar days retain their daylight-saving boundaries.

  • Rain-summary coverage: rain_stats and CLI rain reports return an explicit null total when no rain readings exist, preserve measured zero, and expose observations plus rain_readings. Partial totals sum only reported measurements. The app keeps a rainfall headline for missing data and shows coverage without implying continuous uptime.

Nine improvements came from code and workflow investigation under the autonomous improvement request. Richer exports, table-filter persistence, rain-summary coverage, the feature-focused documentation overview, and the version bump were explicit user priorities. The docs overview now leads with multi-station discovery and selection, then highlights interactive charts, archive repair, exports, and offline workflows. No open feature issue supplied this scope. Existing dependency PRs #2, #6, and #8 are outside this batch.

Compatibility

  • Public Go API impact is classified: SeriesPoint adds two integer fields. Existing method signatures stay unchanged. RainStats.TotalIn changes from float64 to *float64; callers must handle nil. RainStats also adds Observations and RainReadings. External unkeyed SeriesPoint struct literals need the added fields. ArchiveObs, EachArchiveObs, and MaxArchiveSourceBytes are additive API for streaming stored metadata.
  • JSON and MCP impact is classified: additive before_epoch input and reading counts. Strict JSON consumers must accept the new fields. Corrected seasonal and sparse-pressure trend values and flat-series behavior are intentional. Export metadata is opt-in and leaves default output unchanged. Rain summary total_in is always present as number-or-null, with two required sample counts; strict consumers must accept these changes.
  • Archive and configuration impact is classified: no schema migration or new runtime dependency. MCP now honors TEMPEST_DEVICE_ID, including rejecting previously ignored malformed values. Explicit CLI ranges ignore an environment seed floor and reject an explicit --backfill-start conflict.
  • ADRs and active specifications explain the behavior: archive recovery and coverage, seasonal trends, recovery scenarios, and trend/chart scenarios.

The follow-up export and refresh specification and ADR 0010 record optional metadata, source bounds, table state, and version decisions.

The latest station-selection and pressure specification and ADR 0011 cover device choice, bounded device inspection, pressure samples, and early report bounds. Live conditions and forecasts remain station-level, even when one of several devices at a station is selected. Device resolution retries follow the configured API cache lifetime. Lazy startup can create an empty archive before discovering that a positive device ID is inaccessible; failure cannot bind or collect into it.

The rain coverage specification and ADR 0012 explain the intentional nullable-total contract. Rainy-day thresholds, day counts, wettest-day selection, and spell rules remain unchanged. Counts describe stored samples, not continuous coverage; daily, period, and climate-normal rainfall contracts are outside this slice.

Observation-series numeric event totals retain their existing zero default for compatibility. Consumers must use the new counts to distinguish unavailable readings. Counts measure samples, not continuous uptime. Trend R² describes the within-month fit, not statistical significance.

Verification

  • make verify passed on Go 1.27.2, macOS ARM64: modules, formatting/imports, docs, tidy, vet, ordinary tests, race tests, four fuzz targets, lint, workflows, generated API, vulnerability/license/SBOM/secret checks, pure-Go host and Linux ARM64 builds, and the synthetic MCP demo.
  • npm run spec:check passed all eleven baseline/change items.
  • npm run app:build, npm run app:check, and npm run app:test passed; 55 browser tests cover the final bundle.
  • npm run app:screenshots passed. Desktop and 390-pixel views were inspected independently.
  • New regressions cover DST, invalid input before I/O, cancellation, durable partial failure, replay, unchanged metadata, missing/zero/partial sensors, exact trend arithmetic, irregular chart spacing, touch, keyboard, and resize behavior, export source bounds and escaping, legacy schemas, metadata precision, compatible refresh state, selected-device precedence and failure isolation, nearest pressure sample boundaries, safe identifier display, report timestamp limits, nullable rain totals, measured/partial zero, DST sample counts, and the actual required nullable MCP output schema.
  • The old code failed the new CLI range, exact MCP cursor, sensor-coverage, trend, metadata export, retained-filter, MCP device selection, missing Devices table, pressure direction/short-history, early report validation, serialized missing rain, and the scalar rainfall headline regressions. Independent review findings were fixed and relevant checks rerun.

All 11 hosted checks passed against commit f7d57f2d402fdcf39a523ba94ae17b0e5530a6f4, including full Linux verification, native macOS/Windows tests, 55 browser tests, specifications, CodeQL, lint, and supply-chain checks. See the CI run and PR checks. No live WeatherFlow credentials were used. Browser tests use the official synthetic host and do not certify a specific third-party client. The subprocess signal test skips Windows because os.Interrupt cannot signal a child there; the remaining tests run natively in CI.

Security and privacy

  • Synthetic data only. No credential, private station data, archive, export, or personal path is included.
  • Requests and display work retain existing bounds. New CLI ranges have an explicit limit and fail before external work when invalid.
  • No new network origins, direct browser API calls, write controls, or runtime dependencies. Existing redaction and read-only UI boundaries remain.

Documentation

  • README, CLI/MCP guides, query interpretation, troubleshooting, plugin instructions, release notes, and public API evidence updated.
  • OpenSpec proposals, designs, tested scenarios, task evidence, and five ADRs included.
  • make docs-check and strict specification checks passed after the final evidence edits.

Chart reading inspector with synthetic observations

Active binary fallback, plugin, embedded app, and version guidance now use 0.4.0. The batch uses fifteen logical commits on one branch. No release, tag, deployment, or merge is part of this PR.

@agent-lennrt
agent-lennrt requested a review from lennrt as a code owner October 18, 2026 20:17
@agent-lennrt agent-lennrt changed the title Improve archive recovery, weather analytics, and chart exploration Improve archive recovery, exports, and weather exploration for v0.4.0 Oct 18, 2026
@agent-lennrt agent-lennrt changed the title Improve archive recovery, exports, and weather exploration for v0.4.0 Improve archive recovery, multi-station workflows, and weather analysis for v0.4.0 Oct 18, 2026
@lennrt
lennrt merged commit 10e5925 into lennrt:main Oct 18, 2026
11 checks passed
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