# Changelog of Contractor License Roster and Status Feed: 8 US States (`overlookdata/multistate-contractor-roster`) Actor

- **URL**: https://apify.com/overlookdata/multistate-contractor-roster/changelog.md
- **Full Actor documentation**: https://apify.com/overlookdata/multistate-contractor-roster.md

## Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### \[0.6.0] - 2026-11-12

#### Fixed

- A `changes` run with a low maximum charge delivered every change event
  for the dataset item price alone: the `change-event` and
  `state-change-check` charges that did not fit were skipped, and the
  snapshot still advanced (measured on Apify, WA, maximum charge $0.10: 177
  events for $0.0885). Each `changes` state is now all or nothing. Its events
  are counted first and the whole cost (a dataset item and a `change-event`
  per event, plus one `state-change-check`) is compared with what is left of
  the run's maximum charge. A state that does not fit fails with a message
  giving the events, the cost and the amount left; nothing is stored or
  charged for it and its snapshot stands, so the same events come on the next
  run. A baseline and an unchanged source need the state check alone.

#### Changed

- Change events wait in a temporary file while they are counted, then go to
  the dataset in batches of 500 as before.
- A custom charge the platform cut short is logged as a warning.

### \[0.5.1] - 2026-11-11

#### Changed

- README: run times and memory measured on Apify with California read from
  the workbook (a whole-state California `status` run, and a `changes` run
  over all eight states).

### \[0.5.0] - 2026-11-11

#### Changed

- California is now read from the CSLB's Excel workbook, which is rebuilt
  nightly, instead of its CSV. The workbook is smaller (56 MB against 78 MB),
  so it is much more likely to arrive before the server's 150 second cut: a
  whole-state California run took about one minute on 2026-11-11, a day on
  which twenty CSV attempts in a row were cut short. A cut download is still
  retried up to eight times, three minutes apart.

#### Fixed

- California no longer reads the CSLB's CSV, which is an older cut of the
  data than the workbook (244,571 licenses against 245,059 on 2026-11-11).
- California is now read on every run. The "Updated as of" date on the CSLB
  page is not the workbook's and can stand still for days, so a `changes` run
  could skip California as unchanged while licenses in the file had changed.
  `source_as_of` for California is now the time of the read.

### \[0.4.0] - 2026-11-11

#### Changed

- US spelling throughout, to match the field names (`license_number`,
  `license_status`) and the source agencies. In the output, `record_type` is
  now `license` (it was `licence`) and the event types `licence_added` and
  `licence_removed` are now `license_added` and `license_removed`. The title,
  descriptions, README, log lines and messages follow. Stored snapshots are
  not affected.

### \[0.3.0] - 2026-11-11

#### Added

- Two pay-per-event charges for change monitoring, so that it can be priced
  apart from roster rows: `change-event` for each change event and
  `state-change-check` for each state a `changes` run completed. Each costs
  nothing unless the actor's pricing defines it. Rows and events are still
  charged as dataset items by the platform.

#### Fixed

- A run that reaches the user's maximum charge no longer loses output without
  saying so. The SDK cuts a batch short at the limit without an error; the
  actor now fails that state with a message naming the limit, and in `changes`
  mode keeps the stored snapshot so the next run emits the same events again.
  Before, the snapshot could advance past events that were never stored.

### \[0.2.0] - 2026-11-11

#### Changed

- California's download is now retried up to eight times, three minutes apart
  (it was four times, 20 seconds apart). The CSLB cuts the download at 150
  seconds and does not honor range requests, so the only remedy for a slow
  spell is to try again later. On 2026-11-11 twelve attempts in a row were cut
  short under the old policy.
- A run in which some states fail and at least one succeeds now ends as
  succeeded, with a status message and a log warning naming the failed states.
  It used to end as failed although the other states' rows were complete. A
  run in which a state failed and none succeeded still ends as failed. If you
  load the output automatically, read `failed_states` in `VERIFICATION` and
  drop the output of those states: a state that failed part way may have left
  rows or events in the dataset. The README names the one case in which to
  keep them.

#### Added

- `failed_states` in the `VERIFICATION` record: the list of states that failed.
- Run times measured on Apify in the README, and the advice to use a two hour
  timeout for runs that include California.

### \[0.1.1] - 2026-11-10

#### Fixed

- Snapshot records are now really deleted from the key-value store. Release
  0.1.0 cleared a record by setting its value to nothing, which on the Apify
  platform left the record in place as a 4 byte value, so the pending record
  and replaced snapshot chunks stayed listed in the store. The actor now calls
  the SDK's `delete_value`.

### \[0.1.0] - 2026-11-10

#### Added

- First release. One row per contractor or trade license from eight state
  rosters: Washington L\&I (General, Bond and Insurance datasets on
  data.wa.gov), the Oregon CCB and New York DOL Contractor Registry (Socrata),
  the California CSLB License Master file, the four Minnesota DLI exports, the
  Maine ALMS electrician and plumber pulls, the New Jersey home improvement
  contractor bulk download and the Virginia DPOR regulant lists. Plain HTTP,
  no browser.
- Three modes: `roster` (active licenses), `status` (every published license
  with a normalized status: active, expired, suspended, revoked, inactive,
  cancelled, closed or unknown) and `changes` (events since the previous
  whole-state run: license added, removed or reinstated, status, expiry, bond,
  liability insurance and workers' comp changes, each with an
  `event_date_basis` of `source_field` or `snapshot_diff`).
- Snapshots in the named key-value store `contractor-roster-snapshots`: gzip
  JSON-lines chunks of 20,000 compact records and a manifest written last with
  a SHA-1 per chunk and the removed licenses (tombstones). A `changes` run
  checks each source's refresh signal first and skips an unchanged source.
- Each snapshot write uses chunk keys of its own
  (`SNAPSHOT_<STATE>_<YYYYMMDDTHHMMSS>_<0000>`), so a run that dies while
  writing leaves the previous snapshot readable; the manifest is the only
  switch, and the replaced chunks are deleted afterwards (best effort). A
  `SNAPSHOT_<STATE>_PENDING` record names a write's chunks and the replaced
  snapshot's chunks, and is cleared only once the replaced chunks are deleted,
  so the next write deletes the chunks of a write that died part way and the
  replaced chunks a dead run or a refused delete left. It never deletes a
  chunk the stored manifest lists. A pending record naming more than 1,000
  chunks per snapshot, or anything but that state's chunk keys, is logged and
  not acted on.
- In `changes` the new chunks are written first, then the events are pushed in
  batches of 500, then the manifest. A chunk write failure pushes no events. A
  push that fails part way writes no manifest and deletes the new chunks, but
  the batches already pushed stay in the dataset and come again on the next
  run; the failure message gives how many as a minimum, since the batch that
  failed may also have been stored. A manifest write failure after a complete
  push repeats all of that run's events on the next run, unless the store
  kept the manifest despite the error. A run that is aborted, timed out, out
  of memory or restarted at either point repeats events the same way. A failed
  cleanup of abandoned chunks keeps the pending record. A repeat has the same
  `record_key`, `event_type`, `field` and `previous_snapshot_as_of`.
- A stored snapshot that cannot be read fails the `changes` state instead of
  silently starting a new baseline. A failed snapshot write fails the state.
- Shrink guard: a whole-state `changes` pull with fewer than 98 percent of
  the stored snapshot's licenses fails the state with no events and the
  snapshot untouched. In `status` the same check only logs a warning and adds
  a note to `VERIFICATION`. A whole-state pull with no licenses fails in every
  mode.
- `acceptShrinkStates` input (CLI `--accept-shrink-states`): a one-run
  override for a real drop of more than 2 percent. The removals are emitted,
  tombstoned and the snapshot replaced; an empty pull still fails.
- `status` stores a snapshot only as a first baseline; only `changes` replaces
  a stored snapshot.
- Snapshots leave out licenses on the takedown list, and a stored license that
  is later taken down gets no event and no tombstone. A name takedown also
  clears an existing tombstone when the license is back in the pull under that
  name; tombstones hold no names. Snapshots store whether
  a phone and an email exist, not the values; the dataset rows keep both.
- Filters on license type, level, holder type, county, city, ZIP prefix, name,
  phone and email; a watch list for `status` and `changes`; `maxItems`; a
  takedown list. WA, OR and NY filters run server-side.
- Reconciliation of every whole-state run and a `VERIFICATION` record per
  state: WA, OR and NY against the open data API's `count(*)` (WA's Bond and
  Insurance datasets too), Maine against each search's "N records found", and
  California, Minnesota, New Jersey and Virginia against a complete,
  well-formed download plus the shrink guard.
- Socrata datasets paged by row id (`$order=:id`, `:id > '<last id>'`) rather
  than `$offset`, so a mid-day update cannot push a row out of the pull. A
  page that repeats the cursor or the previous page's first row fails the
  state instead of looping.
- A failed push to the dataset fails that state only; the other states run and
  `VERIFICATION` is still written.
- Rows with a blank license number are counted as malformed and skipped.
- Minimum memory 1024 MB.
- CSLB download truncation (the server cuts the stream at 150 seconds) detected
  and retried up to four times; California fails loudly if no attempt
  completes.
- Application rows dropped from every mode; Oregon keyed per license type,
  Virginia on the ten-digit DPOR number, New Jersey reinstatement rows folded.
  Minnesota exports read as CP437.
- Local CLI (`python -m src.cli`) with `--snapshot-dir`.
