# Part and lot genealogy

> What eaxScada records about parts and lots (units, lots, links, operations, results), how the tamper-evident chain and its anchors in the audit trail work, why the PLC acknowledgement waits for the disk, editions, permissions and personal data, remote access, high availability and the limits.

Product: eaxScada · Type: Explanation · Editions: Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/explanation/genealogy/
Verified against commit 9d50b4d.

Part and lot genealogy answers two questions a plant is asked after a complaint or a supplier alert: **what went into this part**, and **where did this lot go**. eaxScada records each part and each lot, what was built from what, and every operation with its result, in its own embedded database. It works with any PLC and any driver: a PLC asks for a record by setting a tag, eaxScada reads the data, stores it, and answers the PLC.

Genealogy is in **Pro** and **Enterprise** (and the Free evaluation), never in Starter. High availability of the genealogy is Enterprise.

## What is recorded

| Item | What it is | Example |
|---|---|---|
| **Unit** | A part with a serial number (kind *Discrete*) or a lot (kind *Lot*), of a configured **unit type**. An ID can have several generations when the type allows an ID to be used again after the unit is retired. | Gearbox `GB-1004`; resin lot `RES-2611-01` |
| **Link** | A component consumed by a unit, with a quantity and unit of measure for lots. | `GB-1004` consumed `DM-0007`, `DM-0008` and 12 pcs of `SCR-2611-03` |
| **Operation** | Work done on a unit at a station and step: start, end, attempt number, operator, batch. | `Line1/ST40`, step `leak-test`, attempt 2 |
| **Result** | The outcome of an operation (PASS, FAIL, REWORK, SCRAP, INCOMPLETE) and the measured values taken with it, each with its quality and limits. | PASS; `press_force` 5.2 kN (4 to 6.5) |
| **Status** | The unit's state: CREATED, IN_PROCESS, FINISHED, SHIPPED, SCRAPPED, QUARANTINED, RETIRED (and CONSUMED once built into another unit). | `GB-1005` QUARANTINED |

Every change is a **record** appended to a ledger: UNIT_CREATED, UNIT_RECEIVED, LINK, OP_START, OP_END, OP_RECORD, STATUS, and the system records CAPTURE_GAP (recording was off for a time), CAPTURE_REFUSED (a PLC request was refused, with the reason), IMPORT and PURGED. Nothing is edited in place:

- a **correction** records the new values and keeps the original;
- a **void** marks a record made in error, and keeps it;
- both are signed: the signer is the signed-in user, who re-enters the password, with a reason. An optional second signature is typed by a second person on site.

Values come from tags. A measured value keeps its quality: a Bad or Uncertain value is marked in its row, never shown as good. An ID read from a tag must be Good: a unit is never recorded under an uncertain serial number.

Records come from three sources: the **PLC handshake** ([Capture genealogy from a PLC](/docs/eaxscada/how-to/capture-genealogy-from-a-plc/)), **manual records** in the Studio (New record, Record operation, Add components, Set status), and an **import** of units and links from JSON lines or CSV, checked first by a dry run and then signed.

## The tamper-evident chain

Each record carries a SHA-256 hash that covers every field of the record, and the hash of the record before it. Changing, removing or reordering a record breaks the chain at that point.

**Diagram: Two chains make the genealogy ledger tamper-evident** (system architecture)

The genealogy writer appends records; each carries a SHA-256 over its fields, its signature and the hash of the record before it, in one chain per writer run. The primary copies the tips of every chain into the audit trail, a separate file with its own chain. A purge leaves one tombstone per removed record. Verify recomputes everything and compares it with the tips and the anchors.

**Parts**

- **Genealogy writer** (service or process): single writer, one origin per run
- **Supervisor** (person or role): purges, with reason and e-signature
- **Records** (data store, inside Genealogy file): SHA-256 over fields, signature, prev hash
- **Chain tips** (data store, inside Genealogy file): last record of each run
- **Tombstones** (data store, inside Genealogy file): one per purged record, bound by PURGED
- **Chain anchors** (data store, inside Audit trail file): tips of every run, every 15 min or 10,000 records
- **Verify** (check or decision): recomputes every hash, links, tips, anchors, tombstones

**Connections**

- **Supervisor → Genealogy writer** (authentication): purge, with reason and e-signature. Only a person with the genealogy write right at Supervisor level, on site and on the primary, with a reason, an e-signature and a recovery key. The records are archived and verified and the audit record is written before one PURGED record removes them.
- **Genealogy writer → Records** (data or telemetry): appends. Each record links to the hash of the record before it in its run. The first record of a run links to the last record the file held.
- **Records → Chain tips** (data or telemetry): tip. The last record of each run is kept as its tip.
- **Records → Tombstones** (data or telemetry): purge. A PURGED record removes records and keeps one tombstone for each; the digest of the tombstones is in the PURGED record.
- **Records → Chain anchors** (data or telemetry): chain tips, by the primary. When new records were acknowledged and 15 minutes or 10,000 records have passed, the primary writes the tips of every run to the audit trail as GENEALOGY_CHAIN_ANCHOR. Without an audit trail there is no anchor.
- **Tombstones → Verify** (data or telemetry): reads the file. Verify reads every record, tip and tombstone of the genealogy file.
- **Chain anchors → Verify** (data or telemetry): reads the anchors. Verify reads the anchors of the audit trail and reports every tip the ledger no longer holds.

Editing, removing or inserting a record breaks a hash, a link, a tip or an anchor, and Verify reports it.

- The chain is kept per writer run (an *origin*): each start of the server begins a new run, whose first record points at the last record the database held. Removing a whole earlier run therefore also breaks the chain.
- **Verify** (`POST /api/genealogy/verify`, Administrator, on site; or the offline command `eaxscada genealogy verify`) recomputes every hash and link and reports the breaks, the tombstones and the purges.
- **Chain anchors.** When new records were acknowledged and 15 minutes or 10,000 records have passed since the last anchor, the primary writes a `GENEALOGY_CHAIN_ANCHOR` record to the [audit trail](/docs/platform/explanation/security-and-part-11/) with the tips of the chains (without an audit trail, as in the Free edition, no anchor is written). The audit trail is a second, independent chain. Someone who rewrote the genealogy would also have to rewrite the audit trail consistently; an outside party compares the anchors with the genealogy to check that it was not rewritten. When the anchors cannot be read from the audit trail (its older records no longer read), **Verify** does not check against fewer anchors: it answers `500` with `"status": "anchors_unreadable"` (`"ok": false`) and the run is recorded as `GENEALOGY_VERIFY` "not verified: anchors unreadable". Treat it as not verified, and run **Verify** in **Security > Operations audit** to find the damaged records.
- A **purge** after retention removes records only through one signed PURGED record that keeps a tombstone for each removed record, so the chain still verifies ([Retention, purge and archives](/docs/eaxscada/how-to/genealogy-retention-purge-and-archives/)).

Every genealogy action is in the audit trail. Records, corrections, voids, imports, configuration and settings changes, and purges are **recorded first**: if the audit record cannot be written, the action is refused (`503 AUDIT_NOT_WRITTEN`). Exports, verifications, storage events, archive downloads and replication events are recorded after.

## Durability: the PLC is answered after the disk

A PLC that moves a part on after its acknowledgement must be able to trust it. eaxScada therefore acknowledges a record only once it is **synced to disk** in the genealogy journal (`data/genealogy/genealogy-journal-*.gjl`). The database itself is updated in the background, in batches.

**Diagram: One capture request, from Req to Ack** (sequence)

The PLC writes the data, the sequence number n and the stamp n, then sets Req. eaxScada waits until the stamp equals the sequence number, reads the tags in one pass and checks them. A refused request is kept as a refusal record and answered with an error code; a record the store does not take (storage full, recording stopped, internal error) is answered the same way, with code 5, 6 or 7. An accepted request is stored on disk first; only then eaxScada writes Err = 0 and Ack = n. The PLC waits for Ack = n, reads Err and moves the part on only when Err is 0.

**Participants**

- **PLC** (device or controller): the station
- **eaxScada** (product): the trigger
- **Genealogy store** (data store)

**Steps, in order**

1. **PLC → eaxScada** (data or telemetry): Data, Seq = n, then Stamp = n. unit ID, result, values, component IDs; the stamp last
2. **PLC → eaxScada** (data or telemetry): Sets Req. TRUE (RISING) or counter + 1 (CHANGE)
3. **eaxScada**: Reads the tag set: waits until Stamp = Seq = n (3 s by default); reads every tag in one pass; takes an ID from a Good value only
4. The request is refused:
   1. **eaxScada → Genealogy store** (data or telemetry): Keeps a CAPTURE_REFUSED record. with the reason
   2. **eaxScada → PLC** (command to equipment): Writes Err = 1 to 7, then Ack = n. no record of the part
5. The request is accepted:
   1. **eaxScada → Genealogy store** (data or telemetry): Appends the record
   2. **Genealogy store → eaxScada** (reply): Stored on disk. the answer waits for this
   3. **eaxScada → PLC** (command to equipment): Writes Err = 0, then Ack = n. through the server's write path, retried until written
6. **PLC**: Waits for Ack = n: keeps Req set and Seq unchanged; reads Err, then resets Req; moves the part on only when Err = 0; own timeout: no Ack, the part stays
7. Note: Req reset or Seq changed before the Ack: the answer is dropped
8. eaxScada restarts before the Ack:
   1. **eaxScada**: Serves the held request again: Req still set, Seq = n, Ack behind; finds the record by its key
   2. **eaxScada → PLC** (command to equipment): Writes Err = 0, then Ack = n. no second record

The PLC is answered after the disk: Ack = n means the request was decided, and Err = 0 that the record is stored. Without an Ack the PLC does not treat the part as recorded.

- A power loss right after the acknowledgement loses nothing: at the next start the journal is applied to the database.
- The genealogy store folds its records into the database file every 5 minutes (before 18 November, every 10 seconds). Every acknowledged record is in the journal until then, and the journal is replayed at start, so nothing is lost if the server stops in between: a start after a power loss replays up to 5 minutes of records. Fewer checkpoints mean fewer moments in which a power loss can leave the database file unopenable. The journal's and the database's syncs are unchanged.
- A journal cut off in the middle of a write (power loss during the write) is set aside as a `.torn-<time>` file and recorded as a capture gap. Any other damage (a missing journal file, a changed record, a wrong encryption key, encryption switched on or off) stops genealogy from starting: nothing is repaired silently.
- A clean shutdown deletes the journal once everything is in the database.
- With encryption at rest on, the journal is encrypted too.
- Only one server process may open a genealogy folder (`genealogy.lock`).
- A read can wait up to 5 s for a record that is in the journal but not yet in the database; after that it answers that the store is behind (busy, retry).
- While 50,000 or more records wait to be applied, new records are refused and the PLC gets error 7.

**Storage floor.** Genealogy records are evidence and small, so genealogy keeps writing when the historian has started to purge for disk space. Below its own floor (2 GB, or half the historian's critical free space if that is more) every new record is refused, the PLC gets error 5 (storage full), the alarm *Genealogy storage floor reached* is raised and the event is recorded. A record is never dropped silently.

Measured on a test server: 4 million units at 200 records per second, acknowledgement p95 109 ms (slowest 499 ms); a burst of 1,000 records per second for 60 s with no loss. The server used about 1.9 GB more memory at that size. The Go heap limit is set by the server flag `--go-memory-limit` (default `auto`: 40% of physical memory, at least 2 GiB).

**Memory cap of the genealogy store.** The genealogy database takes at most 1 GiB, or `duckdb_memory_limit` in `data/genealogy/settings.json` (a size such as `2GB`) when it is set; the unit-state file at most 256 MiB. Without a threads setting the database runs one thread per 64 MiB of its cap (16 at 1 GiB), at most every core. Past its cap it spills to disk next to its file, encrypted with encryption at rest. [Memory caps of the stores](/docs/eaxscada/explanation/historian/#memory-caps-of-the-stores)

## Editions and licence changes

| Edition | Genealogy |
|---|---|
| Starter | Not included. |
| Pro | Included: capture, manual records, trace, recall, export, retention and purge. |
| Enterprise | Pro, plus replication to the standby of a high availability pair. |
| Free evaluation | Included, for evaluation. |

After a licence downgrade or expiry the genealogy becomes **read-only**: records stay readable, traceable and exportable, but new captures, records, corrections, voids, imports and configuration changes are refused. The PLC handshake answers error 6 (recording stopped), the alarm *Genealogy recording stopped* is raised, and the write buttons of the Genealogy workspace say which edition they need.

## Permissions and personal data

Three rights control genealogy. They are granted by role level by default, and can be changed per role with feature rules (target type *feature*, pattern `genealogy.read`, `genealogy.write`, `genealogy.read_personal` or `genealogy.*`). A DENY rule refuses the right whatever the level, the Administrator's included. A DENY matches the right itself, `genealogy.*`, the catch-all `*` (`feature:*`) or any prefix ending in `*` (`genealogy*`, `gene*`): the DENY `*` that shuts a person out of every feature shuts them out of genealogy too. The Administrator keeps security administration, so can always remove such a rule. An ALLOW rule (the right or `genealogy.*`, never a catch-all) grants it below its default level. The default rules hold no feature DENY. When the permission rules cannot be read, every genealogy right is refused to everyone, the Administrator included ("permissions could not be read; genealogy.read refused", and a WARN in the log); a store with no rules is not such a failure, and the defaults apply.

| Right | Allows | Default |
|---|---|---|
| `genealogy.read` | Search, unit pages, trace, recall, timeline, status | Every signed-in role |
| `genealogy.write` | Manual records | Process_Supervisor and above |
| `genealogy.read_personal` | Operator and signer names in clear | Shift_Operator and above, and Compliance_Auditor |

On top of these rights:

- corrections and voids need a supervisor and an e-signature; imports need an engineer and an e-signature; trigger and unit type configuration is an engineer's;
- a purge needs a supervisor, `genealogy.write` and an e-signature; purge archives and **Verify** are the Administrator's;
- an export of a trace, a recall or a time range needs a supervisor;
- API tokens cannot write records;
- in a signed request the signer is always the session user (`400 SIGNER_NOT_SESSION_USER` otherwise).

Users without `genealogy.read_personal` see **(name hidden)** instead of a person's name. Values of tags they may not read show **hidden (no read right)**.

**Pseudonymised operators.** With `pseudonymise_operators` on in `data/genealogy/settings.json`, operators are recorded as a stable reference, and their names are kept in a separate table, apart from the records. Signers keep their names: a signature must name the person who signed. A record made by the PLC handshake shows "operator unknown": eaxScada does not yet link a station to the person working there.

## Remote access

Through an eaxCloud remote session ([Allow remote access](/docs/eaxscada/how-to/allow-remote-access/)), genealogy follows the remote-access classes:

| Action | Class |
|---|---|
| Search, unit pages, trace, recall, status | View (V) |
| Records, corrections, voids | Operate (O); a second signer is refused remotely |
| Import, export, reading the triggers and the settings | Engineer (E) |
| Trigger and unit type changes | Engineer, applied live; refused when the site asks for a review of remote changes |
| Verify, purge, purge archives (list and download), settings changes | Never remote: on site only |

## High availability (Enterprise)

On a high availability pair, the primary sends the genealogy records to the standby after its own journal sync, several records per message, and the standby applies each one through its own single writer, with the same journal and chain checks. Only the primary captures and writes handshake tags.

**Diagram: Genealogy records on an HA pair** (failover scenario)

The primary eaxScada node writes each genealogy record to its own journal, sends it to the standby, and acknowledges the PLC. The standby applies each record with its own chain checks and confirms it. When the standby stops confirming, the acknowledgements fall back to the local journal and an alarm is raised; when the primary is lost, the standby takes over and records the gap it cannot account for.

**Parts**

- **PLC** (device or controller): genealogy handshake
- **eaxScada node A** (product, primary): writes the record, syncs its journal
- **eaxScada node B** (product, standby): applies with its own chain checks
- **Operators** (person or role): system alarms

**Connections**

- **PLC → eaxScada node A** (data or telemetry): record
- **eaxScada node A → PLC** (reply): acknowledged
- **eaxScada node A ↔ eaxScada node B** (replication): records
- **eaxScada node B ↔ eaxScada node A** (replication): confirms

**Step 1 of 4: Normal**

Node A writes each record and syncs its journal, then sends the records to node B. Node B applies each one with its own single writer and checks its hash and its link. With ack_durability left empty or set to replicated, the PLC is acknowledged once node B has confirmed.

**Step 2 of 4: Standby lost**

Node B does not confirm within 2 s, or sends no heartbeat for 10 s. The acknowledgements fall back to node A's journal: GENEALOGY_REPLICATION_LOST is recorded, ALM-SYS-GENEALOGY-REPLICATION (High) is raised, and the PLC is acknowledged. When node B is heard again, GENEALOGY_REPLICATION_RESTORED is recorded and the alarm clears.

- **eaxScada node B**: lost, down, not confirming
- **eaxScada node A ↔ eaxScada node B** (replication, not active): records
- **eaxScada node B ↔ eaxScada node A** (replication, not active): confirms
- **eaxScada node A → Operators** (alarm or event): standby lost
- **eaxScada node A**: acknowledges on its own journal

**Step 3 of 4: Primary lost**

Node A is lost and node B becomes primary. It first fetches what node A published last, then, when it holds records of another run, records a CAPTURE_GAP (source SYSTEM:ha-failover) from the last of them to now, and GENEALOGY_FAILOVER_GAP in the audit trail. A PLC whose acknowledgement node A still owed when it lost the role gets no answer from node A. A record of the older HA term that arrives later is kept and marked FENCED.

- **eaxScada node A**: lost, down, not reachable
- **eaxScada node B**: primary, records CAPTURE_GAP, then writes
- **PLC → eaxScada node B** (data or telemetry): record
- **eaxScada node B → PLC** (reply): acknowledged
- **eaxScada node A ↔ eaxScada node B** (replication, not active): records
- **eaxScada node B ↔ eaxScada node A** (replication, not active): confirms

**Step 4 of 4: Record refused**

A record node B already holds with another hash, one that does not link to the previous record of its run, or one whose content does not read, is refused and not applied: GENEALOGY_REPLICA_REFUSED is recorded and ALM-SYS-GENEALOGY-REPLICA-REFUSED (Critical) is raised. Run the genealogy verification on both nodes.

- **eaxScada node B → Operators** (alarm or event): record refused
- **eaxScada node B ↔ eaxScada node A** (replication, not active): confirms

A lost standby does not stop the acknowledgements; the gap after a failover and a refused record are recorded, never hidden.

**When the PLC is acknowledged** is set by `ack_durability` in `data/genealogy/settings.json` on each server:

| Value | The PLC is acknowledged when |
|---|---|
| left out (the default) | the standby confirmed the record, while a standby is heard; the record is in the local journal, while no standby has been heard since the start |
| `local` | the record is in this server's journal |
| `replicated` | the record is in this server's journal and the standby confirmed it |

There is no other value: anything else, `auto` included, is refused and genealogy does not start. A change applies at the next start.

**When the standby is lost.** If the standby does not confirm a record within **2 s**, or sends no heartbeat for **10 s**, acknowledgements fall back to local. The PLC still gets its acknowledgement, never an error: the record is safe in the local journal. eaxScada records `GENEALOGY_REPLICATION_LOST`, then raises the alarm **ALM-SYS-GENEALOGY-REPLICATION** (High), before the acknowledgement goes. While the alarm is up, acknowledged records are on one server only. When the standby is heard again, `GENEALOGY_REPLICATION_RESTORED` is recorded and the alarm clears.

**Failover and split brain.**

- A record from a server that lost the primary role (an older HA term) is kept and marked **FENCED**, never dropped, so it can be reviewed.
- A replicated record that fails its hash or chain check (held with another hash, not linking to the previous record of its run, or a content that does not read) is refused and not applied, recorded as `GENEALOGY_REPLICA_REFUSED` and alarmed (**ALM-SYS-GENEALOGY-REPLICA-REFUSED**, Critical). eaxScada does not clear this alarm by itself: run **Verify** on both servers. It is counted in the replication stats (`refused`) only after both: a refusal you see counted is in the audit trail and alarmed.
- After a failover the new primary first fetches what the old primary published last. When it then holds records of another run, it writes a **CAPTURE_GAP** record (source `SYSTEM:ha-failover`) for the time it cannot account for, from the last of those records to its promotion, and records `GENEALOGY_FAILOVER_GAP` in the audit trail. A request whose acknowledgement the old primary still owed when it lost the role gets no answer from it.

The capture configuration (unit types and triggers) is replicated with the rest of the engineering configuration. **`data/genealogy/settings.json` is not**: retention, `ack_durability`, the export and pseudonymisation are per server. Set them the same on both servers of a pair.

## System alarms

| Alarm | Condition tag | Meaning |
|---|---|---|
| ALM-SYS-GENEALOGY-STOPPED | `System/Genealogy/CaptureStopped` | No new record is made; the PLC handshakes answer error 6. Every record stays readable. |
| ALM-SYS-GENEALOGY-STORAGE | `System/Genealogy/StorageFloor` | Free disk is under the genealogy floor; new records are refused and the PLC gets error 5. |
| ALM-SYS-GENEALOGY-REPLICATION | `System/Genealogy/ReplicationLost` | The standby is not confirming records; acknowledgements are local only. |
| ALM-SYS-GENEALOGY-REPLICA-REFUSED | `System/Genealogy/ReplicaRefused` | The standby refused a replicated record that failed its checks. |

The **Status** page of the Genealogy workspace shows them with recording, store, disk floor, trace index and writer figures, and each capture trigger's counts, live.

## Scripts and the AI assistant

Both read genealogy and never write it.

**eaxTags scripts** get a frozen, read-only `genealogy` object:

| Function | Arguments | Returns |
|---|---|---|
| `genealogy.find(type, id)` | `type`: a unit type, or `""` for any; `id`: the serial or lot number, or its beginning followed by `*` (such as `"GB-10*"`) | The matching units, at most 50: `unit_key`, `unit_type`, `ext_id`, `kind`, `generation`, `status`, `last_station`, `last_result` |
| `genealogy.trace(key, dir, depth)` | `key`: a `unit_key` from `find`; `dir`: `"backward"` (what went into it, the default) or `"forward"` (where it went); `depth`: 1 to 10 | The units reached (at most 200) and the links between them |

Each call is bounded to 100 ms. Script results carry no operator names. On a server without genealogy a call fails with "genealogy is not available on this server".

**The AI assistant and MCP clients** ([MCP AI gateway](/docs/eaxscada/explanation/mcp-ai-gateway/)) get four read-only tools and a resource that describes the model:

| Tool | What it does |
|---|---|
| `scada_genealogy_find` | Finds units by serial or lot number (`ext_id`, `match`: `exact` or `prefix`), or lists the newest units of a `unit_type`. |
| `scada_genealogy_unit` | Reads one unit: state, operations, measured values, latest records (`records`, default 20, at most 100). |
| `scada_genealogy_trace` | Traces backward or forward (`direction`, `depth` default 10, at most 50), at most 500 units. |
| `scada_genealogy_recall_summary` | Summarises a recall from a lot (`lot_type`, `lot_id`, `finished_only`): counts by type and status and the first 100 units. A recall decision stays a person's. |

The resource `resource://scada/genealogy/schema` explains units, links, operations and records to the model. Values are masked by the caller's tag read rights, and names are masked unless the caller has `genealogy.read_personal`; the AI co-pilot role does not have it by default.

## Limits

- Search by ID prefix returns at most 500 units; with no ID, units are listed newest first, a page at a time.
- A trace follows 1 to 100 levels and returns at most 5,000 units in the Studio (100,000 in an export).
- A recall follows at most 200 levels; one recall per user runs at a time.
- A unit's records are paged, at most 500 a page.
- A trigger reads at most 100 components and 200 measured values.
- 50,000 records waiting for the database: new records are refused (error 7).
- A handshake record shows "operator unknown" (no link from a station to a person yet).
- API tokens cannot write records.

## See also

- [Capture genealogy from a PLC](/docs/eaxscada/how-to/capture-genealogy-from-a-plc/)
- [Trace, recall and export genealogy](/docs/eaxscada/how-to/trace-recall-and-export-genealogy/)
- [Genealogy retention, purge and archives](/docs/eaxscada/how-to/genealogy-retention-purge-and-archives/)
- [Export genealogy for analytics tools](/docs/eaxscada/how-to/export-genealogy-for-analytics-tools/)
- [Genealogy API](/docs/eaxscada/reference/genealogy-api/)
- [Security and 21 CFR Part 11](/docs/platform/explanation/security-and-part-11/)
