Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
1475684
test: synthetic device-tree builders for meter, position, role, shari…
cayossarian Oct 8, 2026
8ed74a8
test: fixed description names, relay-less and free-form shared-with c…
cayossarian Oct 8, 2026
1f25c75
Merge origin/main into test/r202639-captures
cayossarian Oct 9, 2026
46d6a83
feat(circuits): report a circuit without a breaker space as a meter o…
cayossarian Oct 9, 2026
1f16359
Merge remote-tracking branch 'origin/main' into feat/space-less-meters
cayossarian Oct 9, 2026
ad2800d
test: replay the r202639 reference captures through the adapter
cayossarian Oct 9, 2026
81a7d2b
test: mark listed tests as strict expected failures
cayossarian Oct 9, 2026
39d12cd
test: Don's acceptance tests for the schema-1 snapshot
dcj Oct 9, 2026
e9d5c1e
test: acceptance tests for whether a panel publishes solar roles
cayossarian Oct 9, 2026
d64f11f
test: name both behaviours the metadata row waits on, and reject rows…
cayossarian Oct 9, 2026
ecfc624
test: assert what the divergent acceptance tests check after their di…
cayossarian Oct 9, 2026
83a0cb6
Merge pull request #193 from SpanPanel/test/synthetic-trees
cayossarian Oct 9, 2026
ab4120c
Merge pull request #195 from SpanPanel/feat/space-less-meters
cayossarian Oct 9, 2026
afb5c21
Merge remote-tracking branch 'origin/prerelease/3.8' into test/r20263…
cayossarian Oct 9, 2026
e493842
Merge pull request #197 from SpanPanel/test/acceptance-tests
cayossarian Oct 9, 2026
f10f345
Merge pull request #194 from SpanPanel/test/r202639-captures
cayossarian Oct 9, 2026
98169d7
feat(adapter): bound the wait for a declared device model that is nev…
cayossarian Oct 9, 2026
f16387d
feat(battery): report battery presence from the device tree
cayossarian Oct 9, 2026
c3e6d00
fix(panel): leave the service entrance unknown while the lugs' feed i…
cayossarian Oct 9, 2026
279cffc
feat(auth): raise a typed error when registration is rate-limited
cayossarian Oct 9, 2026
062e063
test: register the registration rate-limit divergences
cayossarian Oct 9, 2026
9aadebf
feat(evse): expose the lock as a control target where it is settable
cayossarian Oct 9, 2026
46aebbf
feat(battery): read the link status of a battery fed by a circuit
cayossarian Oct 9, 2026
d3a1de1
test: place the reference tree's circuits inside the model's positions
cayossarian Oct 9, 2026
6a7c6c6
feat(panel): report the first and last breaker positions, and no size…
cayossarian Oct 9, 2026
0decfb2
feat(circuits): report each circuit's declared feeds role
cayossarian Oct 9, 2026
f1253cf
fix(discovery): stop reporting a circuit's feeds role as discovered
cayossarian Oct 9, 2026
878870d
feat(circuits): resolve shared meters and relays to circuit ids
cayossarian Oct 9, 2026
cf99640
build(schema-1): record the core floor this parser needs at release
cayossarian Oct 9, 2026
03311eb
feat(snapshot): read busbar current, frequency, protection rating, no…
cayossarian Oct 9, 2026
13814dc
feat(privacy): keep site properties out of extension and adopted read…
cayossarian Oct 9, 2026
53a7662
feat(evse): lock and unlock a charger's connector
cayossarian Oct 9, 2026
07d5a06
test: replay the space-less meters of every reference capture
cayossarian Oct 9, 2026
af13a87
Merge pull request #200 from SpanPanel/feat/declared-unvalued-devices
cayossarian Oct 9, 2026
a295670
Merge pull request #202 from SpanPanel/feat/evse-lock
cayossarian Oct 9, 2026
2dfe7fd
Merge pull request #203 from SpanPanel/test/space-less-meters-captures
cayossarian Oct 9, 2026
15bfd30
test: Don's acceptance tests for registration rate limits
dcj Oct 9, 2026
97a6636
Merge origin/prerelease/3.8 into feat/panel-positions
cayossarian Oct 9, 2026
182448b
Merge remote-tracking branch 'origin/feat/panel-positions' into feat/…
cayossarian Oct 9, 2026
6c5d9a3
Merge remote-tracking branch 'origin/feat/feeds-role' into feat/share…
cayossarian Oct 9, 2026
83ce7a4
Merge remote-tracking branch 'origin/feat/shared-meters' into feat/pa…
cayossarian Oct 9, 2026
1a924eb
Merge pull request #201 from SpanPanel/feat/panel-positions
cayossarian Oct 9, 2026
18d4335
test: pin the registration delay in seconds and the statuses around 429
cayossarian Oct 9, 2026
1421f9b
Merge pull request #204 from SpanPanel/feat/circuit-fed-battery
cayossarian Oct 9, 2026
b8f5d29
Merge pull request #205 from SpanPanel/feat/feeds-role
cayossarian Oct 9, 2026
5e2957f
Merge pull request #206 from SpanPanel/feat/shared-meters
cayossarian Oct 9, 2026
8d24a15
Merge pull request #208 from SpanPanel/feat/register-rate-limit
cayossarian Oct 9, 2026
f1f042d
Merge origin/prerelease/3.8 into feat/panel-and-circuit-properties
cayossarian Oct 9, 2026
98b5981
Merge pull request #207 from SpanPanel/feat/panel-and-circuit-properties
cayossarian Oct 9, 2026
e771be7
Merge main into prerelease/3.8
cayossarian Oct 9, 2026
7e4a92b
Merge pull request #209 from SpanPanel/sync/main-into-3.8
cayossarian Oct 9, 2026
11e9c5b
test: measure the r202639 reference captures with the adapter fidelit…
cayossarian Oct 9, 2026
4240d84
Merge pull request #210 from SpanPanel/test/r202639-capture-cells
cayossarian Oct 9, 2026
b395646
docs: guidance on what to keep current when the code changes
cayossarian Oct 9, 2026
649845b
chore(release): span-panel-api 3.8.0b1 and schema-1 1.4.0b1
cayossarian Oct 9, 2026
e7e5127
docs(models): first_position is the model table's range
cayossarian Oct 9, 2026
2d70be3
docs(changelog): state the adapter floors the extras now require
cayossarian Oct 9, 2026
da62408
docs(agents): say exactly what the capture pins cover
cayossarian Oct 9, 2026
8bc780b
test: a registry row naming a missing file or test stops every run
cayossarian Oct 9, 2026
c832798
docs(changelog): record is_240v and lugs_at_service_entrance becoming…
cayossarian Oct 9, 2026
8967349
Merge pull request #211 from SpanPanel/chore/release-3.8.0b1
cayossarian Oct 9, 2026
89eb2e2
docs: record lessons from review in AGENTS.md
cayossarian Oct 9, 2026
14c763f
docs: keep only the verification lessons in AGENTS.md
cayossarian Oct 9, 2026
877c5aa
Merge pull request #212 from SpanPanel/docs/review-lessons
cayossarian Oct 9, 2026
3366b6d
docs(agents): no AI attribution in history or on GitHub
cayossarian Oct 10, 2026
a19b024
Merge pull request #213 from SpanPanel/docs/agents-no-ai-attribution
cayossarian Oct 10, 2026
4a8c933
fix(snapshot): a panel with no MID is on-grid whatever grid power reads
cayossarian Oct 14, 2026
7194d2b
Merge pull request #216 from SpanPanel/fix/no-mid-on-grid-3.8
cayossarian Oct 14, 2026
ce9cccd
chore(release): span-panel-api-schema-1 1.4.0b2
cayossarian Oct 14, 2026
d2500d6
Merge pull request #217 from SpanPanel/chore/release-schema-1-1.4.0b2
cayossarian Oct 14, 2026
13aea80
fix(scripts): keep setup-hooks.sh from binding the shared hook to a w…
cayossarian Sep 13, 2026
df08bd6
feat(scripts): add new-worktree.sh
cayossarian Sep 13, 2026
ae08c30
feat(scripts): install the shared pre-commit hook before creating a w…
cayossarian Sep 14, 2026
2edfe9f
docs(agents): create worktrees with new-worktree.sh
cayossarian Oct 24, 2026
9385c1b
Merge pull request #218 from SpanPanel/feat/worktree-tooling
cayossarian Oct 24, 2026
a2fe441
fix(transport): route each message through one topic matcher
cayossarian Oct 30, 2026
cd494da
fix(adapter): remember readiness until the tree changes
cayossarian Oct 30, 2026
c7deac9
chore(release): span-panel-api-schema-1 1.4.0b3
cayossarian Oct 30, 2026
52098f8
Merge pull request #224 from SpanPanel/fix/dispatch-perf
cayossarian Oct 30, 2026
2e2e2f0
Merge branch 'prerelease/3.8' into chore/release-schema-1-1.4.0b3
cayossarian Oct 30, 2026
6afcdb4
Merge pull request #225 from SpanPanel/chore/release-schema-1-1.4.0b3
cayossarian Oct 30, 2026
86ac01a
chore(deps-dev): pin ebus-panel-sim 0.9.0 and recapture the reference…
cayossarian Oct 31, 2026
8e09fbf
feat: add the masked device-tree types and optional adapter protocol
cayossarian Oct 31, 2026
4761fa3
feat(schema-1): assign masked placeholders to every device in the tree
cayossarian Oct 31, 2026
67d564a
test(schema-1): rename with rank-ordered ids in the placeholder id-ch…
cayossarian Oct 31, 2026
de09107
fix(schema-1): make placeholder order total and cover the taken-direc…
cayossarian Oct 31, 2026
afcc9ec
feat(schema-1): export the tree in tree-v1 form with identifiers and …
cayossarian Oct 31, 2026
0eb1a5d
fix(schema-1): treat a non-object description as undescribed and corr…
cayossarian Oct 31, 2026
69ace10
fix(schema-1): keep every placeholder distinct and mask site and seri…
cayossarian Oct 31, 2026
410ab6c
feat(schema-1): sweep the exported tree for any remaining device id o…
cayossarian Oct 31, 2026
f12a6d4
fix(schema-1): sweep the utility meter serial as an identifier
cayossarian Oct 31, 2026
01f78e0
fix(schema-1): sweep identifiers after a JSON escape, dangling ids an…
cayossarian Oct 31, 2026
98a5bbd
fix(schema-1): sweep only id-like dangling references and never split…
cayossarian Oct 31, 2026
d5aa22f
fix(schema-1): sweep JSON values literal by literal and plain text wi…
cayossarian Oct 31, 2026
08ba95d
fix(schema-1): sweep every JSON literal and the text between them
cayossarian Oct 31, 2026
86a3d87
fix(schema-1): bound the JSON sweep and decode literals leniently
cayossarian Oct 31, 2026
24da778
feat: expose the masked device tree on the client
cayossarian Oct 31, 2026
b5f842a
fix(schema-1): bound the description sweep and sweep an unclosed lite…
cayossarian Nov 1, 2026
d98d297
docs: correct the masked-tree notes
cayossarian Nov 1, 2026
59a0202
Merge pull request #229 from SpanPanel/feat/masked-tree-export
cayossarian Nov 1, 2026
a8196b8
fix(schema-1): refuse a charge-current limit below the declared range
cayossarian Nov 1, 2026
b2d964d
test(schema-1): make the catalogued-spelling metadata test fail witho…
cayossarian Nov 1, 2026
eb93c67
fix(schema-1): read a charge-limit range strictly
cayossarian Nov 1, 2026
273d4e2
fix(schema-1): give descriptions their own bound, mask after a litera…
cayossarian Nov 1, 2026
34af5af
fix: read a cleared retained property as unpublished
cayossarian Nov 1, 2026
37f17ba
fix(schema-1): read a subtyped device as its class (#228)
cayossarian Nov 1, 2026
70358ac
fix(schema-1): place a subtyped circuit or lugs as its class in the m…
cayossarian Nov 1, 2026
c6767f7
docs(schema-1): state #228's changelog entry exactly
cayossarian Nov 1, 2026
5a40b6c
fix(schema-1): cap how deep a kept description subtree is copied
cayossarian Nov 1, 2026
c4307e5
test: replay an empty value as 0x00 in the fidelity harness too
cayossarian Nov 1, 2026
baabfa2
docs(schema-1): say the declared charge-limit range bounds both ways
cayossarian Nov 1, 2026
32cc37a
docs(schema-1): shorten the #228 changelog entry
cayossarian Nov 1, 2026
1f55720
Merge pull request #232 from SpanPanel/fix/cleared-retained
cayossarian Nov 1, 2026
05a49cc
Merge remote-tracking branch 'origin/prerelease/3.8' into fix/charge-…
cayossarian Nov 1, 2026
20bed9a
Merge pull request #233 from SpanPanel/fix/charge-limit-bounds
cayossarian Nov 1, 2026
1ff5583
Merge remote-tracking branch 'origin/prerelease/3.8' into fix/subtype…
cayossarian Nov 1, 2026
a294fa7
Merge pull request #230 from SpanPanel/fix/subtype-classes
cayossarian Nov 1, 2026
c620a42
Merge remote-tracking branch 'origin/prerelease/3.8' into feat/masked…
cayossarian Nov 1, 2026
295e02b
Merge pull request #231 from SpanPanel/feat/masked-tree-export
cayossarian Nov 1, 2026
3ab4a04
docs(changelog): tighten the 3.8 entries
cayossarian Nov 1, 2026
3a5f229
Merge pull request #234 from SpanPanel/docs/changelog-tidy
cayossarian Nov 1, 2026
be8b2cb
chore(release): span-panel-api 3.8.0b2 and schema-1 1.4.0b4
cayossarian Nov 1, 2026
2bc2b00
Merge pull request #235 from SpanPanel/chore/release-3.8.0b2
cayossarian Nov 1, 2026
2bb26ae
feat: report the charge-current limit range a SPAN Drive declares
cayossarian Nov 1, 2026
d76219f
Merge pull request #236 from SpanPanel/feat/charge-limit-range
cayossarian Nov 1, 2026
60ddc09
fix(schema-1): mask the panel's time zone and country code in the tre…
cayossarian Nov 1, 2026
85915c8
test(schema-1): plant declared but unvalued site properties in reiden…
cayossarian Nov 1, 2026
c479d81
Merge pull request #237 from SpanPanel/fix/mask-region-values
cayossarian Nov 1, 2026
beb2ecd
docs(changelog): state the #223 fix in one sentence
cayossarian Oct 30, 2026
ae91ffa
Merge pull request #227 from SpanPanel/docs/changelog-223-concise
cayossarian Nov 1, 2026
71ed98c
Merge prerelease/3.8 into main for the 3.8.0 release
cayossarian Nov 10, 2026
e4a8b94
chore(release): span-panel-api 3.8.0, schema-0 1.3.0 and schema-1 1.4.0
cayossarian Nov 10, 2026
d5c3565
docs(readme): describe what 3.8.0 and schema-1 1.4.0 add
cayossarian Nov 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .deps-installed
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ xnotes/*
.env
.envrc
.venv
.deps-installed
.vscode/settings.json

# mypy
Expand Down
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ repos:
hooks:
# `packages/schema-1/spec/` holds byte copies of the eBus specification,
# verified by byte comparison in tests/test_schema_one_conformance.py, and
# `tests/fixtures/captures/` holds byte copies of upstream reference captures
# and their LICENSE, pinned by SHA-256 in tests/test_captures_unchanged.py, and
# the two MAIN 32 captures in tests/fixtures/ are byte copies of upstream with
# that repository's LICENSE beside them, pinned by SHA-256 in
# tests/adapter_fidelity/test_main32_fidelity.py. Any hook that rewrites a file
# must skip them: a "fix" there would silently invalidate the comparison that
# makes the copies trustworthy. Non-mutating checks (check-json) deliberately
# still run, since a corrupt copy should fail.
- id: trailing-whitespace
exclude: '^src/span_panel_api/generated_client/.*|^packages/schema-1/spec/.*|^tests/fixtures/(main32(_r202639)?-tree-v1\.json|distribution-enclosure-simulator\.LICENSE)$|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'
exclude: '^src/span_panel_api/generated_client/.*|^packages/schema-1/spec/.*|^tests/fixtures/(captures/(.*\.json|LICENSE)|main32(_r202639)?-tree-v1\.json|distribution-enclosure-simulator\.LICENSE)$|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'
- id: end-of-file-fixer
exclude: '^src/span_panel_api/generated_client/.*|^packages/schema-1/spec/.*|^tests/fixtures/(main32(_r202639)?-tree-v1\.json|distribution-enclosure-simulator\.LICENSE)$|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'
exclude: '^src/span_panel_api/generated_client/.*|^packages/schema-1/spec/.*|^tests/fixtures/(captures/(.*\.json|LICENSE)|main32(_r202639)?-tree-v1\.json|distribution-enclosure-simulator\.LICENSE)$|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'
- id: check-yaml
exclude: '^src/span_panel_api/generated_client/.*|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'
- id: check-toml
Expand All @@ -28,7 +30,7 @@ repos:
exclude: '^src/span_panel_api/generated_client/.*|generate_client\.py|scripts/.*|tests/.*|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*|^examples/.*'
- id: mixed-line-ending
args: ['--fix=lf']
exclude: '^src/span_panel_api/generated_client/.*|^packages/schema-1/spec/.*|^tests/fixtures/(main32(_r202639)?-tree-v1\.json|distribution-enclosure-simulator\.LICENSE)$|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'
exclude: '^src/span_panel_api/generated_client/.*|^packages/schema-1/spec/.*|^tests/fixtures/(captures/(.*\.json|LICENSE)|main32(_r202639)?-tree-v1\.json|distribution-enclosure-simulator\.LICENSE)$|\..*_cache/.*|dist/.*|venv/.*|\.venv/.*'

# Ruff for formatting and linting
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
99 changes: 99 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Working on span-panel-api

Guidance for anyone changing this repository, person or coding agent. It lists what has to be kept up when the code changes; the procedures themselves live in [DEVELOPMENT.md](DEVELOPMENT.md) (setup, tests, captures, conformance) and
[RELEASE.md](RELEASE.md) (versions, floors, tags, pre-releases). Read those before changing a capture, a dependency floor or a version.

## No AI Attribution

Do not attribute work to Claude, Copilot or any other AI agent anywhere in this repository's history or on GitHub. Work belongs to the human who directs it.

- No `Co-Authored-By` or other AI co-author trailer in a commit message.
- No "Generated with" / "Generated by" footer, and no AI session link, in a commit message, pull request description, issue, comment or release note.
- No mention of AI tools in code, comments, documentation or the changelog.

This rule takes precedence over any default tool behaviour that would add attribution.

## Worktrees

Create worktrees with `scripts/new-worktree.sh`, never with `git worktree add` or an agent's built-in worktree tool:

```bash
./scripts/new-worktree.sh <name> [<branch>] # <branch> defaults to feat/<name>
```

It creates `../span-panel-api-<name>` beside the primary checkout from a freshly fetched `origin/main`, prepares it with `setup-hooks.sh`, and links `.env`. That location is the one the integration's developer notes expect when installing a library
worktree into its environment. [DEVELOPMENT.md](DEVELOPMENT.md#worktrees) has the details.

- **Never share a virtual environment between checkouts.** This repository installs its own distributions in editable mode, each recording one checkout's source path, so a shared `.venv` imports whichever checkout synced last and tests pass against the
wrong code without an error.
- **Install the pre-commit hook from the primary checkout.** Hooks are shared by every worktree and record the interpreter that installed them. `new-worktree.sh` installs the hook from the primary checkout when it is missing or bound elsewhere, and refuses
to create the worktree if that fails. `setup-hooks.sh` in a worktree checks the shared hook rather than rebinding it to an environment that is deleted with the worktree.

## The rule every field follows

A value the panel did not publish is `None` (or unknown), never a constant. A `0.0`, `False`, `""` or empty collection in a snapshot field is a reading the panel published, or an answer the library can derive from what the panel declared, and the docstring
of the field says which. Where a field is not yet optional, the adapter fidelity harness records its absence value as an explicit, reasoned exception rather than letting it pass unnoticed.

## When you add, rename or change a snapshot field or an adapter read

Every read the schema-1 adapter makes is accounted for in more than one place, and each place fails the suite if it is left behind:

- **Field metadata and discovery** (`packages/schema-1/src/span_panel_api_schema_1/field_metadata.py`). A reading with a unit gets a `_PROPERTY_FIELD_MAP` row, or a row in a lugs table; a property read into the snapshot without one goes in
`_CONSUMED_WITHOUT_A_ROW`. Otherwise it is reported as discovered and becomes an extension reading. `tests/test_schema_one_discovery.py` proves each entry by perturbing it against the reference tree; an entry the tree does not declare goes in
`_ABSENT_FROM_THE_CAPTURE` with a synthetic experiment of its own.
- **Conformance** (`tests/test_schema_one_conformance.py`). A property no vendored catalog defines goes in `_SPAN_EXTENSIONS`, and one the pinned emitter's reference tree never declares goes in `_NOT_EXERCISED_BY_THE_EMITTER`, each with its reason.
- **Public API** (`tests/test_public_api_unchanged.py`). A new export is added to `__all__` and to the expected set, with a dated note.
- **The adapter fidelity harness** (`tests/adapter_fidelity/`), below.

## The adapter fidelity harness

`harness.py` replays a captured device tree through the real adapter, perturbs every declared property, and classifies each one: mapped, an extension reading, intentionally dropped by code that says why, or silently dropped. It then holds every value to a
documented rule:

- **Transforms** (`rules.TRANSFORMS`): for each row (a device role and a `node/property`) and each snapshot field it moves, how the field follows from the wire value: identity, negation, integer, literal, boolean, or a derivation with the rule stated where
it is simple. Every cell shares them, and `test_every_mapped_field_has_a_documented_transform` requires one for every field-metadata row. Change the transform when you change a read, and give a device whose frame differs its own role rather than bending
a shared row.
- **Derivations**: a field that holds a value no published property moves on its own, such as one decided by a declaration, or a documented elimination. Each cell carries only the derivations its captures need. `test_every_derivation_is_needed` refuses one
that no cell uses, because an unused justification is how a list of reasons becomes an allowlist. `rules.py` holds the derivations for the two captures in `tests/fixtures/`, and `rules_captured.py` holds those for the reference captures.
- **Drops** (`DropReason`): the three kinds of intentional drop, each citing the code. A cell pins every row it drops _with a value_, each with a reviewed reason (`dropped_with_a_value` in `test_main32_fidelity.py`, `DROPPED_WITH_A_VALUE` in
`test_capture_fidelity.py`), so a drop rule that newly covers a published property waits for review. Rows the library drops today but should not are listed in `deferred` with the reason, and a deferral that no longer holds fails like a new silent drop.

`test_capture_fidelity.py` measures every capture in `tests/fixtures/captures/` and pins by row, never by capture, so a capture added to that directory is covered without editing the tests. `test_harness.py` plants each kind of defect and checks the
harness names it.

## The expected-failure registry

`tests/expected_failures.py` lists, by `<file>::<function>`, the acceptance tests this line does not pass yet. `tests/conftest.py` marks each one `xfail(strict=True)`, so:

- a `PENDING` row is behaviour a later change brings, and that change deletes the row: a listed test that starts passing fails the run until it is;
- a `DIVERGENT` row is behaviour this library deliberately does not have, and stays until the test or the decision changes;
- a row naming a file that does not exist, or a test function that file does not define (at module level or on a `Test` class), stops the run. The check reads the files rather than the tests a run collected, so a partial run (`-k`, one file) judges every
row exactly as a full run does, and a renamed or deleted test file cannot orphan its rows.

Ported acceptance tests are never edited. A strict xfail stops at its first failing line, so a companion file (`*_companions.py`) asserts what each divergent test checks after its divergent line.

## Vendored captures

Captures are byte copies and must stay that way:

- `tests/fixtures/captures/` holds the reference captures with their upstream `LICENSE` and a `README.md` naming the upstream repository, path and commit; `SHA256SUMS` pins each capture and the `LICENSE` by SHA-256. `tests/test_captures_unchanged.py`
checks every pin, requires a pin for every capture and the directory to hold nothing but the pinned files, `README.md` and `SHA256SUMS`; those two are this repository's records and are not pinned. The two captures in `tests/fixtures/` are pinned the same
way by `tests/adapter_fidelity/test_main32_fidelity.py`.
- `.pre-commit-config.yaml` excludes them from every hook that rewrites files. Keep any new capture path in those excludes.
- A capture is replaced only by copying it again from its upstream commit and updating the pins, never by editing it.

The schema-1 reference tree (`packages/schema-1/src/span_panel_api_schema_1/reference/parent_child_tree.json`) is package data, produced by `scripts/capture_parent_child_reference.py` from `scripts/reference_panel.yaml` with the pinned emitter;
DEVELOPMENT.md, "Regenerating a vendored capture", has the procedure. Change the manifest, never the output, and keep every circuit inside the position range `PANEL_POSITIONS_BY_MODEL` gives the panel's model: the adapter reports the table's range and
warns once for a panel whose circuits fall outside it. A changed capture is a release of the adapter that ships it (RELEASE.md).

## Lessons from review

What a change must do is decided before it is written; these are the checks made while writing and verifying it. Each was a defect that review has already caught at least once, in this repository or in the emitter it is tested against.

- **Prove a test or a guard by breaking what it guards.** Revert the fix or mutate the code and confirm the test fails; a guard that survives every mutation guards nothing. Assert what a consumer can observe, the snapshot value or the published outcome,
not an internal step.
- **A test that keeps documentation runnable reads the documentation.** A hand-copied recipe pins the sequence but lets the document rot.
- **Check the changelog as it will ship.** Check where each entry lands, since a new heading inserted above an entry re-files it with no deletion in the diff, and re-derive every count or list against the source at the tag.
- **Read data as published.** A `null` or empty value in a capture means unpublished, never zero. A predicate that reads declared metadata refuses what it cannot interpret instead of guessing.
- **One capture is not the firmware.** Check a change against every capture available; panels on the same firmware release do not always publish a value in the same form.
- **Measure claims.** A statement about a real panel, broker or built artifact is checked there, and a result is reported only after it has actually been run.
21 changes: 14 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,39 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Pre-releases are not listed separately. A beta is a step towards the next public version, so its changes are folded into that version's entry as they land and are described against the **last public release**, never against the beta before it. What one
beta corrected in an earlier beta does not appear at all: from the point of view of somebody upgrading between released versions, it never happened.

## [Unreleased]
## [3.8.0]

Snapshot fields that held a fabricated constant can now be unknown, and with `span-panel-api-schema-0` and `span-panel-api-schema-1` 1.3.0 or newer the parsers report them as unknown and stop synthesising unoccupied positions.
Snapshot fields that held a fabricated constant can now be unknown, and with `span-panel-api-schema-0` 1.3.0 and `span-panel-api-schema-1` 1.4.0 or newer the parsers report them as unknown and stop synthesising unoccupied positions.

### Added

- **spanos3/r202639/03 batch 2: reads more of the data this firmware publishes.**
- **`SpanMqttClient.masked_tree()` returns the panel's device tree with identifiers and site details masked**, for a consumer's diagnostics; `None` on a flat panel.
- **`V2StatusInfo.hardware_version` reports the hardware version string from `GET /api/v2/status`.**
- **`SpanEvseSnapshot.charge_current_limit_minimum_a` and `charge_current_limit_maximum_a` report the range a SPAN Drive declares for its charge-current limit**, `None` where undeclared.

### Changed

- **BREAKING FOR CONSUMERS: `SpanPanelSnapshot.proximity_proven` becomes `bool | None`**, and with `span-panel-api-schema-0` and `span-panel-api-schema-1` 1.3.0 or newer it is always `None`, where it was effectively a constant `True`, because neither MQTT
schema publishes a proximity property and the panel's own answer is `V2StatusInfo.proximity_proven`.
- **BREAKING FOR CONSUMERS: `SpanPanelSnapshot.proximity_proven` becomes `bool | None`**, and with `span-panel-api-schema-0` 1.3.0 and `span-panel-api-schema-1` 1.4.0 or newer it is always `None`, where it was effectively a constant `True`, because neither
MQTT schema publishes a proximity property and the panel's own answer is `V2StatusInfo.proximity_proven`.
- **BREAKING FOR CONSUMERS: `SpanPanelSnapshot.uptime_s` becomes `int | None`**, and with those parsers it is `None` on a parent/child panel and before a flat panel first reports ready, where it was a constant `0`.
- **BREAKING FOR CONSUMERS: `SpanCircuitSnapshot.instant_power_update_time_s` and `energy_accum_update_time_s` become `int | None` and default to `None`**, and with those parsers they are `None` until the reading has arrived and always on a parent/child
panel, where they were `0`.
- **The `schema-0` and `schema-1` extras require `span-panel-api-schema-0` and `span-panel-api-schema-1` 1.3.0 or newer**, the adapters that report these values as unknown.
- **BREAKING FOR CONSUMERS: `SpanCircuitSnapshot.is_240v` becomes `bool | None`**, and with `span-panel-api-schema-1` 1.4.0 or newer it is `None` where the pole count is unpublished.
- **BREAKING FOR CONSUMERS: `SpanPanelSnapshot.lugs_at_service_entrance` becomes `bool | None`**, and with `span-panel-api-schema-1` 1.4.0 or newer it is `None` while the upstream lugs declare their feed but leave it unpublished.
- **The `schema-0` extra requires `span-panel-api-schema-0` 1.3.0 or newer and the `schema-1` extra requires `span-panel-api-schema-1` 1.4.0 or newer**, the adapters that report these values as unknown; schema-1 1.4.0 also fills the snapshot fields this
release adds.

### Removed

- **BREAKING: with `span-panel-api-schema-0` and `span-panel-api-schema-1` 1.3.0 or newer, snapshots no longer include synthesised `unmapped_tab_N` entries for unoccupied breaker positions, which carried no measured data**, so `SpanPanelSnapshot.circuits`
holds only real circuits and `panel_size` alone states the panel's total positions.
- **BREAKING: with `span-panel-api-schema-0` 1.3.0 and `span-panel-api-schema-1` 1.4.0 or newer, snapshots no longer include synthesised `unmapped_tab_N` entries for unoccupied breaker positions, which carried no measured data**, so
`SpanPanelSnapshot.circuits` holds only real circuits and `panel_size` alone states the panel's total positions.

### Fixed

- **`V2HomieSchema.types_schema_hash` on data model 1.0 is the panel's published `deviceClassesSchemaHash`, or a hash of `deviceClasses` when none is published, where it was one constant for every such panel**; a flat panel's value is unchanged, and a
value stored from 3.6.x differs once on a data model 1.0 panel.
- **A property the panel clears reads as unpublished** on a parent/child panel, where it read as an empty value until the panel published it again.

## [3.6.2]

Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
Loading
Loading