Skip to content

feat(bench,engine): bench specs from documentation, IBM AML monthly dataset; generic engine and evaluation fixes - #79

Merged
nick-developer merged 23 commits into
mainfrom
claude/project-thread-ttjix4
Nov 28, 2026
Merged

nick-developer merged 23 commits into
mainfrom
claude/project-thread-ttjix4

Conversation

@nick-developer

@nick-developer nick-developer commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

What and why

This follows the weekly bench failure analysis. The owner decided to rewrite the drafted specs from published documentation, verify the engine's results, log owner-accepted drift with its reason, and add IBM AML (HI-Small) to the monthly tier.

Specs (rule 2: spec first)

  • TPC-DS (new, every scale; TPC-DS v4.0.0 clauses 2 and 5.3.11), Census-Income KDD, electricity, ACS and Contoso Parquet rewritten from their documentation; AdventureWorks checked against instawdbdw.sql (3 drafted checks removed). Berka rewritten from the PKDD'99 data description (berka_specs.md). Every rule was checked on source rows first; each spec names its sources.
  • IBM AML (HI-Small), monthly tier only: downloaded from the authors' Kaggle dataset with the KAGGLE_API_TOKEN secret (passed only to the ibm_aml job), SHA-256 pinned. Builder adds an account surrogate key (account ids are unique only within a bank). Spec from the owner's specification; Bitcoin rule held on 99.998 % (owner), one rate per currency confirmed by check M12 (largest daily move 0.0051 %). Checks M1 to M12 in bench/checks/ibm_aml.py. Link affinity lists the account match before the bank match (intra-bank pairs 11.8 % to 1.9 %, source 2.0 %).

Accepted drift (logged with reasons in bench/datasets.py)

  • AdventureWorks DimProduct shrinkage; ACS privacy-distance checks (independent DCR ratio 1.62 to 1.42); census age (follows from the age rule). All accepted by the owner on 2026-11-27.
  • The baseline commit 59b45da is reverted (ffec5fa); the baseline is rebuilt after this PR merges.

Engine (rule 2: generic, each tested on more than the dataset that revealed it)

  • Line keys offset from an order-header key (header/line facts; was refused).
  • SCD2 version dates: increasing starts, positive lengths, moved starts stay on the source's later-version starts; single-version keys and first starts are kept (entities arriving after the last re-versioning).
  • Exact derives, lookups and cumulative rules that read a soft rule's column run after it (Engine._after_soft; payments in a format's currency then converted amounts, a standard discount then net price and running spend). Revealed by AML M4.
  • Rule-linked categorical joints, unique keys over stratifying columns, link affinity under unique keys (no move when a key column is not drawn yet).
  • Quality report: fan-out checks of a sampled fact use exact per-parent counts (it compared a real sample with the full synthetic table).
  • evaluate.join_metrics counts categorical join columns once (memory).
  • New setting marginals.point_mass_knots (see below).

Moved to the follow-up PR #80 (owner's decision): joint currency links and match-aware self-loops for facts with several links (AML cross-currency 18 % vs 1.4 %, Reinvestment 0 %).

Defaults, privacy and fidelity (rule 4)

  • No default changed. marginals.point_mass_knots is off by default; default output is byte-identical on all 24 fake-scenario and quickstart runs (settings-autotune).
  • When turned on, columns with point masses (zero-inflated amounts) get about grid knots for their continuous part: W1/sd of census wage per hour 0.104 to 0.013, capital gains 0.120 to 0.007, Adult capital gain 0.067 to 0.013. Privacy: more knots expose more of the continuous tail's shape; tail_trim still trims the extremes. Turned on only in the census_kdd bench spec.

How it was tested

  • Unit suite: 1095 passed, 31 skipped (local); CI unit matrix (Linux 3.10 to 3.13, macOS, Windows), science, integration, e2e, neural, documents all green on ab2b5db.
  • New tests: test_header_key_offsets_scd.py, test_soft_then_exact.py (3 classes, each fails without the fix), test_atom_knots.py, test_unique_key_affinity.py, quality exact-count test.
  • Bench at 465e68a: census_kdd and berka pass; ibm_aml (monthly) 46/52 with 0 domain identities broken (M4 fixed; was 1), remaining quality gaps are the feat(engine): draw role-playing links jointly; match affinity per row #80 items; acs and tpcds_sf1 results to follow.

Security and code audit (rule 1)

  • CI scanners green on ab2b5db: lint (ruff S, bandit, pip-audit), CodeQL (python, actions, javascript), Semgrep, zizmor, dependency review, gitleaks.
  • Security review of the diff: the Kaggle credential is read from the environment, sent only to kaggle.com over HTTPS, never forwarded on the signed-URL redirect, never logged; the download is checked against the pinned SHA-256 and the archive member is written to a fixed path. No findings above warning.
  • Code review: 4 important findings fixed in ab2b5db (SCD single-version keys moved; affinity under a unique key with an undrawn column; tail_trim=0.5 division by zero; cumulative rules not recomputed after soft rules), plus nits (_ukey numpy NaT, clear error when the Kaggle archive lacks the file). Declined: none.

Checklist

  • Conventional Commits, signed off
  • CHANGELOG.md entries under Unreleased
  • docs/spec-reference.md and docs/settings-reference.md updated

🤖 Generated with Claude Code

https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf

github-actions Bot and others added 2 commits November 27, 2026 14:15
Built by bench.yml (rebuild_baseline) from the records of run 45965246339 on GitHub-hosted runners.

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… header-key offsets, SCD2 lengths

Bench specs written from each publisher's documentation, every rule checked
on the source rows first: TPC-DS (v4.0.0 clause 2 schema, clause 5.3.11 view
rules; new spec for every scale), Census-Income KDD (UCI 117), electricity
(UCI 321), ACS (SDNist data dictionary), Contoso Parquet (generator DDL,
docs.sqlbi.com); AdventureWorks checked against instawdbdw.sql and Berka
against the data (three drafted checks the source breaks or that hold by
chance removed; keys and transaction-code rules added).

Engine (generic):
- a line key may be offset from an order-header key (class: header/line
  facts with ship/due/paid date keys); lookups through the offset key are
  read after it, and line rules reading a parent through a header key are
  rewritten through the header (expr.prefix_paths).
- SCD2: starts closer than the source's shortest version move by a drawn
  source version length; a closed latest version ending on or before its
  start takes a source length (TPC-DS item: 362 start >= end rows -> 6).

Tests: retail order lines and claim lines; release-date and continuous
version histories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

Pre-merge checks: Passed 5

Check name Status Explanation
No Secrets At Rest Or In Logs Passed No security finding. The check passes because the change does not write a credential to a file, log, exception, report, artefact or snapshot, and adds no hard-coded credential outside tests/. **Scope.…
Tenant Isolation And Authorisation In The Service Passed The check applies to new or changed endpoints, queries and file paths in src/relsynth/service. This pull request does not change that subtree. Evidence: - The PR head is ab2b5db. The base branch is ma…
Untrusted Input Reaches A Dangerous Sink Passed Summary: No untrusted input reaches a dangerous sink without validation in the changes under review. One minor hardening gap exists in the Kaggle redirect handling. Evidence base: The checkout…
Privacy Guarantees Match The Proofs Passed The check applies only when a change touches src/relsynth/dp, privacy, governance or textgen, or a privacy-relevant change hits one of the listed failure conditions. I compared main with HEAD (ab2b5db…
Workflow And Deployment Hardening Passed No security findings. The PR changes one file in scope: .github/workflows/bench.yml. Dockerfiles, deploy/ and the Helm chart are not in the PR diff. Method: the clone was shallow. I deepened it to…
Full details: No Secrets At Rest Or In Logs

Explanation

No security finding. The check passes because the change does not write a credential to a file, log, exception, report, artefact or snapshot, and adds no hard-coded credential outside tests/. Scope. The primary PR is #79 (nick-developer/relsynth, base main, head claude/project-thread-ttjix4). The author is nick-developer. The local clone has no usable base for a diff, so I checked the current tree at ab2b5db for the PR's secret-handling code. The PR's secret handling is the Kaggle download for IBM AML. Kaggle credential (bench/datasets.py, lines 185–257). - _kaggle_auth() reads KAGGLE_API_TOKEN from the environment. It builds a Basic or Bearer Authorization header. The header is used only in the urllib request to www.kaggle.com. - _Stop stops redirects. The signed storage URL is fetched with urlopen(target) and no Authorization header. - say() messages print only the file name, the slug and the SHA-256 digest of the data. They do not print the token. - The HTTP error path raises RuntimeError(f"{name}: Kaggle answered HTTP {e.code}") with from None. The token does not appear in the message. - A malformed kaggle.json value raises a JSONDecodeError with a position-only message. It does not echo the value. - The missing-token errors name the variable, not its value. CI injection (.github/workflows/bench.yml, lines 97–98). KAGGLE_API_TOKEN comes from secrets.KAGGLE_API_TOKEN only when the matrix part includes ibm_aml. Otherwise it is empty. The token is passed as an environment variable. No workflow step echoes it, writes it to a file or enables tracing on it. Bench reports (bench/runner.py, line 44). The machine metadata records only the node name, the platform and the CI flag. No environment dump reaches the report. Child processes inherit os.environ, which is the existing behaviour. Nothing in the code prints or stores that environment. Service secret path (worker.py 185–187, runner.py 23–33, secrets.py). Secrets travel only as secret_ref and as RELSYNTH_SVC_SOURCE_SECRET in the job process environment. source_section() removes credential keys from the job description. SecretError messages name the scheme, the environment variable name or the path, not the resolved value. The PR does not change these files, as far as the tree shows. Hard-coded credential search. A search of bench/, src/, deploy/ and docs/ found no new literal secrets. The matches were placeholders (&lt;pw&gt;, &lt;source password&gt;, a user:pw template line) and random values generated in deploy/e2e/*.sh. The matches in docs/testing.md (for example RelSynthTest1) are local test-database examples. The PR description does not list docs/testing.md as changed, so these are not attributed to this PR. They are not secrets in the sense of the check. Their presence is a documentation note, not a finding. Limits. I could not diff the PR against its base. The conclusion covers the current tree and the PR's stated scope (Kaggle download, AML builder, engine and evaluation changes). The PR description states that the CI scanners (gitleaks, Semgrep, CodeQL) were green on ab2b5db. I did not re-run them. Findings. None. No critical, major or minor issue was found.

Full details: Tenant Isolation And Authorisation In The Service

Explanation

The check applies to new or changed endpoints, queries and file paths in src/relsynth/service. This pull request does not change that subtree. Evidence: - The PR head is ab2b5db. The base branch is main (085eca3). - git diff --name-only main HEAD lists 43 files. None is under src/relsynth/service. A filter on "service" returns no match. - git diff --stat main HEAD -- src/relsynth/service returns no output. The service files are identical to main. - The changed files cover bench/, src/relsynth/engine.py and related engine modules, docs, CHANGELOG.md, and tests. None of them is a service endpoint, store query, artefact path, connection, release, or audit path. The repository is a shallow clone, so git merge-base fails. The tree diff between the two refs is still exact, and it is the basis for this verdict. Because no service endpoint, query or file path changed, none of the listed criteria applies. The criteria for tenant isolation, RBAC, store filtering, artefact paths, policy.check_source, audit records, release and approval rules, and the agent role are not triggered by this PR. The existing service code (store.py, auth.py, release.py) is unchanged and is out of scope for this PR. No security finding is reported.

Resolution

None required for this check. If the scope of the PR changes later to touch src/relsynth/service, re-run this check against the new diff.

Full details: Untrusted Input Reaches A Dangerous Sink

Explanation

Summary: No untrusted input reaches a dangerous sink without validation in the changes under review. One minor hardening gap exists in the Kaggle redirect handling. Evidence base: The checkout is shallow, so git diff main...HEAD has no merge base. I used the two-dot diff git diff main HEAD (43 files: 10 added, 33 modified). I inspected every added sink-relevant line I could find. Sinks checked: - SQL (bench/builders/aml_parquet.py): All DuckDB SQL strings are constant. The CSV values (ts, fb, fa, tb, ta, ar, rc, ap, pc, pf, lab) are never interpolated into SQL text. The CSV is read with read_csv and all_varchar=True through the relation API. Output paths are built from fixed names (bank.parquet, trans.parquet, and so on). - File paths: The Kaggle file key and cache name come from the constant KAGGLE dict in bench/datasets.py. The zip member is found by name and then streamed to a fixed derived path (path.with_suffix(...".unz")). The member name never becomes a write path, so there is no zip-slip path. bench/checks/ibm_aml.py loads f"{t}.csv" with t from the constant TABLES. - Subprocess: The new builder call (bench/datasets.py, _built) uses an argument list with no shell. The arguments are constants or paths built by the bench. - eval, exec, pickle, joblib, yaml.load: None were added in the diff. expr.py adds only AST rewriting (prefix_paths), with no eval. - Regular expressions: regress.accepted_reason builds a re.search pattern from the accepted tuples in Dataset definitions. These are code constants, not spec or file input. - Credentials and headers: KAGGLE_API_TOKEN is read from the environment and parsed with json.loads or split. It is placed only in the Authorization header of the request to the constant https://www.kaggle.com/api/v1/... URL. The downloaded bytes are checked against a pinned SHA-256 before use. Outbound URL (minor): In download_kaggle, a 3xx Location header from the Kaggle response is passed to urlopen(target). The code accepts it when it starts with https://. There is no host allowlist. The shared relsynth._http.urlopen wrapper limits schemes to http(s) and handles credential-bearing redirects, but it does not restrict hosts for plain downloads. The request to the target carries no credentials, the response is hash-verified, and the job is a maintainer CI download. Impact is therefore low: a GET from the runner to an https host that a compromised or intercepted Kaggle response names. The allowed_hosts control in src/relsynth/service/policy.py covers service database URLs, not this bench download. Other notes: Engine, spec, and quality changes add no file, SQL, subprocess, or URL sinks. The accepted and DATASETS changes only alter reporting.

Resolution

Minor (hardening, not blocking): in bench/datasets.py download_kaggle, validate the redirect Location host against an explicit allowlist of Kaggle storage hosts before calling urlopen(target, ...). This closes the SSRF-style gap. Input: the server-supplied Location header. Impact: a GET to any https host from the runner. Fix: compare urlsplit(target).hostname against the allowed hosts, and reject any other host.

Full details: Privacy Guarantees Match The Proofs

Explanation

The check applies only when a change touches src/relsynth/dp, privacy, governance or textgen, or a privacy-relevant change hits one of the listed failure conditions. I compared main with HEAD (ab2b5db) by tree diff. The merge base is not available in this clone, so I used the two-dot tree diff. The 43 changed files include no path under src/relsynth/dp, privacy, governance or textgen, and no file under docs/proofs or docs/assurance. The only privacy-tagged change is the new setting marginals.point_mass_knots in src/relsynth/marginals.py. It is registered with affects=_FID_MARG + _PRIV in settings.py. I checked it against each failure condition: - Sensitivity or contribution bound: unchanged. The diff adds _atom_knots, which only adds quantile knots of the marginal. It is off by default. - Noise scale: unchanged. The diff contains no noise, rng or seed lines. - Accountant charge or composition step: unchanged. No file in the accountant or composition path is in the diff. - Noise from Python's random module or an unseeded RNG: the diff adds no random draws. - Data read before budget reserved: no change to the reservation order. - Registered sentence in docs/assurance/claims.yaml: the file is not in the diff. The nearest registered sentence (around line 2436, on neural decoding through quantile knots) is not edited. The tau rescaling at tail_trim=0.5 is algebraically the identity when point_mass_knots is off, so default behaviour is unchanged. The PR text says more knots expose more of the continuous tail's shape. That is a stated privacy trade-off. It is not one of the listed failure conditions, so it does not fail this check. Reviewers may still want a proof note if the owner treats knot count as privacy-relevant.

Full details: Workflow And Deployment Hardening

Explanation

No security findings. The PR changes one file in scope: .github/workflows/bench.yml. Dockerfiles, deploy/ and the Helm chart are not in the PR diff. Method: the clone was shallow. I deepened it to get the base. The merge base of main and ab2b5db is 085eca3. The diff against that base lists the in-scope changes. Change in bench.yml (bench job, step ${{ matrix.part.name }}): - Adds KAGGLE_API_TOKEN: ${{ contains(matrix.part.datasets, 'ibm_aml') &amp;&amp; secrets.KAGGLE_API_TOKEN || '' }} to the step env block. The secret is not placed in a run block. - matrix.part.datasets comes from the plan job's own matrix output, not from event data. The workflow triggers are push to main, schedule and workflow_dispatch. None of them is a pull_request trigger, so fork PRs do not receive the secret. Criteria, applied to the whole bench.yml: - SHA pinning: every uses: line is pinned to a full commit SHA with a version comment (checkout v7.0.1, setup-python v7.1.0, cache v6.1.0, upload-artifact v7.0.2, download-artifact v8.0.2). - Least privilege: top-level permissions: contents: read. The baseline job raises this to contents: write and actions: read, and that is needed for its push. The generator-trial job sets contents: read explicitly. - persist-credentials: every actions/checkout sets persist-credentials: false. The baseline job passes the token only to the one push command. - Event data in run blocks: run blocks read inputs and matrix values through env. There is no direct ${{ }} expansion in a run block. - pull_request_target: not used. - Dockerfiles, deploy/, Helm chart: not changed in this PR. Their container hardening is pre-existing and not worsened by the PR, so it cannot cause a FAIL here. - Downloads: the workflow downloads no binaries itself. The Kaggle download and its SHA-256 check sit in Python code under bench/, which is outside this check's file scope. - Unpinned pip installs (pip install -e ".[dev,bench,benchmark]" datasketches) are pre-existing. The PR does not touch those lines. Severity: no findings.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…oduct shrinkage)

Dataset.accepted lists (check id pattern, reason) pairs the owner accepted.
A matching failed check is logged with the reason during the run, and
compare reports it as a note instead of an R1/R4 regression until a baseline
holds it. AdventureWorks accepts the DimProduct drift caused by its spec's
segment shrinkage (owner decision 2026-11-27).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
The baseline rebuild waits until plan steps 1 to 5 are merged (owner
decision 2026-11-27), so it leaves this pull request.

This reverts commit 59b45da.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
A start too close to the previous version's moves to the next of the
source's later-version start quantiles (release-style dates stay on the
source's dates); a key that would run past the last of them takes the last
ones; a closed latest version ending on or before its start falls back to a
version length when the source has no closed latest versions. TPC-DS SF0.1
item: start >= end rows 6 -> 0, i_rec_end_date KS 0.334 -> 0.166.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
Column descriptions and code meanings from the owner-supplied description;
the card-per-disposition key is dropped because the description allows more
than one card per account. Description points the data contradicts (client
birth_number, empty order k_symbol, trans type VYBER, misplaced k_symbol
codes) are noted and the data is kept. All 10 checks hold on the source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
IBM Transactions for Anti-Money Laundering, HI-Small (5,078,345 transfers),
from a pinned Hugging Face copy (SHA-256 checked; source choice pending the
owner's answer). Builder writes bank, account (surrogate key for the bank +
account pair), currency (US Dollar rate) and trans Parquet tables. Spec from
the supplied dataset specification, every rule checked on the data: FX
derive through the currency rates, reinvestment self-loops, cross-currency
formats; checks M1-M11. Monthly tier, one seed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
Comment thread bench/builders/aml_parquet.py Fixed
Comment thread bench/builders/aml_parquet.py Fixed
Comment thread bench/builders/aml_parquet.py Fixed
Comment thread bench/builders/aml_parquet.py Fixed
Comment thread bench/builders/aml_parquet.py Fixed
Comment thread bench/builders/aml_parquet.py Fixed
No SQL text is built from a path any more (Semgrep
relsynth-sql-string-building, code-scanning alerts 290-295); the four
Parquet tables are identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
…check M12

Owner decisions 2026-11-27: the data comes from Kaggle with the KAGGLE_API
secret (bench.yml passes it only to the ibm_aml job; the API's redirect to
signed storage is followed without the credential); Bitcoin-format payments
in Bitcoin as a derive holding on 99.998 % of rows; the rate "at Timestamp"
is re-tested on every run by check M12 (the builder also logs the largest
daily move of a rate; 0.005 % on the HI-Small copy checked here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
The repository secret is named KAGGLE_API_TOKEN (owner, 2026-11-27); the
monthly run read an empty KAGGLE_API and skipped ibm_aml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
…ying columns, affinity under unique keys; one-pass partner evidence

Weekly bench run 46028703588 on the rewritten specs (generic, each with tests on
more than the dataset that revealed it):

- Categoricals that check rules constrain together are modelled as one joint over
  their observed combinations, when there are at most marginals.joint_max_levels of
  them and each has at least privacy.suppress_small_counts rows (class: coded
  ledger entries, one-hot indicator groups). Drawn one by one, most draws broke
  the rules and rejection shifted the shares: Berka trans k_symbol null share
  0.65 against 0.46 in the source, now 0.46.
- A unique key over a link and the column that stratifies the entity's rows (an
  account's OWNER disposition) was dropped without notice; it is now enforced
  (Berka disp duplicates 12% -> 0.5%), and a key the engine cannot enforce is
  reported as a warning.
- Link-affinity moves keep unique keys: a move to a parent whose key is taken
  exchanges the two rows' links, over repeated passes (before, a link in a unique
  key was not moved at all). Berka client/account district matching 0.89 (source
  0.91).
- Partner evidence for segment strata is computed in one pass over the (level,
  partner) cells instead of once per level (identical value; TPC-DS SF0.1 fit to
  the segments 132 s -> 48 s; SF1 fit took 2 h).

Spec: the Berka interest rule is null-safe (an empty k_symbol made it pass).
Berka seed 1: 0.824 -> 0.863 (baseline 0.846).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
Read from bench run 46050454169 (Kaggle download with KAGGLE_API_TOKEN); it is the
same file as the Hugging Face copy checked earlier, so the data facts and the
real-data values of checks M1-M12 stand (M12 = 1.0: the largest daily move of a
US Dollar rate is 0.0051 %, so the rate at Timestamp is constant over the period).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
Comment thread src/relsynth/engine.py Fixed
Class: joined categorical columns of large fact tables. join_metrics
built string copies of each joined column twice (tvd and coverage);
on TPC-DS SF1 (2.9M store_sales rows x many dimension columns) this
ran the evaluation out of memory. Counts are now canonicalised once and
shared by tvd and coverage; results are identical (checked on int,
string, float and Int64 columns).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
… of identical values)

_ukey also treats NumPy floating NaN as null, which the float-only self-comparison missed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
Class: numeric columns where a few values hold much of the mass
(zero-inflated wages, amounts, capital gains, counts with a dominant 0).
A value with share A took A*grid of the quantile knots, leaving the rest
of the law (1-A)*grid knots; with 94% zeros, 4 knots, and linear
interpolation spread the upper tail evenly to the maximum. Extra knots
are now placed at equal steps of the non-atom weight so the continuous
part has about grid knots. Columns without atoms are unchanged.

W1/sd of a fitted-and-sampled marginal: census wage per hour 0.104 to
0.013, census capital gains 0.120 to 0.007, Adult capital gain 0.067 to
0.013. New tests on zero shares 0.6, 0.8 and 0.94. Unit suite: 1088
passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
…age drift

ACS: the spec from the SDNist data dictionary types nominal codes as
categorical and adds the documented INDP and PUMA dimensions; every
generator's synthetic rows move closer to real rows on the same engine
(independent reference DCR ratio 1.62 -> 1.42, copula 1.41 -> 1.25);
all privacy checks still pass.
Census: the documented rule age < 15 <=> education 'Children' is
enforced by rejection and the copula cannot express a hard threshold,
so age JS rises by about 0.016; engine follow-up.
Accepted by the owner on 2026-11-27.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
…_knots (off by default)

The extra quantile knots for columns with point masses (428191a) change the
output of every spec with a repeated numeric value, and each knot is a
quantile of the data. As with segment shrinkage, they are now a spec choice:
marginals.point_mass_knots (bool, per spec or per table), off by default, so
the default output is byte-identical to main (tools/identity_check.py; the
settings-autotune job failed on 4256f8f). The census bench spec turns it on
(wage per hour, capital gains and losses, dividends).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
…nt counts

Class: every fact large enough for pushdown (TPC-H, TPC-DS, NYC taxi, IBM AML).
The quality report compared the full synthetic fact with the real sample the
fit reads, so per-parent counts differed by the sampling rate (fanout_w1_rel
about rows/sample - 1: 9.17 on IBM AML, 11.0 on TPC-H SF1, 7.3 on NYC).
assess_quality now passes the pushdown statistics, and fan-out and two-hop
counts of a sampled child come from the source's GROUP BY, as the scorecard's
cardinality check already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
… run after it; AML affinity order

Class: a rule that holds on most rows feeding an exact rule (a key set by a
soft rule and read through as a lookup: Bitcoin payments in Bitcoin, then the
received amount at the payment currency's rate; a column read directly: a
standard discount, then the net price). Soft rules are applied last, so the
exact rule read the value from before the soft rule changed it (IBM AML M4:
1,246 Bitcoin rows with converted amounts in one currency). Engine._after_soft
recomputes such lookups and derives after the soft rules. Tests on both
classes fail before and pass after; default output byte-identical on every
fake scenario and the quickstart; unit suite 1092 passed.

IBM AML spec: the account match before the bank match (a self-loop is a
same-bank pair; listed after it, the bank match added 11.8 % other same-bank
pairs against 2.0 % in the source; now 1.9 %).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
nick-developer pushed a commit that referenced this pull request Nov 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwH6tUFRHQmAuSgBrg5
Signed-off-by: Claude <noreply@anthropic.com>
…nique keys, tail_trim bound, balances after soft rules

- SCD type 2 (class: dimensions whose entities keep arriving after the last
  re-versioning: new customers, new products): a key with one version is no
  longer moved onto the source's later-version starts, and a key with later
  versions keeps its first start; only its later versions move, unless the
  first start leaves no room for them. Recent entities past the last
  later-version start: 0 % before, 14 % after (source 37 %; the rest comes
  from grouping rows into keys independently of their start, noted in the
  test). New test; existing release-date and continuous SCD tests pass.
- Link affinity under a unique key with a column not drawn yet: no move is
  made (a move could not be checked), as before the unique-key support.
- marginals.tail_trim at its upper bound 0.5 no longer divides by zero, and
  point-mass knots are skipped there. New test.
- Engine._after_soft also recomputes cumulative rules whose step, groups or
  order read a changed column (running spend of net prices after a soft
  discount). New test fails before, passes after.
- Nits: _ukey treats numpy NaT as null; the Kaggle download fails clearly
  when the archive lacks the file.

Default output byte-identical on all 24 fake-scenario and quickstart runs;
unit suite 1095 passed, 31 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
@nick-developer nick-developer changed the title feat(bench,engine): bench specs from documentation; header-key offsets, SCD2 lengths feat(bench,engine): bench specs from documentation, IBM AML monthly dataset; generic engine and evaluation fixes Nov 28, 2026
… ancestor's rows

Class: relational evaluation of a fact with millions of rows joined to
categorical ancestor attributes (TPC-DS inventory, 11.7M rows). join_metrics
gathered each ancestor column out to one object per fact row before counting
its levels; the weekly tpcds_sf1 bench run at 465e68a hit its 12 GiB limit in
_canon_counts. _JoinedView.level_shares now weights each ancestor row by its
number of fact rows (with its first fact row, so labels keep their order) and
counts there. Shares, labels and order are identical (new test on 40 random
two-level schemas with ties, missing parents, nulls and 1/1.0/Decimal('1')
spellings). One 11.7M-row column: peak extra memory 1,125 MiB to 180 MiB,
18 s to 0.4 s. Evaluation only; synthetic output unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
Class: relational evaluation of a fact with millions of rows and several
reference keys into copied tables (TPC-DS inventory, 11.7M rows). After
51f98e1 the tpcds_sf1 run passed join_metrics and hit the 12 GiB limit in
grain_metrics: every reference path was memoised as one string per row on
each side, and the novel-combination share built Python tuples per row.
Each path is now factorised once (distinct values spelt once, merged by
spelling) and the combinations are counted as integers. Values identical to
the per-row string definition (new test: direct and two-hop references,
nulls, 1/1.0, synthetic values absent from the real side). Three keys on an
11.7M-row fact: peak 3.4 GiB to 0.85 GiB, 374 s to 3 s. Evaluation only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
A failed run's error was cut to its first 200 characters, which for a
traceback hides the exception itself. The summary now keeps the first line
and the last (the exception).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSVqwDzQT4tiTqMY47wnYf
Signed-off-by: Claude <noreply@anthropic.com>
@nick-developer
nick-developer marked this pull request as ready for review November 28, 2026 10:57
@nick-developer
nick-developer merged commit 31bca37 into main Nov 28, 2026
72 of 74 checks passed
@nick-developer
nick-developer deleted the claude/project-thread-ttjix4 branch November 28, 2026 10:57
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.

3 participants