Skip to content

Docs: testing guide + test status snapshot - #6

Merged
frahlg merged 1 commit into
masterfrom
docs/testing
Apr 15, 2026
Merged

frahlg merged 1 commit into
masterfrom
docs/testing

Conversation

@frahlg

@frahlg frahlg commented Apr 15, 2026

Copy link
Copy Markdown
Member

Summary

New `docs/testing.md` covering:

  • Test status snapshot (all unit + integration + e2e green; no CI / coverage tracking yet)
  • Per-package test layout with coverage areas
  • Simulator docs (sim-ferroamp, sim-sungrow) with flags + ports
  • Full-stack e2e contract (what `go/test/e2e/stack_test.go` actually verifies)
  • Where to add tests for each feature kind
  • Mocking patterns (mochi MQTT, simonvetter modbus, clock injection)
  • Coverage roadmap with acknowledged TODOs (CI workflow, api/arp coverage, two regression tests)
  • Lua driver testing section
  • Common test failures + remediation

Test plan

  • `cd go && go build ./...` clean
  • `cd go && go test -timeout 120s -count=1 ./...` all green
  • Every shell command in the doc runs as written
  • No fabricated test counts — verified via `grep "^func Test"`

Covers how to run the suite, where tests live per-package, the two
simulators, the e2e contract, mocking patterns, and the coverage
roadmap. Honest about the gaps — no CI, no coverage tracking, and a
few packages (api, arp, configreload, ha, mqtt, modbus) exercised
only via the full-stack e2e.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84921dfc2a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/testing.md
Run the full suite:

```bash
cd /Users/fredde/repositories/forty-two-watts/go

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use repo-relative paths in runnable test commands

This guide says commands can be pasted directly, but this command hard-codes /Users/fredde/..., which only exists on the author's machine; users on CI, Linux, or different local paths will fail immediately at cd and cannot run the documented test flow. The same absolute-path pattern is repeated in multiple sections, so these should be rewritten to repo-relative commands (for example cd go from repo root) to keep the documentation executable across environments.

Useful? React with 👍 / 👎.

@frahlg
frahlg merged commit 4cf490e into master Apr 15, 2026
@frahlg
frahlg deleted the docs/testing branch April 15, 2026 06:46
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

erikarenhill added a commit that referenced this pull request Apr 20, 2026
5-agent vote per comment accepted 6 of 7:

- Offload HealthTick observeAt to a goroutine so a slow ntfy Publish
  (10 s timeout) can't stall the control loop. The event bus runs
  handlers inline on the publisher, and HealthTick is emitted every
  control tick. (Copilot #1)
- Nil-publisher guard in dispatch(): cold-start or reload with an
  unknown/unconfigured provider used to panic at s.pub.Publish; now
  it's treated as a failed dispatch with a history entry. (Copilot #3)
- Emit NotificationDispatched on template render failures too, so the
  history UI surfaces template errors instead of only publish errors.
  (Copilot #4)
- activeAlert leak fix: when no driver_recovered rule is enabled, a
  post-pass cleanup clears activeAlert for any driver whose telemetry
  is fresh (<30 s). Preserves the original lifecycle: when recovered
  IS enabled, the recovered rule still owns the clear. (Copilot #5)
- Stop seeding backend default templates into currentConfig. Render
  title/body template fields as raw inputs whose placeholder is the
  server default. Blank stays blank, backend fallback keeps working,
  and future server-side default changes apply without operator
  action. (Copilot #6)
- driver_recovered ignores threshold_s on the backend (hardcoded 30 s
  staleness window). Don't render the threshold input for that event
  type — show a clarifying note instead. (Copilot #7)

Tests: new TestActiveAlertClearsWhenRecoveredDisabled and
TestNilPublisherNoPanic. Full suite still green (35 packages).

Skipped Copilot #2 (SQLite write in NotificationDispatched subscriber
blocks the publisher): the write runs after HTTP publish on a path
that already blocks for up to 10 s, a sub-millisecond SQLite insert
adds nothing measurable. 3-of-5 agent votes INVALID.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant