Skip to content

1.1.0

Choose a tag to compare

@er2es er2es released this 30 Nov 17:25
· 8 commits to main since this release
362a907

Composite ids and watch keys, a performance and production-runtime round for the demo and the docs, and record linkage as an experimental, opt-in
part of the package
(see docs/linkage.md): a lookup, training on your own data (retrained by the worker), batch deduplication,
a review queue with decisions and a hash-chained audit log, erasure, subject access and retention tools, scoring rules for hard cases and
fuzzphony:linkage:evaluate. The linkage types, configuration and commands carry no backward-compatibility promise yet.

Added

  • Demo: the Linkage page completed with Clusters (dedupe run, truth metrics, histograms), Review, Quality (evaluate() sweep) and Privacy (subject report, dry run, erasure, audit chain) tabs, hard-case chips and rule: lines; DEMO_LINKAGE_DEDUPE, DEMO_ALLOW_DECIDE, DEMO_ALLOW_FORGET (off by default).

  • Record linkage evaluation (experimental): fuzzphony:linkage:evaluate <profile> <pairs.csv> measures precision, recall and F1 of a profile on your own labelled pairs (key_a,key_b,label[,tenant]), with a threshold sweep, the review band (size, how many are truly the same), --what-if=match:0.97,review:0.7, --errors=N (the worst false positives and negatives: keys, bits, levels, never a value) and --json. Pairs are scored like lookup candidates, as the actor of --tenant/--user (rows that are missing, hidden or of another tenant are only counted); see tools/linkage/README.md.

  • Record linkage, public experimental API: Linker, LinkQuery, LinkResult, Candidate, FieldComparison, Verdict, Thresholds, AsLinkProfile, LinkProfile, Definition\Comparator, ProfileDefinition, LinkageNotTrained, LinkAuthorizer and WeightsProvider are public, tagged @experimental (no BC promise until declared stable, see CONTRIBUTING); the rest stays @internal. New Linker::explain() (the blocking statement of a probe with its time and plan, LinkExplanation) and Linker::activeWeights() (LinkWeights) replace the demo's reach into internal classes.

  • Linkage similarity (experimental): each lookup candidate has a similarity (0..1: the evidence of the fields present on both sides as a share of the probe scored against itself, so an identical record is 100 %) and comparedFields / probedFields (the coverage); JSON and the fuzzphony:linkage:match output carry them. Candidates are now ordered by bits, then probability, kind, id: the probability saturates at 1 for strong matches and hid the order. Probability, bits and verdict are unchanged. The demo shows the percentage as a banded badge with "4/5 fields" and a best-match chip.

  • Demo, Linkage page (experimental): /linkage with a Person / Company switch, example chips from the seeded corrupted rows, per-field evidence bars, timing, a Ground truth badge and "true duplicates found k of n", an SQL / EXPLAIN tab and the trained weights; docker/init.sh generates tools/linkage/generate.sql (DEMO_LINKAGE, DEMO_LINKAGE_ROWS, default 100 000, dev 20 000), indexes it and trains both profiles.

  • Record linkage (experimental, in progress): profiles, comparators and the opt-in fuzzphony.linkage key (absent = nothing is built); not part of the BC promise yet, see CONTRIBUTING.
    Lookup: Linker::profile('person')->asActor($actor)->match([...]) (blocking passes in one statement, scored candidates with verdicts and per-field explanations, gated like a search: tenant, guards, one rate-limit token, FUZZPHONY_LINK, a search-log row with the keys only) and fuzzphony:linkage:match; an untrained profile is refused (LinkageNotTrained).
    Training: fuzzphony:linkage:train <profile> [--tenant=|--all-tenants] learns Fellegi-Sunter weights from the index itself, no labels (u from seeded random pairs, m and lambda by EM per blocking pass with the comparators' priors as start values and Dirichlet pseudo-counts, identifiers as anchors against households, every trained m floored at 1e-3, a sanity fallback and monotonic Bayes factors (a weaker level's m is lowered, levels with negligible evidence never cap the others), lambda over the candidates without the comparators the blocking selected on (a warning above 0.3), frequent names term-frequency adjusted with a 50-row floor; bounded seeded samples: the same data and seed give the same weights); versions per profile and tenant in fuzzphony_linkage_weights (activated in one transaction, last 5 kept, a run that did not converge is stored but activated only with --force; fuzzphony:linkage:weights shows them and rolls back, refusing without --force a version trained for other comparators or not converged); lookups read the active version (PostgresWeights, the bundle default) and refuse weights trained for another comparator; fuzzphony:doctor checks the profiles and their weights (missing, untrained tenants, changed comparators, row drift, unclean training incl. a high lambda, an unreadable stored row); fuzzphony:schema and --dump-grants include the weights table only when linkage is configured.
    Candidate retrieval: a profile with a text pass gets a trigram GIN of its own per text pass field, over the field joined with its alsoAgainst field (trigram_index, on by default for such a profile, false turns it off; LinkProfile::trigramIndex()); the name pass looks its tokens up there instead of in fz (which also holds mother's names and places): the same candidates, at 1M rows SQL p95 100 -> 27 ms. Built only for an index a linkage profile links against and only with linkage configured (every other schema is unchanged), by fuzzphony:schema --apply (idempotent; a no longer needed one is dropped), kept by the shadow rebuild, checked by the doctor (missing, INVALID, STALE), with statistics target 10 on its expression (the planner's estimate of a <% condition costs ~1 ms per condition at the default 100). Scoring: bounded memos (comparisons, parsed names, token similarities, explanations), Jaro-Winkler on ASCII by byte offsets, the name parser reads once for both orders: comparators + scoring ~4x faster, results byte-identical (a 4 400-probe diff). Training: the trained weights are unchanged, person training at 20k rows about 40 % faster with the trigram index (tools/linkage/README.md).

  • Record linkage batch dedupe (experimental): fuzzphony:linkage:dedupe <profile> [--tenant=] [--resume|--restart] [--dry-run] groups a profile's rows (with dedupe:) into clusters: set-based block keys, the lookup's scorer and weights, a chaining guard (max_cluster_size, veto), stored decisions (on_change: keep|suspend), one atomic swap per tenant, resumable;
    tables per profile from fuzzphony:schema --apply (stable cluster ids, salted fingerprints, an erasure block list the run honours), doctor checks; numbers in tools/linkage/README.md.

  • Record linkage scoring rules (experimental): a profile's rules: (bonus / penalty in bits, floor = hard evidence, cap = veto) on comparator outcomes,
    applied after the Fellegi-Sunter sum, each one an explained rule:<name> line; a probe may carry the also_against field (a birth name), counted once; a field
    used twice (also_against and a comparator of its own) is now a profile error. Twins / namesakes no longer match: numbers.

  • Record linkage review queue and decisions (experimental): Linker::profile()->reviewQueue($limit, $after) (the open pairs of the last
    dedupe run, the most uncertain first, paged by cursor, each with its explanation rebuilt from the stored levels), ->clusterOf($key)
    (ClusterInfo: stable cluster id, member keys), ->decide($a, $b, Decision::Same|Different, $note) and ->undo($a, $b); the commands
    fuzzphony:linkage:review and fuzzphony:linkage:decide (--undo, --note). Gated like a lookup (tenant, guards, search log with the
    action only) with FUZZPHONY_LINK (clusterOf), FUZZPHONY_LINK_REVIEW (queue) and FUZZPHONY_LINK_DECIDE (decisions); a viewer from
    whom a compared field is hidden is refused (the stored output embodies every compared field). Who decided comes from the gate (user:<id>,
    system:<label>), never from a parameter; a decision stores what the reviewer saw and salted fingerprints of both rows, and appends a row
    to a hash-chained decision audit log (who, when, via, previous state; the note is never copied; dedupe: {notes: false, audit_chain: false}).
    Decisions apply at the next dedupe run; on_change: keep (default) or suspend (a decision on a changed row returns to review with its
    previous decision); conflicts are explained at decide time ("different" wins). --dump-grants: the search role reads __clusters and
    __review, the worker role writes the decisions. Doctor: decisions pending, changed, orphan, and the audit chain.

  • Record linkage data protection (experimental, GDPR): LinkQuery::forget($key, 'erasure'|'objection', dryRun) and
    fuzzphony:linkage:forget erase a key from linkage in one transaction (block list of salted digests that every dedupe run, a run that
    was running and decisions honour; pairs, review, decisions and membership deleted; audit rows redacted with the chain kept valid; the
    rest of the cluster re-clustered), --all --tenant --yes offboards a tenant (a dry run without --yes); the dedupe swap always filters and re-clusters against the current block list; subjectReport() / fuzzphony:linkage:subject (keys and level
    names only); new attribute FUZZPHONY_LINK_ERASE (no default voter grants it). Retention: fuzzphony.linkage.retention (audit 730 days,
    orphan decisions 30, review 180; guarded against an emptied index and never the last run's queue) with a daily worker job and fuzzphony:linkage:purge; fuzzphony:linkage:erased --export|--import
    (MAC-protected, for backup restores; the doctor detects a restore); fuzzphony:linkage:audit (verify, anchor);
    training.frequent_values (enabled, floor >= 20); fuzzphony.linkage.pepper (default the kernel secret, never change it once keys are erased; checked on every path that reads the block list, stored as a check value by fuzzphony:schema --apply, a forget without a stored check that the role cannot store is refused, the key is a bound parameter and never in statement text; no rotation tool, no row-level security between tenants: documented) keeps the digests unguessable from a database copy. See Record linkage and data protection.

  • Record linkage audit rows are inserted complete: the number comes from __audit_seq and the hash is computed before the insert;
    the worker role lost its UPDATE grant on the hash columns (it may only redact the key columns on an erasure); every suspend, forget,
    unforget and purge is logged too. Run fuzzphony:schema --apply and --dump-grants again (unreleased branch: no migration).

  • Record linkage retrains itself (experimental): the worker retrains a profile (per tenant) when the doctor would ask for it (no weights, changed profile, rows 25 % off); fuzzphony.linkage.retrain (interval, max_per_day, window, false = off), and fuzzphony:linkage:train <profile> --if-stale for deploy steps and cron; see docs/linkage-freshness.md.

  • Composite ids and watch keys (one block, additive): an index can be identified by up to 8 columns (id: [order_id, line_no],
    idType([...]), #[Searchable(id: [...])], also a Doctrine composite identifier) and a watch can key on several columns (SELECT :order_id, :line_no);
    every sync mode follows them. A hit's id is the canonical text key ("10|2") and the new Hit::$idParts the typed parts (null for a
    single-column id; a single-id Hit and every single-id index are unchanged); refresh() and reindex --from='10|2' take the key, and with()
    reads the source row by it (tenant condition and granted fields as for a single id). A source of a multi-source index may be composite
    too (stored as line:10|2; the hit's kind is line, its id 10|2, idParts the typed parts). A many field or filter of a composite index
    links its child rows by one column per id part (many: { key: [tenant_id, order_no], id: [tenant_id, order_no, line_no] }: ManyValues::$key
    and $id are string|list<string> now). See Configuration and the write cost.

  • Doctor and wizard know composite keys: the doctor counts the columns of a composite index's watch queries (one short is an error), checks
    every id part and the unique key of the source table (and its column order), and warns when a key part is a granted field or several composite
    indexes watch one table; it warns about char(n) and citext key parts, counts the source rows with a NULL key part and measures the longest
    encoded key (an error over 2000 bytes; a sample of 100 000 rows without --deep); a composite many key wants a child index led by all its key columns (any order). fuzzphony:wizard finds a composite primary key, takes --id=a,b, and its exports keep the composite id, id_type and watch key.

  • fuzzphony:schema, reindex and doctor with no index configured print "No search index is configured: nothing to do." and exit with code 0.

Fixed

  • Record linkage review (experimental): a pair decided while a dedupe run ran no longer stays in the review queue; keys with a
    trailing newline and review cursors with an out-of-range number are refused as InvalidQuery; the refusal of a viewer from whom a
    compared field is hidden comes before the rate-limit token and is in the search log; fingerprint values are length-prefixed.

  • refresh() of a multi-source index refuses an id its single-column source cannot take (order:abc for an int id) with an
    InvalidArgument that does not echo it, instead of failing the whole batch in PostgreSQL with a misleading "run fuzzphony:schema" hint.

  • Refreshing and reindexing a composite-id index is linear in the batch (a 5000-key batch compared every key with every document):
    a 200 000-row reindex takes about 1.7x the single-id time instead of 25x; single-id indexes are unchanged.

  • A writer with the search role's grants could not write a table watched by a trigger_level: row queue index ("permission denied for table
    fuzzphony_queue": the trigger's ON CONFLICT needs SELECT on the queue's key columns). --dump-grants --role=search now prints
    SELECT (index_name, doc_id) on the queue as well; run it again and apply the new line. See Database roles.

Changed

  • Demo, header: between 768 and 960 px the brand sits on its own line above the centred links (the search button next to the brand had pushed the links 27 px
    off centre at 900 px); the Ctrl K hint now hides below 1056 px.
  • Demo, runtime: PostgreSQL jit=off, a persistent PDO connection for PHP-FPM, opcache.jit=disable, and pages that never search (doctor, observability,
    analytics, benchmark, ERP sync) no longer query the synonym version. Measured on the 20k-row demo stack: typo search with a large-table JIT threshold
    662 / 742 / 487 ms with JIT, 115 / 52 / 44 ms without; observability page 81.6 to 68.6 ms, /?q=mouse 31.2 to 20.8 ms; a new connection costs 9.7 ms, a
    persistent one 1.0 ms.

Documentation

  • New Production runtime checklist: OPcache/preload, classmap, cache warmup, persistent connections or PgBouncer (transaction
    mode for the search), PostgreSQL jit=off, worker limits and the measured batch_size table (default unchanged).