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-081 (code, Low) — Unclosed Markdown code fence is not stripped, so truncated code-only rows get prose quality flags
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Failure scenario. A row reading "```python\ndef f(x):\n return x*2\n..." with no closing fence is flagged ['low_alpha_ratio','low_punct_endings','abnormal_mean_word_length'], although the docs say code-only rows get zero flags. The flags are advisory only and no row is dropped.
Where.forgelm/data_audit/_quality.py:133-139(confirmed), `docs/guides/data_audit.md:388-393`, `forgelm/data_audit/_quality.py:133-137`, `forgelm/data_audit/_quality.py:212-216`
Recommended fix. Follow CommonMark and drop an unclosed fenced block to the end of the row. If the current behaviour is intended, state the exception in the guide. -
CR-A11-082 (code, Low) — The Croissant card doc says url is the as-typed input path; the code emits a slugged basename
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Failure scenario. A publisher trusts the doc and expects url to carry the relative path or Hub ID. The card instead holds a slug that resolves nowhere.
Where.docs/usermanuals/en/data/croissant-card.md:65,docs/usermanuals/tr/data/croissant-card.md:65,forgelm/data_audit/_croissant.py:186-197
Recommended fix. Change the doc row (EN and TR) to 'slugged basename of the input path; hand-edit to a public URL at publish time', or emit the relative as-typed path when it is not absolute. -
CR-A11-083 (code, Low) — _audit.py module docstring still lists only the secrets gate as an exit-3 cause
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Failure scenario. A maintainer reading the module header believes a PII-only corpus cannot exit 3 and mis-wires a test or a docs page.
Where.forgelm/cli/subcommands/_audit.py:13-15
Recommended fix. Add the critical-tier PII gate (credit_card/iban) to the exit-3 bullet. -
CR-A11-084 (code, Low) — Cross-split leak_rate denominator excludes empty rows, while the guide describes it as a fraction of split rows
severity Low · reachabilitydefault· intentintended-and-acceptable· confidence likely · single reviewer · reproduced end to end
Failure scenario. The test split has 20 rows, 10 of them empty, and 7 leak. Its sample_count is 20 but leak_rate_test is 0.7, not 0.35.
Where.forgelm/data_audit/_orchestrator.py:78-80,forgelm/data_audit/_orchestrator.py:115
Recommended fix. Say in the guide that the denominator counts non-empty rows, or emit the denominator in the pair payload. -
CR-A11-086 (code, Low) — sft.md (EN+TR) sends operators to a 'rendered-sample preview' in forgelm audit that does not exist; audit has no tokenizer input and reports no sample text
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · independently confirmed · reproduced end to end
Failure scenario. An operator with rising loss after a base-model switch follows the documented step, runs forgelm audit, and finds no rendered sample. The diagnostic the docs promise cannot be run, and the actual training format ([ROLE] text, all tokens trained) stays hidden.
Where.docs/usermanuals/en/training/sft.md:117,docs/usermanuals/tr/training/sft.md:117,forgelm/data_audit/_orchestrator.py:227-240,forgelm/data_audit/_types.py:133-152
Recommended fix. Either remove or rewrite the two warnings in EN and TR, for example pointing to a dry-run that prints prepare_dataset's first formatted row, or add a real preview: the audit takes --config/--model and renders one formatted, tokenized row per split. -
CR-A11-087 (code, Low) — The PII-gate 'default is on at the dispatch seam' test checks the wrong function, so a fail-open getattr default in _run_audit_cmd survives
severity Low · reachabilityunreachable· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Where.tests/test_audit_pii_gate.py:~220-229,forgelm/cli/subcommands/_audit.py:~359,tests/test_audit_secrets_gate.py:~139-145
Recommended fix. Mirror the secrets test: patch forgelm.cli._run_data_audit, call _run_audit_cmd(SimpleNamespace(input_path='x'), 'text'), and assert fake.call_args.kwargs['allow_pii'] is False. -
CR-A11-088 (code, Low) — Introduction promises 'conformity declaration scaffolding'; the compliance pages say ForgeLM generates none, and no code or template exists
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · not reproduced (code trace)
Failure scenario. A compliance buyer expects a declaration-of-conformity scaffold from the toolkit and finds none, contrary to the front-page promise.
Where.docs/usermanuals/en/getting-started/introduction.md:59,docs/usermanuals/tr/getting-started/introduction.md:33,docs/usermanuals/en/getting-started/introduction.md:52,docs/usermanuals/en/compliance/overview.md:61
Recommended fix. Replace it with 'QMS SOP templates (docs/qms/)' or drop the claim, and qualify 'opt-in via YAML'. -
CR-A11-089 (code, Low) — 'audit_dataset: each call is self-contained' is not literally true: process-wide analyzer cache and aliased module-level Croissant context leak between calls and threads
severity Low · reachabilitydocumented-opt-in· intentcontract-violation· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A notebook or service audits several corpora on a thread pool with enable_pii_ml=True. Each thread's first cache miss loads its own about 600 MB spaCy model concurrently: 4 threads reach about 3 GB peak, and 16 threads can OOM a CI runner. Separately, code that post-processesreport.croissant['@context']['data']['@type']before publishing permanently changes the @context of every Croissant card the process emits afterwards (t9.py: the second call shows '@type': 'MUTATED-BY-CALLER').
Where.docs/reference/library_api_reference.md:253,docs/reference/library_api_reference-tr.md:253,forgelm/data_audit/_pii_ml.py:75,forgelm/data_audit/_pii_ml.py:159
Recommended fix. Use copy.deepcopy(_CROISSANT_CONTEXT), or freeze it with MappingProxyType and nested tuples. Guard analyzer construction with a lock, or construct once before scanning in the calling thread. Replace the global cache_clear() with a targeted eviction, or drop it since failures are not cached by lru_cache anyway. Reword the concurrency row: thread-safe for results, process-wide analyzer cache, memor… -
CR-A11-090 (code, Low) — audit_dataset(workers>1) called from a script without an
if __name__ == '__main__'guard hangs indefinitely; the library reference does not mention the spawn requirement
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A CI scriptaudit.pycontainsimport forgelm; forgelm.audit_dataset('data/', workers=2)with no main guard. Runningpython audit.pyloops forever: 490 'RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase' tracebacks in 90 s, no report and no exit, until the job's timeout kills it.
Where.forgelm/data_audit/_orchestrator.py:382-386,forgelm/data_audit/_orchestrator.py:386,docs/reference/library_api_reference.md:69,docs/reference/library_api_reference.md:253
Recommended fix. Document the main-guard requirement for workers>1 in the library reference (EN and TR) and in the docstring. Optionally detect when the call runs inside a spawn child that is still bootstrapping (multiprocessing.current_process().name != 'MainProcess' with no parent pool), or catch the bootstrapping case and raise a clear error instead of hanging. -
CR-A11-091 (code, Low) — Pseudo-split mode under-counts near-duplicates: duplicates spread across the shards of one corpus are reported only as 'leakage', with advice to re-shuffle, while the same run calls leakage meaningle…
severity Low · reachabilitydefault· intentintended-but-harmful· confidence likely · single reviewer · reproduced end to end
Failure scenario. An operator audits an HF export (train-00000-of-00004.jsonl and so on) to measure duplication before training on the union of the shards. The report shows 3 near-duplicate pairs, while the corpus actually holds 15, so 80% are missed. The real duplicates show up only as 'leakage' between shards, together with re-shuffle advice that does not apply to a single training corpus. The operator may then train on the duplicated data, or act on the wrong advice. No gate is involved (near-duplicates never…
Where.forgelm/data_audit/_splits.py:66-84,forgelm/data_audit/_orchestrator.py:401-405,forgelm/data_audit/_orchestrator.py:437-444,forgelm/data_audit/_summary.py:102-118
Recommended fix. In pseudo-split mode, also run near-duplicate detection over the union of all pseudo-splits, or replace the pairwise leakage with that pass, as in recommendation (c) of the companion performance finding. Report cross-shard pairs under near_duplicate_summary, and suppress or reword the 're-shuffle splits' leakage note when the split layout is pseudo. Document in data_audit.md:515, its TR mirror an… -
CR-A11-092 (code, Low) — Risk Treatment Plan R-01 relies on a 'pre-flight review of flagged rows' the audit report cannot support (no row identifiers); R-03's audit treatment does not address the risk it describes
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Failure scenario. A Data Steward performing R-01's pre-flight review gets a report saying credit_card=1, github_token=1, near_duplicate_pairs=1 and quality flags=3 for a 5-row train split, with nothing identifying which rows. On a real corpus they must re-implement the detectors themselves to find the rows, so the documented review is not done as written while the residual risk is recorded as Med×Low.
Where.docs/qms/risk_treatment_plan.md:48,docs/qms/risk_treatment_plan-tr.md:49,docs/qms/risk_treatment_plan.md:70,docs/qms/risk_treatment_plan-tr.md:71
Recommended fix. Either emit bounded per-finding row locators (split, line number, family; no raw values) or reword R-01 so the deployer locates rows with their own tooling, and justify the residual rating on that basis. Narrow R-03's audit bullet to 'credentials inside the training corpus' and cite config-review / secret-store controls for configs. -
CR-A11-093 (code, Low) — audit_dataset's missing-extra exception is untested end to end; the tests accept any ImportError subclass, so the documented OptionalDependencyError contract cannot be checked
severity Low · reachabilitydefault· intentcontract-violation· confidence likely · independently confirmed · reproduced end to end
Where.forgelm/data_audit/_orchestrator.py:316,forgelm/data_audit/_minhash.py:18,forgelm/data_audit/_pii_ml.py:150,forgelm/cli/subcommands/_audit.py:222
Recommended fix. Add to tests/test_data_audit_phase12.py::TestMinHashMissingExtra a test that monkeypatches audit_mod._optional._HAS_DATASKETCH False and calls audit_dataset(path, dedup_method='minhash'). It should assert type(exc) is the contract class (OptionalDependencyError if the docs are right, ImportError if the docs are fixed), assert the message contains 'forgelm[ingestion-scale]', and assert that no out… -
CR-A11-094 (code, Info) — Small per-row costs in the default audit path: the alpha-ratio check walks characters in Python, and the card-issuer test scans about 530 prefixes linearly
severity Info · reachabilitydefault· intentintended-and-acceptable· confidence likely · single reviewer · reproduced end to end
Failure scenario. No failure. The default CLI audit is about 7% slower than needed, and digit-heavy corpora pay about 10 µs per digit-run candidate.
Where.forgelm/data_audit/_quality.py:142-148,forgelm/data_audit/_pii_regex.py:121-142
Recommended fix. Use the split/map form for the alpha ratio (about 7% of default audit wall time). Index the issuer prefixes in a dict from prefix string to lengths and probe digits[:1] through digits[:4] (about 20x per candidate). Both changes are optional. -
CR-A11-095 (code, Info) — Audit report atomic write silently sets data_audit_report.json to 0600 (undocumented, untested)
severity Info · reachabilitydefault· intentintended-and-acceptable· confidence likely · independently confirmed · reproduced end to end
Failure scenario. CI shares the audit directory between users or jobs. A report written by a rerun becomes unreadable to the other principal because of the 0600 mode. On an NFS or SMB output directory, the dir fsync raises OSError and a good audit is reported as an IO failure (exit 1) by _audit.py:212-220. The mode change reproduced; the dir-fsync failure was not reproduced because it needs such a filesystem.
Where.forgelm/data_audit/_orchestrator.py:141-194,forgelm/data_audit/_orchestrator.py:464-494,tests/test_data_audit.py:762-785,tests/test_data_audit.py:853-862
Recommended fix. chmod the temp file to the destination's old mode or 0o666 & ~umask before replace. Wrap the directory fsync in the same except OSError as the open. -
CR-A11-096 (code, Info) — Docstring says backend is 'decided at import time' but _token_digest reads the flag per cache miss; lru_cache makes a post-import toggle silently stale
severity Info · reachabilityundocumented· intentcontract-violation· confidence likely · independently confirmed · not reproduced (code trace)
Where.forgelm/data_audit/_simhash.py:56-79
Recommended fix. Reword to 'resolved from _optional on each cache miss; clear the cache after changing it'. No performance effect. -
CR-A11-097 (code, Info) — 'Pin num_perm' advice is not actionable from the CLI the notebook uses
severity Info · reachabilitydefault· intentintended-but-harmful· confidence likely · single reviewer · reproduced end to end
Failure scenario. A CLI user who wants a deterministic MinHash configuration looks for a way to pin num_perm and finds none inforgelm audit --help. The report always records num_perm=128, so the advice is effectively a no-op for CLI users.
Where.notebooks/data_curation.ipynb:302,docs/guides/data_audit.md:300-302,forgelm/cli/subcommands/_audit.py:340-355
Recommended fix. Either add--num-permtoforgelm audit, or reword the advice to point at forgelm.audit_dataset(minhash_num_perm=...) and note that the CLI always uses 128. -
CR-A11-098 (code, Info) — Stale docstring: _build_croissant_metadata says the card exposes 'version'
severity Info · reachabilitydefault· intentcontract-violation· confidence likely · single reviewer · reproduced end to end
Failure scenario. A maintainer reading the docstring believes version is emitted.
Where.forgelm/data_audit/_croissant.py:92
Recommended fix. Change the docstring to name, description, url, datePublished. -
CR-A11-099 (code, Info) — Performance guide says audit_dataset(workers=...) gives parallel I/O over multiple corpora; it only fans out the splits of one source
severity Info · reachabilitydefault· intentcontract-violation· confidence likely · independently confirmed · reproduced end to end
Failure scenario. A caller auditing many single-file corpora in a loop sets workers=8 per call, expecting parallelism across corpora. Each call still runs sequentially.
Where.docs/guides/performance.md:187,docs/guides/performance-tr.md:183,forgelm/data_audit/_orchestrator.py:227-228,forgelm/data_audit/_orchestrator.py:282-290
Recommended fix. State that workers parallelises the splits of one directory input, and advise process-level parallelism across corpora (as the verify_audit_log sentence already does). -
CR-A11-100 (code, Info) — The audit envelope key set is not pinned against json-output.md, and the OSError (exit 1) path of _run_data_audit is untested
severity Info · reachabilitydefault· intentintended-and-acceptable· confidence likely · independently confirmed · reproduced end to end
Where.forgelm/cli/subcommands/_audit.py:212-221,forgelm/cli/subcommands/_audit.py:247-290,tests/test_cli_subcommands.py:99-123,tests/test_verification_toolbelt.py:1555
Recommended fix. Add the exact-key-set test (gap 2 below) and a missing-path test. Treat the already-reported envelope contract defects (error key on gate failure, absolute paths) as the first thing that test will catch. -
CR-A11-101 (code, Info) — Published xxh3-vs-BLAKE2b figures (~1.3x raw, ~1.05x end-to-end) are not reproducible; they sit in code docstrings and EN/TR guides and the shipped end-to-end arm is dead
severity Info · reachabilityundocumented· intentintended-but-harmful· confidence likely · single reviewer · reproduced end to end
Where.forgelm/data_audit/_optional.py:13-16,forgelm/data_audit/_simhash.py:61-66,docs/guides/data_audit.md:263-271,docs/guides/data_audit-tr.md:267-272
Recommended fix. Re-measure with the corrected toggle (_optional._HAS_XXHASH, as the _simhash.py:78 binding reads) on a workload with many unique tokens, state the workload and the xxhash/Python versions, and replace the 1.3x/1.05x text in the three code/doc sites (EN and TR) with the measured, workload-qualified figures; point the bench script at forgelm.data_audit._optional. Expected order of gain: none for run…
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