Skip to content

fix(alerts): raise load alerts for failing rows, not rows a transform filtered out - #37

Merged
angela-helios merged 56 commits into
HeliosSoftware:mainfrom
Gordex2014:fix/filtered-rows-raise-no-alert
Nov 24, 2026
Merged

angela-helios merged 56 commits into
HeliosSoftware:mainfrom
Gordex2014:fix/filtered-rows-raise-no-alert

Conversation

@Gordex2014

Copy link
Copy Markdown
Contributor

Stacked on #36. This branch starts from #36's head (5914ec6), so until the PRs below it land, the diff against main also shows their work. This PR's own change is git diff 5914ec6: the alert weighing in src/pipeline.rs, the finish and its new mark in src/db.rs, the shared FAILING predicate in src/api.rs, tests in tests/pipeline.rs, tests/alerts.rs, tests/events.rs and tests/loads.rs, and the matching parts of docs/.

What changes

A load whose only rejected rows were filtered out on purpose (its transform returned no resources) still raised a rejected_records alert. A monitoring client then showed failed rows for a source with none failing, although its loads, /stats and the monitoring status already said failing: 0 (decision 42). The alerts a finished load raises now follow its failing rows.

  • The alert without a rule. A source with no rejected_share rule gets a rejected_records alert when a load finishes with failing rows (rejected for any reason but filtered).
    • A load whose only rejected rows are filtered out raises nothing.
    • The message counts only the failing rows, names the filtered ones apart, and quotes the first failing row, never a filtered one: Sieve: 2 of 5 records failed in mixed.csv. 2 others were filtered out by its transform. First: line 4: ….
    • It is raised again only when a Retry or a reprocess leaves more rows failing than any earlier finish of the load saw. That count is a new column, files.failing_reported, raised in the same guarded UPDATE that moves the load to done. rejected_reported counted filtered rows too, so it could hide a new failure. It is still kept up to date for an earlier version sharing the store.
  • rejected_share rules weigh the failing rows among the rows the load kept (every row but the filtered ones).
    • A load that kept no row neither fires nor clears the rule: all filtered out, a header alone, or a zip, whose entries are loads of their own. Before, such a load cleared an open alert.
    • The fire message reads … 100.0% of the rows kept from failed.csv failed, more than the 10% allowed (1 of 1, 9 others were filtered out by its transform). The share is shown with as many decimals as it takes to read above the limit: 1 in 81 against 1.23% shows 1.235, not 1.2. It shows 100.0 only when every kept row failed.
  • load.finished gains detail.failing.
  • Docs:
    • docs/decisions.md: decision 47, with notes on 12 and 22.
    • docs/sources.md: the rules table, the alert without a rule, and the webhook example.
    • docs/api.md: load.finished, and the load's failures groups, which still include the filtered rows as kind filtered so they can be read and retried by reason.
    • docs/development.md: the new tests.

In plain words

When a transform drops rows on purpose, that is no longer reported as rows failing: no alert, and no weight in a rule's percentage. Real failures alert as before.

Side effects checked

  • Upgrade.
    • The column is added with 0 on SQLite and PostgreSQL. rejected_reported is kept as it was.
    • A load finished by an earlier version has no count of its failing rows. If this version finishes it again (after a Retry or a reprocess) with more failing rows than this version has seen of it, the alert is raised, even for rows an earlier alert reported. A notice may repeat; none is lost.
    • Alerts raised before the upgrade for loads whose rows were all filtered out are left as they are. They have no rule, no load id and nothing that clears them, and the message cannot tell such a load from a mixed one. They stay open, and may stay the source's last_alert, until retention purges them.
  • Existing rejected_share rules. On the same load the share is now never higher than before. A threshold raised to tolerate filtering may be lowered again.
  • Two versions on one store. The loads an earlier version finishes are judged its way. A finish by it does not move the new count.
  • Concurrency. finish_file keeps its order on PostgreSQL READ COMMITTED: lock the file row, then the guarded UPDATE that checks no row is in progress and raises both marks, then the counts. Retry and reprocess wait on the file lock, so the counts are the rows as finished.
  • Not changed. /stats, the loads lists, the monitoring status (already on failing), the webhook format, retention, and GET /api/loads/{id} failures.
  • Library types. FinishedFile swaps newly_rejected and first_rejection for failing, newly_failing and first_failure. db::FAILING is public.

How to verify

The CI commands, with CI=true and default parallelism, on this tree (Linux):

$ helios-ci-gate      # fmt, clippy (both feature sets), Python tests, cargo test, the no-backend tests
test: passed (576 tests, 0 failures; Python transform tests OK, 24 tests)

The changed suites (pipeline, alerts, events, loads) ran twice more on SQLite and twice against a throwaway PostgreSQL 16 (HIE_TEST_DATABASE_URL=postgres://...), with no failure. Every suite on PostgreSQL:

$ cargo test --no-fail-fast      # on d75af00, this PR's first commit; the later ones change messages and docs, and their suites ran again on both stores
410 passed, 3 failed:
  secrets::key::tests::a_key_file_removed_after_start_asks_for_a_restart and
  a_socket_at_the_key_path_is_refused, the same two that fail on PostgreSQL before this change;
  hfs_credentials::the_engine_fetches_caches_refreshes_and_drops_its_token, which edits the SQLite file
  directly (tests/hfs_credentials.rs:116) and so cannot run with a PostgreSQL store; this PR does not touch it.
  • Rule-less alert (tests/pipeline.rs, runner driven pass by pass, each pass proven to have finished the load):
    • a load of filtered rows only raises nothing;
    • a mixed load raises one alert, counting its failing rows, with a first line past an earlier filtered row;
    • a Retry that comes back the same raises no second;
    • a filtered row reprocessed into a failure raises one more, with as many rejected rows as before.
  • rejected_share (tests/alerts.rs):
    • a load of filtered rows only, and one with nine filtered rows and one sent, fire nothing;
    • nine filtered rows and one failing fire, at 100% of the rows kept;
    • a load that kept nothing leaves the alert open;
    • a clean load clears it, named in the reason.
  • The load detail (tests/alerts.rs): failed: false, failing: 0, and a filtered group.
  • Store (tests/events.rs, tests/loads.rs):
    • the count of failing rows only rises, and is reported beyond its most;
    • on PostgreSQL, a finish that waits for another instance's lock counts the rows as committed;
    • an earlier version's store gets the column at 0 and keeps rejected_reported, across two opens;
    • the zip container's load.finished carries failing: 0.
  • Share display (unit test in src/pipeline.rs).

Links

None.

GET /api/alerts takes since (alerts created at or after an RFC 3339
instant) and cursor (the previous page's next_cursor), keeping source,
open and limit. Pages are a keyset on the alert id, newest first, and
next_cursor is null exactly when nothing more matches. A malformed query
answers 400 invalid_query. Decision 39.
… query checked

limit=0 no longer reads the store; a row without an id is an error rather
than a silent end of the walk; /api/alert-rules checks limit and open as
before. The docs say a late or cleared alert is found by a new walk and
that a page after a cursor can be empty.
The cursor is a1.<id>, so a client cannot take an alert id for one and a
later form can be told apart. The docs state the limit=0 exception and
when an error names its field; tests cover an empty page after a cursor
and the rules list's type checks.
POST /api/sources/{id}/check-now now records a check and answers its
check_id; GET /api/checks/{id} answers pending, found (with the loads),
nothing_new or failed (with a fixed reason), with requested/finished
times. A check is answered by the first scan that starts after it, with
the source's loads since it was asked for. Decision 41.
Every change of an alert, fired and cleared, is now an event with a
random event_id, written with its exact body in the same transaction as
the alert (table alert_webhooks). A sender task per instance posts
waiting events oldest first, signs them with HMAC-SHA256 over the raw
body when alerts.webhook_secret (or HIE_ALERT_WEBHOOK_SECRET) is set,
and retries a failed attempt up to five times with exponential backoff
(alerts.webhook_backoff_ms, 10 s by default). Attempts are claimed with
one conditional update and their outcome is fenced by the attempt
number, so several instances on one store never send one attempt twice.
Redirects are not followed. An event belongs to the URL configured when
it was written and waits for it.

GET /api/alerts shows each alert's latest delivery (event, state,
attempts, last_error, last_status, delivered_at) and whether this
instance has a webhook configured and signed.

The webhook body changes: {event_id, event, alert, source, text}
replaces {text, feed, kind, alert_id, notify, cleared}. A clear is now
posted only when the alert's rule asked for the webhook. alerts: refuses
unknown keys, and its errors never quote the URL or the secret.

Decision 40.
The baseline is taken in the check's own INSERT; a delete fails the
source's waiting checks first, in one statement guarded by the lease,
and answers store_busy rather than strand them; a pause lifted while a
pass reads the checks leaves them to the next pass. Index files by
(feed_id, id) for the baseline and range reads.
- hie check no longer echoes values from a malformed alerts: block:
  YAML errors pointing into it are reported without the parser's words,
  and an unknown key is named only when it looks like a key.
- A blank webhook secret is refused on the library path too.
- A failed COMMIT of an alert and its event is rolled back.
- Tests: the PostgreSQL schema outlives the engines a test drops; the
  fence is tested while the newer attempt runs; timeout category; the
  API's pending and parked states; no URL, secret or fingerprint in the
  API answer; two more hie check canaries.
- Docs: ordering holds per URL; last_error, last_status, pending and
  failed spelled out; backoff bounds.
A runner stopped while it read the waiting checks drops them, so a
check asked for after a replace is answered with the new definition.
Docs: when a pass reads its checks, and the delete and index costs.
Tests wait for the live check's answer and release the delete case's
lease instead of letting it lapse.
An append-only events table, written in the same transaction as the change
it reports, through one insert path (on PostgreSQL under an advisory lock
keyed by schema, so ids commit in order). Every outcome is a guarded update
on the status it leaves and the record's revision, bumped when a person puts
a record back, so an outcome for a superseded revision changes nothing.
Admission, finishing a load, Retry and reprocess, REST batch outcomes, bulk
opening, settling and refusal each run in one transaction with their events.

GET /api/events lists the log oldest first by id, with source, kind, since,
cursor and limit; every unreadable parameter is a 400 invalid_query naming
its field.

retention.history (30d by default) purges events and stored alerts at start
and hourly; open alerts the engine tracks and the newest alert are kept, and
purged alerts still count in hie_alerts_total. safe_reason now keeps
brackets and parentheses inside a URL, and bulk texts replace the
submission token by value.
- hie.yaml parse errors leave out every quoted value while the file
  holds the webhook URL or secret: YAML can carry a value into an error
  from anywhere (quoted or explicit keys, aliases). The runtime check no
  longer reports a parse error of its own.
- HIE_ALERT_WEBHOOK_URL is refused under its own name.
- PostgreSQL schema set-up runs in one transaction under an advisory
  lock, so instances upgrading one store together all start.
- The webhook client speaks HTTP/1.1 only.
- A claimed attempt clears last_status until it is answered.
- Tests: concurrent claims on two connections, last_status while an
  attempt runs, five more hie check canaries.
- Docs: which clears are posted (the channels recorded when the alert
  fired; rules turned off or deleted leave their alert open).
- A hie.yaml that is not valid YAML is refused again (a repeated
  runtime: key no longer slips past the check), with quoted values left
  out of the error.
- Quoted values are left out of a typed parse error when the decoded
  file gives alerts: any value, rather than when the text names a key:
  escaped keys are caught, and a blank template keeps full errors.
- PostgreSQL: added columns are altered one at a time and only when
  missing, outside the locked schema transaction, so start-up cannot
  deadlock with a query joining those tables.
- The concurrent-claim test cannot hang when its set-up fails.
Failure reasons name a request target only by its origin, or <URL> for a
relative one, and cleanup errors replace the submission token by value.
Settling locks the open submission first, as a refusal does. A source-object
submission opens only if each file claims exactly what its manifest counted,
and REST outcomes are also guarded by the attempt count selected. Admission
takes a per-source lock on PostgreSQL and looks the content up again. The
alert purge checks its predicate again on the row it deletes. Large set
writes keep only ids and write their events a chunk at a time. A transform
that cannot finish now is logged once per record and reason per runner.
GET /api/events refuses unknown parameters and signed limits.
… probe

GET /api/monitoring/status gains destination: {reachable, since,
last_error, consecutive_failures, observed_at}, from every request a
delivery sends under the base URL and from an anonymous GET /metadata
once nothing has reached the server for destination.probe_seconds (60 by
default, 0 off). last_error is one of a few fixed sentences, never a URL.

Recovery now clears every open delivery alert of the source, with a rule
or without, instead of raising a delivery_recovered alert next to an
outage alert that never cleared; start-up closes the ones earlier
versions left open. REST delivery errors name the FHIR server instead of
its URL.

Closes HeliosSoftware#24
… cannot be reached

A request's start instant is taken while the destination's lock is held,
so a probe always gives way to a delivery that registered after it. Each
change of state logs the failure with its whole error chain, and REST
transient reasons carry that chain too. Every server-error status gets
its own sentence. Start-up also closes an old rule-less outage alert when
a record of its source was delivered after it. Tests cover a connection
closed before the answer, the status request and a status page on the
server's own origin, and the webhook around a recovery.
Set updates page by id and check their guard again on each row, so a record
changed meanwhile is left alone and each chunk is a seek, on two new indexes
made after the added columns. A relative target echoed with a query keeps
its path only. A transform-phase failure is remembered as logged only once
its event is stored. A since finer than a millisecond starts at the next
one. A zip entry found taken after it was staged does not reuse its name.
`GET /api/sources/{id}/stats` takes `tz` and counts its days from local
midnight to the next, echoing the zone it used (`UTC` without one). A
`missing_by` rule takes an optional `tz` for its time of day and its
"today"; rules without one stay in UTC.

A local time skipped by a DST change stands for the change itself, a
repeated one for its first occurrence, and 23- and 25-hour days keep
their length. Zone rules come from the IANA database built into the
engine (jiff-tzdb), never the host's. An unknown zone answers 400 with
a fixed sentence (`invalid_query`, `field: tz`, on the stats query).

"Received today" for a rule and the `today` figures are bounded on both
sides, and a deadline pushed onto the next midnight by a DST gap is
checked as that day begins. Amends decision 22; adds decision 44.

Closes HeliosSoftware#25
…nd logs

A REST delivery that cannot reach the server stores the destination's
fixed sentence as its reason; the log gets the errors under the request
error, never the request error's own text, which carries the URL. A
request is built before it counts as one sent to the server, so one that
cannot be built does not hold back the probe. Start-up compares an old
outage alert with the source's newest record only, found through the
index. Tests keep their seeding store open, so they also run on
PostgreSQL, and check the webhook's alert ids and the probe's query.
GET /api/loads lists the loads of every source, newest first, with the
fields of the per-source list, narrowed by source and by status or to the
loads failing now (unreadable, or with a rejected row, also while in
progress). A page of up to 200 loads, its counts and whether more follow
come from one statement, behind an opaque cursor on the load id.

Every load answer gains failed and source_name, the name the source had
when the load was recorded, so a deleted source's loads stay identifiable.
New indexes let each page be chosen through an index, with one seek per
failed load on a partial index of rejected rows.
…y, once

A file of the next day no longer hides that the day before's never came, and an alert of the rule open at that deadline covers it. A date a zone skipped misses no deadline. An unknown tz is refused before the source is looked up. Tests tie the echoed zone to the dates the route returns; the docs give day lengths as the clock's.
An optional one-line contact (at most 500 characters, text only, never
interpreted) on a source definition, from its file or the API. Returned by
every source read, each source and needs_you entry of the monitoring status,
and printed by hie check. PUT stays a whole replace: a body without it clears
it, and sending back the definition read keeps it. Decision 45.
A source name with a NUL, which a PostgreSQL text value cannot hold, is no
longer kept with its loads instead of failing every load of that source;
a source query with a control character is refused as invalid_query.
The docs now say what a source created again under a deleted id takes
over exactly (pending rows keep the earlier transform's resources, the
silence rule counts from the earlier loads, read-only sources skip by
name and size, zip entries), which empty parameters count as absent, and
what a failed scan raises. Tests walk failed pages one load at a time
across unreadable loads and loads with many rejected rows.
A new source on a deleted source's id sends waiting rows as they are by
REST or transformed bulk, but hands over the load's file on the
source-object path. The docs also list every alert a failed scan may be
followed by, qualify the read-only skip by name and size to non-empty
files, and require a UTF8 PostgreSQL store.
… send before clearing

The deadline pushed onto midnight is computed apart from today's, so a pass after today's deadline still checks the day before; an alert raised for it is cleared on the next pass, never in the one that sent it. Stats echo today's day beside the zone. Wording: a change of offset, such as daylight saving time; day lengths as on the clock.
safe_reason cuts any word with a ? followed later by = (a query), and
leaves questions alone. A submission's progress and failure writes hold only
at the attempt count read before the request, and the outage alert follows
only a write that changed it. Each file is finished in its own transaction
and its alerts weighed right after. An open alert is kept by an enabled rule
only if the rule is older than it. A since is rounded up from the digits of
its text. PostgreSQL builds the schema under a session lock, and SQLite gets
no index that its rowid already gives.
A row its transform turns into no resources is rejected as filtered and
still counts in rejected, but a load whose only rejected rows are
filtered is not failed: failed now means unreadable, or a row rejected
for any other reason. The partial indexes hold only those failing rows.
delivery.stamp_source in hie.yaml (off by default) adds meta.tag
urn:helios:hie:source|<source id> to every resource sent by REST and to
the NDJSON of transformed $bulk-submit submissions, as it leaves: the
stored record and Try are unchanged, the resource's other tags and the
rest of meta are kept, a tag of that system is replaced, and a record
whose meta cannot carry the tag is rejected. Direct $bulk-submit from
source objects is not tagged; the server fetches those untouched.

Every source read gains `stamping`: whether this instance's deliveries
carry the tag, and what the store knows of deliveries without it (none,
until a date, or open). The REST bound is stored before each untagged
request leaves; untagged submissions are read from their rows. A store
from an earlier version is bounded once at its first start.

A tagged submission gets an id of its own, so the server never settles
a tagged re-delivery with an earlier submission's receipts, and is
served only the files the engine wrote for it.

Decision 46.
GET /api/sources/{id}/failures counts the distinct records a source
rejected over the last 24 hours and each of the last days (UTC, from one
day_windows function), filtered rows apart, with each window's coverage:
from when this store began recording events (store_meta.events_since, set
once) and within the retention. An index on events(source_id, kind, at)
serves it.

A SQLite alert_rules made before is rebuilt once with AUTOINCREMENT, with the
same rows and ids and its sequence past every rule id in use, so no rule id
is given again; every rule answer carries created_at, never taken from a
request body.
…ssed runners

- A failed untagged submission the server may have taken keeps its source
  open however old it is: the server's import can outlive the engine.
- The REST bound includes a slack for its own store write, and a write
  slower than that sends nothing; a failing write fails the pass rather
  than reading as an outage of the FHIR server.
- A submission takes its records all or none while they are still pending
  and free, so two runners crossing in a lease handover never submit the
  same page twice.
- With stamping off, resources are borrowed, not copied.
- Tests: the file endpoint's guard against a real fallback file, a slow
  token endpoint, a kick-off refused after one went unanswered, the raw
  bytes of a direct submission, the all-or-none claim.
failing counts the rejected rows that make a load fail, every rejected
row but the filtered ones, beside rejected, so a list's failure count
agrees with failed: a load whose only rejections are filtered shows
failing 0.
…ne opener at a time

- A failed untagged submission is a bound only when the server refused its
  first kick-off (recorded as `kickoff_refused`); any other failure may
  have left the server importing and keeps its source open. Submissions
  last touched before the store began recording are inside the upgrade's
  bound, so taking the mark again (delete it and restart) is the remedy
  for a source left open once the server is known to be idle.
- The schema is brought up to date by one opener at a time: an immediate
  transaction on SQLite, an advisory lock on PostgreSQL, so two instances
  starting on an older store do not both add the same table or column.
- A store write slower than its slack before an untagged REST request is
  taken again from a fresh instant instead of failing the pass.
- Tests: the bound is in the store when the request arrives; a store
  shaped as the previous version leaves it, upgraded by two openers at
  once; the reset remedy.
…t/alert-webhook-delivery

# Conflicts:
#	docs/api.md
#	docs/decisions.md
#	docs/development.md
#	src/api.rs
#	src/config.rs
#	src/db.rs
#	src/lib.rs
#	tests/alerts.rs
Checks join the retention purge (retention.history) with events and
alerts, and GET /api/checks/{id} reads its parameters as /api/events
does: an opaque cursor, and 400 invalid_query naming the field.
…se nothing

Rows a transform filters out on purpose are rejected as filtered and are not failures. Stats (per local day and today) and the monitoring status (last_24h and each source's failing_last_24h) gain failing beside rejected, which keeps its meaning, and needs_you lists a source for its failing rows only, with the same sentence.
…ate pause

purge_checks locks the rows it chooses, so on PostgreSQL a purge that
waited for another moves on to the next old checks instead of stopping
with some left. A pause that lands while a pass loads its credential
fails the checks it read and ends the pass. Docs name /api/checks among
the invalid_query routes and the duplicates a read-only source skips.
Loads record the source's name through the store calls that now take
files in (admit_file, insert_duplicate, insert_container), the paging
module is the landed one, /api/loads joins the routes that answer
invalid_query, and decision 42 follows 38 to 41.
The four indexes the loads list reads are built each in a transaction of
its own after the schema, so a long build over records never holds files
while another instance's Retry waits on both. The docs add the events,
failure figures and pending checks a reused id takes over, count the
four indexes in the upgrade note, and say how /api/loads refuses a
query. The test of a name a store cannot hold covers every way a file
is taken in.
A start or a replace used to add the default silence rule to any source
without one, so a whole-definition PUT (a contact or transform save) or a
restart brought back a rule someone had deleted. The store now records each
source's birth: a source the store has never seen gets the rule at the start
that finds it, a POST is always a creation (one silence rule at most), and a
replace, a restart or a file put back adds none. Sources an earlier version
left in the store are marked born without a rule. Decision 45, amending 22.
A failed write no longer deletes the rule its create was born with: another
create may already count on it, and a rule id can be reused on SQLite. A
store too busy to record a birth answers store_busy with nothing published.
The birth runs read committed on PostgreSQL, checks the rule's own condition
and shares the rule insert. The race test now holds one handle inside its
transaction while the other waits, in each forced/not-forced order, and a
failed birth is shown to publish nothing and keep no registration.
Conflicts resolved: the alert clear keeps the webhook's `cleared` event
and clears by id, so recovery clears every open delivery alert of a
source through it; the bulk submitter keeps the origin-only base in its
reasons; the store keeps both sides' functions; the outage test checks
the cleared alert and the event log together; the docs keep both
sections. The destination tests follow the store's new signatures and
the webhook's new body.
A start ran the schema's indexes, and the two added with the event log,
each batch in one transaction. CREATE INDEX IF NOT EXISTS takes a SHARE
lock on its table even when the index exists, so a start that waited
for a running instance's write to one table held the others meanwhile,
and could deadlock with that write during a rolling start. The tables
and their added columns now come first, then every index on its own, as
the loads indexes already were. A PostgreSQL test holds each indexed
table in an open write, starts a second handle, then takes every other
table: it deadlocked before and passes now.
Turning a rule off, deleting it, or changing its condition, threshold
or source clears the rule's open alerts when the API makes the change,
through the same clear as every other, so each writes its cleared event
for the channels recorded when it fired. A changed rule that still
finds the condition raises a new alert with its own id. A change of
recipients or channels alone clears nothing. Each source's pass also
clears an open alert whose rule is gone, off, or watches another
condition or source, which catches one raised by a pass that read the
rule just before the change.
Review round 3. A rule turned off, deleted or changed through the API
clears its open alerts in the transaction that changes it, so a failed
clear cannot leave them behind a committed change, and an alert raised
under the changed rule is not cleared by it. An alert of a rule is
written only while the rule is on and has the condition, threshold and
source the pass read; on PostgreSQL the rule's row stays locked to the
alert's commit. The per-pass sweep goes: a start clears what earlier
versions left, a rule whose id was given again included.

The reconciliation of delivery alerts left by earlier versions runs
once per store, so a rolling start cannot close an outage alert this
version raised without its cleared event, and it counts any record of
the source delivered after the alert. Retention keeps an open outage
alert without a rule. The PostgreSQL start test checks which lock the
start waits for. Docs say when a changed rule raises again, what a
start still locks, and that bulk reasons keep the server's origin.
Brings the event log, the alert webhook, loads across sources and the
destination's reachability under the time zone work:

- /api/sources/{id}/failures takes tz: its days are local days of the
  zone, each named, and the answer echoes the zone. An unknown zone is
  refused as on /stats, before the source is looked up.
- A change of a rule's tz ends its open alert, and an alert is written
  only while the rule still has the zone the pass read.
- tz is in the rules table's schema, so the SQLite rebuild that stops
  rule ids being reused keeps it.
…failing with rejected

- An alert that a change, turning off or deletion of its rule ended no
  longer stands for the day it was raised for: the rule as changed judges
  that day itself. A rule made after a pushed deadline does not judge the
  day before it.
- The monitoring status counts rejected and failing rows in one statement,
  so failing never exceeds rejected.
- The failures test keeps clear of a midnight; the failures example and
  decisions 43 and 44 say what the code does.
…contact

# Conflicts:
#	docs/api.md
#	docs/decisions.md
#	docs/development.md
#	docs/running.md
#	src/db.rs
…; refuse direction marks in a contact

The upgrade now treats a source with only a check, an event or a count of
purged alerts as one that existed, so a deleted default rule is not given
back. A contact also refuses U+061C, U+200E and U+200F. The docs list
503 store_busy on POST, say how a re-created source's open silence alert
is judged, and drop a start-order step the schema lock makes unneeded.
…rce-stamping

# Conflicts:
#	docs/api.md
#	docs/decisions.md
#	docs/running.md
#	src/config.rs
#	src/db.rs
#	src/fhir.rs
#	src/manager.rs
#	src/pipeline.rs
… failed one open

A refused kick-off is no proof the server never took the submission: it can
answer the repeat of a kick-off the server accepted, or cross another
instance's kick-off during a lease handover. A failed untagged submission now
keeps its source open until the mark is taken again by hand, and the
kickoff_refused column goes. A submission still to send or running stays open
whichever version wrote it, so one an older version left behind is not hidden
by the upgrade's mark; with the mark deleted, every failure counts until the
next start takes it again.

Docs: what turning the setting on and off changes, the slow-write retry, and
how an unpolled submission is closed.
… filtered out

A load whose only rejected rows were filtered out on purpose still raised a
rejected_records alert, so a client showed failed rows for a source with
none failing. The alert now follows the failing rows: it is raised when a
load finishes with more of them than any earlier finish saw
(files.failing_reported, raised in the statement that moves the load to
done), counts only them, and quotes the first failing row.

A rejected_share rule weighs the failing rows among the rows a load kept;
a load that kept none neither fires nor clears it. load.finished gains
failing.

Docs: decision 47, the rules table and the rule-less alert in sources.md,
load.finished and the load's failure groups in api.md.
…pgrade repeat once

A load alert now says the filtered rows were others, so they do not read as
more failures. The share test runs a load that kept nothing before any alert.
Decision 47 and sources.md say a load from an earlier version is reported
once more, at its first finish with failing rows, not each time its count
rises.
… can repeat at each new high

A rejected_share alert showed 1 in 81 as 1.2% against a 1.23% limit; the
share now takes as many decimals as it needs to read above the limit. The
docs now say a load from an earlier version is reported again at each
finish with more failing rows than this version has seen of it.
@Gordex2014
Gordex2014 marked this pull request as ready for review November 23, 2026 20:18
@angela-helios
angela-helios merged commit 41f03dd into HeliosSoftware:main Nov 24, 2026
2 checks passed
smunini added a commit that referenced this pull request Nov 24, 2026
fix: follow-ups from the review of #28 to #37 (#38)
@Gordex2014
Gordex2014 deleted the fix/filtered-rows-raise-no-alert branch November 25, 2026 14:20
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