• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FlexMeasures / flexmeasures / 33548645562
88%

Build:
DEFAULT BRANCH: main
Ran 01 Sep 2026 07:28PM UTC
Jobs 1
Files 180
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Sep 2026 07:17PM UTC coverage: 84.434%. Remained the same
33548645562

push

github

web-flow
Summarise which sources recorded for which sensors (#2382)

* Summarise which sources recorded for which sensors

Two mirrored accessors ask which data sources have recorded for which sensors:
Sensor.data_sources reads timed_belief in sensor_id order,
DataSource.sensors reads it in source_id order.
Both answer a question about a relation bounded by sensors times sources,
a few thousand rows at most,
by reading the largest table in the database.

Reordering the primary key to lead with sensor_id (d4a7c1e93b52) makes the second one
worse: nothing leads with source_id any more, so it degrades to a sequential scan.
An index on source_id would fix that, but at a large fraction of what that migration
reclaims, to answer a question about a few thousand rows.

Add a sensor_data_source summary table instead, keyed on the pair.
It serves both accessors as a plain lookup,
so it also removes the sensor-leading one's dependence on scanning beliefs.

Maintained by a statement-level trigger rather than from the save path.
That was not the first design: the hook originally lived in TimedBelief.add_to_session,
on the reasoning that every save funnels through it.
Two existing tests then failed with empty results,
because they insert beliefs without going through that path -- and so do bulk inserts,
COPY, plugins and raw SQL.
A hook would have left the summary silently incomplete in exactly the cases nobody
checks, so the trigger does it instead: unbypassable whatever the insert route,
and one small upsert per statement rather than per row.
A test inserts through raw SQL specifically to pin that.

The trigger and its function are created both by the migration and by a create_all
DDL listener, so a schema built either way behaves the same.
Both are written idempotently, since create_all runs once per test module.

The summary is deliberately a superset:
pairs are added on insert and not removed on delete,
because deciding whether a pair went stale needs exactly the scan ... (continued)

19 of 22 new or added lines in 2 files covered. (86.36%)

5 existing lines in 1 file now uncovered.

18014 of 21335 relevant lines covered (84.43%)

0.84 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
87.7
-0.08% flexmeasures/data/models/time_series.py
1
88.72
-0.17% flexmeasures/data/models/data_sources.py

Coverage Regressions

Lines Coverage ∆ File
5
87.7
-0.08% flexmeasures/data/models/time_series.py
Jobs
ID Job ID Ran Files Coverage
1 33548645562.1 01 Sep 2026 07:28PM UTC 180
84.43
GitHub Action Run
Source Files on build 33548645562
  • Tree
  • List 180
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #33548645562
  • d4e08054 on github
  • Prev Build on main (#33537455536)
  • Next Build on main (#33645675077)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc