Repository navigation
Description
Wave 4 · 20 finding(s) in 20 fix package(s). Fix these whenever a pull request touches this module ("clean the module you touch").
Findings
-
CR-A11-059 (code, Low) — detect_pii double-counts overlapping spans across families while mask_pii is first-match-wins, so report/gate counts disagree with masking
severity Low · reachabilitydefault· intentintended-but-harmful· confidence confirmed · independently confirmed · reproduced end to end
Failure scenario. 'contact A1234567@uni.edu now' -> detect_pii {'email': 1, 'de_id': 1} (worst tier 'high'), mask_pii counts {'email': 1}. '4111111111111111@x.com' -> detect_pii {'email': 1, 'credit_card': 1} (gate fails), mask_pii counts {'email': 1}.
Where.forgelm/data_audit/_pii_regex.py:254-261,forgelm/data_audit/_pii_regex.py:288-306,forgelm/data_audit/_aggregator.py:147-148
Recommended fix. Make detect_pii share mask_pii's span-claiming logic (track claimed spans with finditer and skip overlaps in precedence order), or document that per-family counts may overlap. -
CR-A11-060 (code, Low) — mask_pii on cards swallows trailing separators, gluing [REDACTED] to the next token
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. mask_pii('card 4111 1111 1111 1111 - thanks') -> 'card [REDACTED]thanks'; mask_pii('4111 1111 1111 1111 2026') -> '[REDACTED]2026'. Ingested SFT chunks get malformed text after --pii-mask.
Where.forgelm/data_audit/_pii_regex.py:64,forgelm/data_audit/_pii_regex.py:298-306
Recommended fix. Use\b\d(?:[ -]?\d){12,18}\bso separators sit only between digits. -
CR-A11-063 (code, Low) — Production audit worker reads the test-only env var FORGELM_AUDIT_TEST_WORKER_RAISES and raises RuntimeError
severity Low · reachabilityundocumented· intentintended-but-harmful· confidence likely · single reviewer · not reproduced (code trace)
Failure scenario. The variable is left set in a shared CI environment after a test run, and real audits with --workers > 1 fail for a split named 'train'.
Where.forgelm/data_audit/_orchestrator.py:207-223,forgelm/data_audit/_orchestrator.py:207-224,forgelm/data_audit/_orchestrator.py:197-224,forgelm/data_audit/_orchestrator.py:221
Recommended fix. Inject the failure through a picklable worker callable or initializer that tests can substitute, instead of an env read in production code. -
CR-A11-064 (code, Low) — User-manual report example misstates the shape of languages_top3 and other per-split keys
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Failure scenario. A CI script built from the manual's example indexes languages_top3 as a dict and errors out or silently reads null.
Where.docs/usermanuals/en/data/audit.md:160-165,forgelm/data_audit/_streaming.py:244-245,forgelm/data_audit/_aggregator.py:228-231,forgelm/data_audit/_streaming.py:107-113
Recommended fix. Regenerate the manual example (EN and TR) from a real report. -
CR-A11-065 (code, Low) — --pii-ml loads a 1.2 GB spaCy analyzer in the parent and again in every spawn worker, and analyses rows one at a time with every recogniser
severity Low · reachabilitydocumented-opt-in· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario.forgelm audit corpus/ --pii-ml --workers 3on a 3-split corpus peaks at about 4.8 GB RSS and spends about 3 s per worker reloading spaCy. On small corpora this makes the parallel run slower than the sequential one (4.0 s against 0.7 s here).
Where.forgelm/data_audit/_orchestrator.py:307-316,forgelm/data_audit/_orchestrator.py:382-386,forgelm/data_audit/_pii_ml.py:75-125,forgelm/data_audit/_pii_ml.py:237-239
Recommended fix. Release the parent's analyzer after pre-flight when workers > 1 (_get_presidio_analyzer.cache_clear()), or pre-flight only a cheap model-presence check in the parent. Passentities=list(_PRESIDIO_ENTITY_MAP)(about 8%). Batch rows throughBatchAnalyzerEngine.analyze_iteratorwith batch_size of about 32 (about 1.46x in total). Consider disabling unused spaCy pipes. Expected gain: about 1.2 G… -
CR-A11-066 (code, Low) — Per-row metadata (column names and keysets) has no bound, so the report grows linearly with unique keys and becomes 3.8x the input size
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · single reviewer · reproduced end to end
Failure scenario. A schema-chaotic or hostile JSONL file produces a governance report several times larger than the input, and a text summary dominated by one multi-megabyte drift line. That report is then inlined into compliance/data_governance_report.json (F-052).
Where.forgelm/data_audit/_aggregator.py:98-102,forgelm/data_audit/_aggregator.py:211-223,forgelm/data_audit/_croissant.py:162-182,forgelm/data_audit/_summary.py:401-402
Recommended fix. Cap the recorded columns and drift columns (for example the first 1000, plus a truncated-count field), and cap the keyset Counter (for example the top-N plus an overflow count). Truncate the text rendering. Expected gain: O(1) report size against linear growth in unique keys. -
CR-A11-067 (code, Low) — forgelm.data_audit eagerly imports optional numpy/datasketch/presidio at package import, so regex-only consumers and every spawn worker pay for it
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. Short audits, spawn workers and every webhook masking call that triggers the first import of the package pay a constant of about 0.18 s.
Where.forgelm/data_audit/_optional.py:54-62,forgelm/data_audit/__init__.py:37-59,forgelm/data_audit/_optional.py:21-89,forgelm/data_audit/__init__.py:35-73
Recommended fix. Defer the datasketch import into a function in_optional(for example_load_datasketch()called from_require_datasketch), keeping_HAS_DATASKETCHthroughimportlib.util.find_spec. Expected gain: about 65% of the package import time, roughly 0.18 s per process. -
CR-A11-068 (code, Low) — CI never runs the xxhash simhash backend or langdetect; the BLAKE2b and pure-Python simhash paths are never executed locally; backend changes near-duplicate decisions and is not recorded in the report
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · single reviewer · reproduced end to end
Failure scenario. A refactor that breaks the xxhash call or the pure-Python bit loop, or the langdetect integration, passes CI and local runs and fails only for users on the other install type.
Where.forgelm/data_audit/_simhash.py:55-86,forgelm/data_audit/_simhash.py:139-153,forgelm/data_audit/_streaming.py:25-41,pyproject.toml:140-148
Recommended fix. Add parametrised tests that force each backend (xxhash on/off, numpy on/off, with cache_clear), assert pure vs numpy parity, add a CI leg or the extra with langdetect, and record 'simhash_backend' in near_duplicate_summary. -
CR-A11-069 (code, Low) — Secret-detector tests cover about half of the nine families; slack, google and azure_storage are untested in the audit suite
severity Low · reachabilitydefault· intentintended-and-acceptable· confidence likely · single reviewer · reproduced end to end
Failure scenario. Deleting or mis-editing the Slack, Google or Azure regex leaves the full suite green while the gate silently stops firing for that family.
Where.forgelm/data_audit/_secrets.py:22-32,forgelm/data_audit/_secrets.py:62-113,tests/test_data_audit_phase12.py:58-117
Recommended fix. Add one parametrised test over SECRET_TYPES with a positive and a near-miss negative per family, asserting set(SECRET_TYPES) == set(_SECRET_PATTERNS). -
CR-A11-070 (code, Low) — MinHash tests rest on an exact-match stub LSH and loose real-library assertions; _count_leaked_rows_minhash is dead and untested
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · single reviewer · not reproduced (code trace)
Failure scenario. A regression in the real LSH integration (wrong num_perm pairing, threshold parameter) is not caught because the stub always answers correctly.
Where.forgelm/data_audit/_minhash.py:139-177,tests/test_data_audit_phase12.py:191-233,tests/test_data_audit_phase12.py:435-546
Recommended fix. Delete or test the unused function; add real-datasketch recall tests over seeded near-duplicate pairs at several Jaccard levels and boundary thresholds. -
CR-A11-071 (code, Low) — Pseudo-split discovery opens non-regular *.jsonl entries (FIFO, symlink to a device); the reader has no per-line size cap
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. dir with a.jsonl plus a FIFO b.jsonl:forgelm audit dirblocks until it is killed (FPY_TIMEOUT=15 gave exit 124 after 15 s). The /dev/zero symlink case was not run (it would exhaust memory) and is inferred from the code.
Where.forgelm/data_audit/_splits.py:74,forgelm/data_audit/_streaming.py:200
Recommended fix. Filter pseudo-splits with is_file() (and optionally refuse symlinks that leave the directory). Read lines with a size cap (readline(limit)), and count over-long lines as parse errors. -
CR-A11-072 (code, Low) — Audit streaming logs one WARNING per malformed JSONL line with no cap (about 100x log amplification from hostile input)
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · single reviewer · reproduced end to end
Failure scenario. A multi-GB scraped file with mostly invalid lines produces tens of GB of stderr, filling the CI log or disk.
Where.forgelm/data_audit/_streaming.py:214
Recommended fix. Log the first N (for example 10) at WARNING, then a single summary count, with the rest at DEBUG. -
CR-A11-073 (code, Low) — Cross-split pair key f'{a}{b}' collides for split names containing '', silently dropping a pair's leak result
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. Directory with a.jsonl and b__c.jsonl holding identical rows, plus a__b.jsonl and c.jsonl. The report has 5 pairs instead of 6. 'a__b__c' carries the (a__b, c) payload with leaked=0/0, and no leakage note is emitted. Renaming b__c to bc shows a__bc leaked=10/10 rate=100%.
Where.forgelm/data_audit/_orchestrator.py:128,forgelm/data_audit/_summary.py:466-494,forgelm/data_audit/_splits.py:66-85
Recommended fix. Key pairs with a non-ambiguous separator or structure: a list of {a, b, ...} objects, or a key format that escapes or rejects '__' in split names. At minimum, detect a key collision and log a WARNING. -
CR-A11-074 (code, Low) — Audit guide's documented text-column priority omits the instruction-pair precedence the extractor applies first
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · not reproduced (code trace)
Failure scenario. A row {text, instruction, output} is fingerprinted on instruction+output, not on text as documented. An operator reasoning from the guide misreads which content was compared across splits.
Where.docs/guides/data_audit.md:517-518,forgelm/data_audit/_streaming.py:116-163
Recommended fix. Document the full precedence (pairs, single columns, messages, half-pairs) in EN and TR, and state which fields of DPO/KTO rows are compared. -
CR-A11-075 (code, Low) — compute_minhash is documented to return None when datasketch is missing; it raises ImportError, and None means empty text
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A caller treats None as 'extra missing, fall back to simhash' and instead crashes, or treats an empty-text None as a missing dependency.
Where.docs/reference/library_api_reference.md:76,docs/reference/library_api_reference-tr.md:76,forgelm/data_audit/_minhash.py:18-23(confirmed),forgelm/data_audit/_minhash.py:46-51
Recommended fix. Change the doc cell: returns None for token-empty input; raises ImportError (install hint forgelm[ingestion-scale]) when datasketch is missing. -
CR-A11-076 (code, Low) — Signature rows for mask_secrets, compute_simhash, mask_pii and detect_pii omit parameters or misstate types
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A caller who needs counts for secrets writes their own parsing, or a typed wrapper pinned to the documented return type breaks at runtime.
Where.docs/reference/library_api_reference.md:71,docs/reference/library_api_reference.md:72,docs/reference/library_api_reference.md:74,docs/reference/library_api_reference.md:75
Recommended fix. Update the four rows to the real signatures. -
CR-A11-077 (code, Low) — Presidio ML-NER path (--pii-ml) is covered only by stubs; no test or CI job runs a real AnalyzerEngine
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced with stubs
Failure scenario. A Presidio API change, an entity-name change or a language-engine construction bug (NlpEngineProvider kwargs in _pii_ml.py:105-126) would reach users undetected. detect_pii_ml also swallows per-row ValueError/RuntimeError at DEBUG level only (_pii_ml.py:240-257), so a real failure shows up as zero ML coverage.
Where.tests/test_phase12_5.py:250-380,tests/test_phase12_5.py:663-711,tests/test_phase12_5.py:735-770,forgelm/data_audit/_pii_ml.py:115-122
Recommended fix. Add one mocked end-to-end test of audit_dataset(enable_pii_ml=True) (and the CLI --pii-ml path) asserting pii_summary/pii_severity merge and that _require_presidio runs before row scanning; add a nightly or extras CI job installing '.[dev,ingestion-pii-ml]' plus en_core_web_lg with a pytest.importorskip test that runs the real AnalyzerEngine on a known sentence and asserts which entity_types actu… -
CR-A11-078 (code, Low) — Secrets and PII in JSONL object keys are never scanned, yet are copied verbatim into data_audit_report.json, the Croissant card (name, @id, jsonPath) and stdout, while both gates report 'passed'
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A corpus exported from a per-user map, such as {"alice@corp.com": "..."}, or a config dump keyed by API key, is audited. Both gates pass. The operator commits data_audit_report.json to git and publishes croissant.json to the HF Hub, as the docs recommend. The emails and keys in it are now public, in a document the audit implicitly vouched for.
Where.forgelm/data_audit/_aggregator.py:98,forgelm/data_audit/_aggregator.py:147,forgelm/data_audit/_aggregator.py:159,forgelm/data_audit/_aggregator.py:211
Recommended fix. Run detect_secrets and detect_pii over each distinct column name and report the hits, for example as column_name_findings. Mask hits, or replace them with a hash, before writing columns, schema_drift_columns and Croissant fields. Alternatively, document that column names are copied verbatim and must be reviewed before publishing. Also correct gdpr_erasure.md:63. -
CR-A11-079 (code, Low) — Audit report column order follows hash-randomised frozenset iteration, so data_audit_report.json is not byte-identical across runs or worker counts for any multi-column corpus
severity Low · reachabilitydefault· intentcontract-violation· confidence confirmed · single reviewer · reproduced end to end
Failure scenario. A CI step pins the hash of data_audit_report.json, as the guide describes, for a chat or DPO corpus. The next run with identical data gets a different hash, and the gate fails spuriously. Teams then disable the comparison, losing the integrity signal the docs advertise. The failure mode is a false alarm; it never produces a false pass.
Where.forgelm/data_audit/_aggregator.py:99,forgelm/data_audit/_aggregator.py:211,forgelm/data_audit/_croissant.py:162,docs/guides/data_audit.md:601
Recommended fix. Iterate row keys in row order (for col in row: ...) or sort the columns before emitting them. Add a multi-column fixture, run under different PYTHONHASHSEED values, to test_data_audit_workers.py. -
CR-A11-080 (code, Low) — Dedup 'case folding' uses str.lower(): Turkish dotted/dotless I makes case-only variants of the same Turkish text look unrelated (Hamming 23-30 vs 0 for English)
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A Turkish corpus contains the same announcement once as an all-caps headline row and once in sentence case, in train and test. The audit reports no near-duplicate and no leak, whereas the equivalent English pair is reported at distance 0.
Where.forgelm/data_audit/_simhash.py:38-39
Recommended fix. Fold symmetrically before tokenising: NFKC, casefold(), drop U+0307, and map 'ı' to 'i'. This is lossy but symmetric across the dotted and dotless I forms. Add a Turkish case-variant test.
Done when
- Every finding above is fixed or closed with a reason (tick it here).
- Code fixes carry a test; doc fixes update the Turkish mirror in the same PR.
Found by the October 2026 ForgeLM code and documentation review against commit cab2947. Code links point at that commit; line numbers may have moved since. Finding IDs (CR-…, DOC-…, TECH-…) are stable references for this backlog.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity