# Changelog of FDA Import Alerts Scraper & Red List Monitor (`araluma/fda-import-alerts-scraper`) Actor

- **URL**: https://apify.com/araluma/fda-import-alerts-scraper/changelog.md
- **Full Actor documentation**: https://apify.com/araluma/fda-import-alerts-scraper.md

## Changelog

All notable changes to the **FDA Import Alerts Scraper & Red List Monitor** Actor are documented here.
This project follows [Semantic Versioning](https://semver.org/): `MAJOR.MINOR.PATCH`.

- **MAJOR** — breaking changes to input or output.
- **MINOR** — new features, backward-compatible.
- **PATCH** — bug fixes and docs, backward-compatible.

### [1.1.0] - 2026-11-23

Delta runs got much cheaper and safer, and several bugs that could cost users money were fixed. Output field names are unchanged; new fields were only added.

#### Changed

- Delta mode fetches only the alerts whose publish date in the FDA index changed since the previous run, and re-checks all of them every 7 days (`fullRecheckDays`). A daily run over all 154 alerts used to take about 80 minutes; now it usually fetches two or three pages.
- Each set of filters keeps its own baseline. Before, two tasks with different alerts or countries overwrote each other's baseline, so neither ever reported changes.
- If some alert pages fail, delta now still reports the changes on the pages that loaded; the failed alerts keep their baseline and are retried next run. Before, one failed page out of 154 threw away the whole run.
- A delta run where every page failed, or where the baseline would shrink by more than 25%, now ends as failed instead of succeeded with an empty dataset.
- Nothing is charged until the input is valid, robots.txt allows the crawl, the index loaded and at least one requested alert exists.
- Every request to the FDA, including the first one after robots.txt and every retry, now starts at least 30 seconds after the previous one, as the FDA robots.txt asks. Retries used to follow after 2 to 16 seconds.
- Discover rows also carry `alertName`, `alertUrl` and `alertPageId` so the default table view shows them. The old `name`, `url` and `pageId` fields remain.
- Memory now depends on the mode: 256 MB for discover, 1 GB for full and for delta on chosen alerts, 2 GB for delta on all alerts.
- The baseline is stored gzip-compressed (about 20 times smaller). A 1.0 baseline is picked up automatically when the filters match.
- Node.js 24 base image, Apify SDK 3.8.0.

#### Fixed

- A run restarted by a platform migration charged the run start again and, in full mode, wrote and charged the already finished alerts a second time.
- Full mode kept scraping after the maximum charge per run was reached; it now stops.
- An alert that failed on the first delta run was reported later as hundreds of "added" rows.
- An alert removed from the FDA index was never reported; its rows are now reported as removed (all-alert scopes only).
- An alert page that suddenly parsed to zero rows could be reported as every firm removed; it is now treated as a failed fetch.
- Unknown alert numbers, an empty list selection, a negative `maxAlerts` or an unknown mode used to run (and charge) anyway; they now stop with a clear message.
- The code defaulted to delta mode while the input schema defaults to discover; both now use discover.
- Two runs with the same filters could report and charge the same changes twice; the second run now stops before charging.
- Slack messages broke on firm names containing &, < or >.

#### Added

- `fullRecheckDays` input, a `changes` and an `alerts` dataset view, a `RUN_SUMMARY` output link, and a warning that lists the countries found when a country filter matches nothing.
- Tests for the parser against saved FDA pages, the delta engine and full end-to-end runs (`npm test`).

### [1.0.0] - 2026-06-29

Initial public release. Hardened and feature-completed during live
post-publish testing before any real usage (kept on version 1.0 so each build
inherits the `latest` tag automatically; a deliberate version bump will come
with the first change that could affect existing users).

#### Added (post-publish, same release)

- **Change notifications (DELTA):** optional `notifyWebhookUrl` and
  `notifySlackWebhookUrl` inputs. When a run finds changes, the Actor POSTs a
  summary to your webhook and/or Slack — turning the feed into a hands-off
  monitoring service. Best-effort: a notification failure never affects the run.
- **Severity on change rows:** `high` (added to Red List), `medium`
  (removed/changed on Red List), `low` (other lists) — so consumers can triage.
- **Streaming FULL mode:** in `full` mode each alert's rows are written to the
  dataset as they are scraped instead of buffering the entire dataset in memory,
  making full 154-alert runs safe against out-of-memory.

#### Features

- **Three run modes:**
  - `discover` — list every active FDA import alert (number, type, name, publish date, URL).
  - `full` — scrape every firm/product on the selected alerts.
  - `delta` — emit only firms **added / removed / changed** since the previous run.
- **One record per product** — firms with multiple products yield one row each, with per-product `desc` and `notes`.
- **Change-delta engine** — collision-safe identity (handles the FDA listing the same firm/product code multiple times), order-independent diffing, and a substantive-only content hash so address/date reformatting is not reported as a change.
- **Filters** — by `countryFilter` and/or specific `alertNumbers`; choose `listTypes` (red/green/yellow).
- **Structured output** — firm name, address, country, FDA product code, product description, publish date, list type, notes, redaction flag, and source URL.

#### Reliability & compliance

- Honors the FDA `robots.txt` (Disallow rules + a 30-second hit-rate floor).
- Detects the FDA HTTP-200 "apology" throttle page and treats it as a transient failure (never as an empty alert).
- **Delta safety gates:** a run with any failed/throttled alert, a changed input scope, or an implausibly shrunken snapshot is a safe no-op — it never emits false "removed" rows or corrupts the baseline.
- Parser-health checks and fail-safe behavior on FDA layout changes.
- Honors FDA-redacted fields (never reconstructed).
- **Cross-run delta state** is kept in a **named** key-value store
  (`fda-import-alert-state`), which persists between runs — so scheduled delta
  monitoring works correctly (the per-run default store would reset every run).
- `actor-start` is charged once per run (corrected in 1.1.0: it was charged again after a migration).

#### Notes

- Pricing: pay-per-usage at launch; pay per event since 2026-11-23.
- Default run mode is `discover` (fast, always non-empty) so the daily Store auto-test passes reliably.

[1.1.0]: https://apify.com/araluma/fda-import-alerts-scraper

[1.0.0]: https://apify.com/araluma/fda-import-alerts-scraper
