Skip to content

feat(consolidate): audit-only near-duplicate cluster report — aelf doctor --consolidate (#1312) - #1313

Merged
github-actions[bot] merged 5 commits into
mainfrom
feat/issue-1312-consolidate-audit
Aug 4, 2026
Merged

feat(consolidate): audit-only near-duplicate cluster report — aelf doctor --consolidate (#1312)#1313
github-actions[bot] merged 5 commits into
mainfrom
feat/issue-1312-consolidate-audit

Conversation

@robotrocketscience

@robotrocketscience robotrocketscience commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Closes #1312. Refs #1176 proposal 4.

Audit surface only. No write path, per the operator ruling: the report is
funded, contraction is not.

What this is

aelf doctor --consolidate clusters active beliefs at the shipped dedup
predicate, picks each component's medoid, and reports what a contraction
would retire. Read-only — no edge inserted, no belief retired, no log row
written, and dedup.py stays audit-only.

New src/aelfrice/consolidate.py holds the algorithm; cli.py holds the
surface. Same division dedup.py already uses.

Why the write path is absent

Not an oversight and not scope-trimming. Proposal 4 cleared its
pre-registered kill gate — the thresholds are sound — and was still not funded
for the build, because the same run priced it:

polarity-only member pairs 0.17–0.24% of examined pairs
clusters containing one 1–2 of the 50 largest
beliefs a contraction would retire 996 of 44,594 (2.23%)

2.23% does not carry a high-risk write path, nor the SUPERSEDES direction
convention it would establish with nothing gating it — there are still 0
such edges in the store, which is exactly why the spec's stated prerequisite
read as moot when it was really unratified.

The kill check used the vocabularies relationship_detector already ships
(_NEGATION_TOKENS, _QUANTIFIER_TOKENS, _CONTRACTION_NEGATION_RE), so the
criterion is the contradiction lane's own and not one invented to pass.
Mechanical, no hand-labelling, no LLM.

Design notes worth reviewing

  • Predicate is reused, not reinvented. Jaccard ≥ jaccard_min AND
    Levenshtein ratio ≥ levenshtein_min, read from [dedup] config. A second
    predicate would make "what would contraction do" unfalsifiable.
  • Blocking, not O(n²). dedup budgets direct prefiltering at a ~1.6k
    median; at 44.5k that is ~991M pairs. Candidates share an order-4 shingle
    with df <= 32. Tightening that cap from 400 to 32 left the components
    bit-identical, so it is not load-bearing — and skipped high-df shingles are
    counted and printed, because a cap that does not report itself reads as
    full coverage.
  • Medoid, not min(member_ids). dedup.DuplicateCluster names its
    representative by smallest id, which is deterministic but arbitrary. The
    medoid is the member a contraction would actually keep. One of the tests
    exists specifically to fail if this degrades back into a copy of dedup's
    rule.
  • Output is pasteable. Aggregate counts only — no belief content, no ids,
    no paths — and a test asserts that.

A bug my own test found

The first draft guarded the early exit on MIN_COMPONENT_SIZE, so a
two-belief store reported n_duplicate_pairs = 0 when it plainly had one.
Clusters were unaffected, which is why it would have survived a happy-path
test. Guard is now len(rows) < 2; reverting it is mutation 3 below.

Verification

  • tests/test_consolidate.py: 20 passed. With test_dedup.py and
    test_benchmarks_dir.py: 88 passed.

  • Mutation-verified, not observed green — three mutations, three distinct
    failures:

    mutation fails
    medoid tiebreak <<= test_tie_breaks_on_id_ascending
    MIN_COMPONENT_SIZE 3 → 2 test_a_duplicate_pair_is_not_a_cluster (+ the constant pin)
    revert the two-belief guard test_a_duplicate_pair_is_not_a_cluster
  • The published 2.23% is reproducible from the shipped command, not from a
    scratch script — that was the point of putting it behind a product surface:

    clusters (size >= 3)  : 208
    beliefs in a cluster  : 1,204
    would remove          : 996 (2.23% of active)
    
  • CHANGELOG insert-only against main (0 removed lines); discretion grep on
    added lines and on commit messages clean; two atomic signed commits; branch
    FF on main.

Summary by Sourcery

Introduce an audit-only consolidation report via aelf doctor --consolidate that clusters near-duplicate beliefs using the existing dedup predicate and reports potential contraction impact without modifying the store.

New Features:

  • Add aelf doctor --consolidate CLI subcommand to run a consolidation audit over active beliefs.
  • Implement a consolidation algorithm that blocks candidate pairs via 4-gram shingles, forms duplicate components, selects a medoid per cluster, and returns an aggregate report of contraction effects.

Enhancements:

  • Ensure consolidation thresholds are validated and configurable via CLI flags, reusing dedup configuration defaults.
  • Guarantee deterministic, read-only behaviour for consolidation audits, with pasteable aggregate-only output and explicit reporting of blocked high-frequency shingles.

Documentation:

  • Document the new consolidation audit capability and its non-write-path nature in the v4 changelog, including its thresholds, blocking strategy, medoid definition, and measured reach.

Tests:

  • Add unit tests covering shingle generation, threshold validation, component size rules, medoid selection, arithmetic of removal counts, blocking-cap reporting, determinism, read-only behaviour, report formatting, and the doctor --consolidate CLI surface.

Summary by CodeRabbit

  • New Features

    • Added aelf doctor --consolidate to identify groups of likely duplicate beliefs.
    • Reports representative entries, potential retirements, matching thresholds, cluster details, and scan statistics.
    • Provides deterministic results with safeguards for large candidate sets.
  • Bug Fixes

    • Invalid consolidation thresholds now produce clear command errors.
  • Documentation

    • Added unreleased documentation describing the consolidation audit.
  • Safety

    • The diagnostic is read-only and does not modify stored beliefs or relationships.

New `consolidate.py` plus `aelf doctor --consolidate`. Clusters active
beliefs at the shipped dedup predicate (Jaccard >= jaccard_min AND
Levenshtein ratio >= levenshtein_min), picks each component's medoid,
and reports how many beliefs a contraction would retire. Read-only: no
edge is inserted, no belief is retired, no log row is written.

Reuses dedup.py's predicate rather than inventing one, so the report
says what contraction would do at the thresholds the product already
ships. Candidate pairs come from 4-gram blocking with a df cap instead
of dedup's O(n^2) prefilter, which is ~991M pairs at 44.5k beliefs;
skipped high-df shingles are counted and reported, since a blocking cap
that does not report itself reads as full coverage.

Contraction is deliberately not built. The operator funded the report
only, on the measurement that it would retire 996 of 44,594 active
beliefs (2.23%) — too little to carry a write path or to establish the
SUPERSEDES direction convention with nothing gating it.

The medoid tiebreak and the size->=3 floor are mutation-verified rather
than observed green: flipping the tiebreak comparison, lowering the
floor, and reverting the two-belief guard each fail a different test.
@robotrocketscience robotrocketscience added the author-Setr PR coordination mutex label Aug 4, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@robotrocketscience robotrocketscience added the attn:review Needs review (PR open, awaiting reviewer) label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 553b855d-be75-4dc1-8853-4b81b1cc1c61

📥 Commits

Reviewing files that changed from the base of the PR and between 600b648 and b9bfc29.

📒 Files selected for processing (2)
  • src/aelfrice/cli.py
  • tests/test_consolidate.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/test_consolidate.py
  • src/aelfrice/cli.py

📝 Walkthrough

Walkthrough

Adds aelf doctor --consolidate, a deterministic read-only audit for near-duplicate active beliefs. It uses bounded shingle blocking, similarity thresholds, connected components, deterministic medoids, aggregate reporting, and no store mutations.

Changes

Consolidation audit

Layer / File(s) Summary
Audit engine
src/aelfrice/consolidate.py
Adds bounded 4-gram candidate generation, Jaccard and Levenshtein filtering, deterministic components and medoids, threshold validation, and aggregate audit metrics.
Doctor CLI integration
src/aelfrice/cli.py, src/aelfrice/consolidate.py, CHANGELOG/v4.md
Adds doctor --consolidate, threshold options, formatted aggregate output, invalid-threshold handling, and an Unreleased changelog entry.
Audit and CLI validation
tests/test_consolidate.py
Tests clustering rules, medoid tie-breaking, blocking counts, determinism, read-only behavior, report privacy, and CLI success and error paths.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant DoctorCLI
  participant MemoryStore
  participant ConsolidationAudit
  Operator->>DoctorCLI: run doctor --consolidate
  DoctorCLI->>MemoryStore: open store
  DoctorCLI->>ConsolidationAudit: audit active beliefs with thresholds
  ConsolidationAudit-->>DoctorCLI: return aggregate report
  DoctorCLI-->>Operator: print read-only report
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the audit-only consolidation report and its CLI surface.
Description check ✅ Passed The description explains the purpose, scope, linked issue, design, verification, tests, and deliberate absence of writes.
Linked Issues check ✅ Passed The implementation satisfies the audit-only clustering, blocking, medoid, reporting, determinism, reproducibility, and no-write requirements in [#1312].
Out of Scope Changes check ✅ Passed The changes remain within scope and add no contraction writes, edges, deletions, log rows, undo path, or changes to dedup.py.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-1312-consolidate-audit

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

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an audit-only aelf doctor --consolidate command and supporting clustering algorithm to report the impact of a hypothetical consolidation (contraction) of near-duplicate beliefs, reusing dedup thresholds, blocking via 4-gram shingles, selecting medoids deterministically, and ensuring the entire flow is read-only and safely reportable.

Sequence diagram for aelf doctor --consolidate audit flow

sequenceDiagram
    actor Operator
    participant CLI as cli__cmd_doctor
    participant ConsolidateCmd as cli__cmd_doctor_consolidate
    participant Store as MemoryStore
    participant Algo as consolidation_audit
    participant Formatter as format_consolidation_report

    Operator->>CLI: aelf doctor --consolidate [overrides]
    CLI->>ConsolidateCmd: _cmd_doctor_consolidate(args, out)
    ConsolidateCmd->>Store: _open_store()
    ConsolidateCmd->>Algo: consolidation_audit(store, jaccard_min, levenshtein_min, max_shingle_df)
    Algo-->>ConsolidateCmd: ConsolidationReport
    ConsolidateCmd->>Store: close()
    ConsolidateCmd->>Formatter: format_consolidation_report(report)
    Formatter-->>ConsolidateCmd: report_text
    ConsolidateCmd->>Operator: print(report_text)
    ConsolidateCmd-->>CLI: return 0 / 1
Loading

File-Level Changes

Change Details Files
Introduce consolidation clustering algorithm that reuses dedup similarity thresholds, uses 4-gram blocking, forms components, picks medoids, and summarizes impact as an audit-only report.
  • Create ConsolidationCluster and ConsolidationReport dataclasses to represent components and the overall audit.
  • Implement token shingle extraction with fixed width and special handling for short beliefs.
  • Build candidate pairs via 4-gram postings lists with a configurable document-frequency cap and explicit counting of skipped shingles.
  • Filter candidates using existing Jaccard and Levenshtein ratio functions and collapse duplicate pairs into connected components via an order-independent union-find.
  • Apply a minimum component size (>=3) and compute medoids using summed Levenshtein distance with an id-ascending tiebreak.
  • Compute aggregate metrics including would-remove count and share-of-store percentage, and expose an audit-only formatting function that outputs only counts and thresholds.
src/aelfrice/consolidate.py
Wire a new aelf doctor --consolidate CLI surface that runs the consolidation audit with optional threshold overrides and prints the formatted report, remaining strictly read-only.
  • Add --consolidate and tuning flags for Jaccard, Levenshtein, and max shingle DF to the doctor subcommand parser.
  • Dispatch doctor to _cmd_doctor_consolidate when the consolidate flag is present.
  • Load the dedup config as the default thresholds, apply CLI overrides, and validate them via the consolidation audit function.
  • Handle malformed thresholds by printing a clear error to stderr and exiting with code 1; otherwise print the consolidation report to the provided output stream and exit 0.
  • Ensure the store is always closed via a try/finally around the consolidation audit call.
src/aelfrice/cli.py
Document the new audit-only consolidation capability in the v4 changelog, including thresholds, medoid definition, blocking strategy, safety posture, and measured impact.
  • Add a detailed changelog entry describing the behavior of aelf doctor --consolidate, including reuse of dedup predicate and medoid selection.
  • Explain the absence of a write path and the rationale based on measured reach and lack of SUPERSEDES edges.
  • Describe the blocking approach, DF cap, and the fact that skipped shingles are counted and reported.
  • Note that output is aggregate-only and paste-safe, and that the published 2.23% figure is reproducible from the shipped command.
CHANGELOG/v4.md
Add unit tests for the consolidation algorithm, report formatting, and CLI surface, emphasizing distinguishing cases for medoid selection, component size floor, determinism, read-only behavior, and threshold validation.
  • Introduce helpers and fixtures to populate a MemoryStore with beliefs and shared prefixes for controlled distance measurements.
  • Test shingle generation edge cases (empty tokens, short beliefs, and window size).
  • Verify threshold validation raises ValueError for out-of-range Jaccard, Levenshtein, and max shingle DF values.
  • Assert that duplicate pairs are found but components of size 2 are not reported as clusters, and that size >=3 components are reported with correct counts.
  • Add distinguishing tests for medoid tiebreak (id-ascending) and centrality vs smallest-id, plus arithmetic for would-remove counts and share-of-store.
  • Check blocking cap reporting, read-only behavior (no beliefs or edges written), determinism of repeated audits and formatted output, and that report text contains no belief IDs or content but does mention read-only behavior.
  • Add CLI integration tests to ensure doctor --consolidate runs successfully, prints expected metrics, and exits 1 on malformed threshold input.
tests/test_consolidate.py

Assessment against linked issues

Issue Objective Addressed Explanation
#1312 Implement a read-only consolidation algorithm module (src/aelfrice/consolidate.py) that clusters active beliefs using the shipped dedup predicate (Jaccard ≥ jaccard_min AND Levenshtein ratio ≥ levenshtein_min), uses 4-gram blocking with a document-frequency cap that is counted and reported, restricts clusters to components of size ≥ 3, selects a deterministic medoid (argmin of summed Levenshtein distance, tie-broken id-ASC), and exposes deterministic aggregate data via a ConsolidationReport.
#1312 Add a CLI surface aelf doctor --consolidate that runs the consolidation audit read-only against a real store, reusing [dedup] config thresholds by default, optionally allowing threshold and df-cap overrides, and printing only aggregate counts (including component count, beliefs-in-components, largest component size, would-remove count, and the df cap as number of skipped 4-grams) with no belief content, ids, paths, or write-path behavior.
#1312 Add tests that pin the key behavioral guarantees of consolidation: medoid tiebreak on id-ASC, exclusion of size-2 components (size ≥ 3 restriction), reporting of skipped high-df shingles, read-only behavior (no edges/beliefs/logs written), deterministic output for a fixed store, and aggregate-only report rendering; and ensure the reported numbers are reproducible from the shipped command as per #1176.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

PR-size soft cap

This PR is over the advisory size threshold:

  • 813 changed lines (limit: 200)
  • 4 changed files (limit: 3)

Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated attn:merge-conflict cycles (see #602). When practical, split into smaller PRs that each touch a focused surface.

This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the size:override label and this comment will be removed on the next push.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:Garsecg:2026-08-04T02:17:14Z]

The existing assertions compare a belief count and an edge count, which
an in-place UPDATE leaves untouched and which inspect two tables out of
the whole schema. Injecting 'UPDATE beliefs SET alpha = alpha + 1.0'
into consolidation_audit left the suite at 20 passed; with the
total_changes delta it fails. Guards the PR's central safety claim
(#1312).
…e df-cap boundary

Three fields the report is priced on had no distinguishing coverage;
each mutation below left the suite at 20 passed before this commit and
fails after it.

- largest_cluster: max(...) -> min(...). The only existing assertion is
  on a single-cluster fixture, where max == min. Pinned on the
  two-cluster fixture (sizes 4 and 3).
- share_of_store: denominator n_beliefs_scanned -> n_beliefs_in_clusters,
  and the 100.0 percentage factor -> 1.0. Both were free to change; a
  new fixture adds an unclustered belief so the two denominators differ.
- max_shingle_df: '>' -> '>='. An off-by-one changes which pairs are
  examined and therefore the published share (#1312).
…rge store

The audit prints nothing until it finishes and has no progress output or
budget knob, unlike the sibling doctor --dedup which ships
max_candidate_pairs. Cost is dominated by the medoid phase, which is
quadratic in both the largest cluster's size and belief length, so
runtime does not track the belief count. Says so in the help text rather
than leaving the silence unexplained (#1312).
@robotrocketscience

Copy link
Copy Markdown
Owner Author

Review — verified, three fixes pushed to this branch

Reviewed the diff, re-ran the PR body's mutation claims, and measured the audit against a copy of the live store. Recommendation: merge once CI re-greens on the three commits I pushed (96ebdb93, 2c9a6286, b9bfc292 — all signed, FF on 600b648c, discretion grep clean on added lines).

Verified good — recorded so it isn't re-litigated

  1. The mutation-testing claim in the PR body is accurate. Applied all three named mutations to a clean checkout of 600b648c: (a) medoid tiebreak <<= fails TestMedoidTiebreak::test_tie_breaks_on_id_ascending; (b) MIN_COMPONENT_SIZE 3→2 fails test_a_duplicate_pair_is_not_a_cluster and test_floor_constant_is_three; (c) reverting the two-belief guard fails test_a_duplicate_pair_is_not_a_cluster. Degrading _medoid to return member_ids[0] fails test_medoid_is_central_not_smallest_id. AC5 is genuinely met.
  2. AC6 reproduces exactly. On a .backup copy of the live store (44,594 active beliefs): 198 4-grams over df=32 skipped / 116,455 candidate pairs / 5,797 duplicate pairs / 208 clusters / 1,204 beliefs in a cluster / largest 90 / would remove 996 (2.23% of active) — identical to the issue, the PR body and the CHANGELOG, and re-derived independently through a hand-written reimplementation of the same phases.
  3. Audit-only is true at the byte level. SHA-256 of the store file is identical before and after a full open + two audit passes + close, with no -wal/-shm left behind.

Fixed on this branch

96ebdb93 — the read-only claim had no real guard (this was the one substantive defect).
TestReadOnly::test_audit_writes_nothing compared a belief count and an edge count. Row counts are blind to an in-place UPDATE, and they inspect two tables out of the whole schema. Injecting store._conn.execute("UPDATE beliefs SET alpha = alpha + 1.0") into consolidation_audit() left the suite at 20 passed. A posterior bump, an ingest_log append, a lock_level flip or a belief_corroborations re-point would all have passed silently — which is exactly the "Out of scope — do not build" surface in #1312. Now asserts a sqlite3.Connection.total_changes delta of zero; the shipped implementation yields 0, the mutation above yields 3.

2c9a6286 — three fields the report is priced on were unpinned. Each mutation left the suite at 20 passed before this commit and fails after it:

  • largest_cluster: max(...)min(...). The only existing assertion is on a single-cluster fixture where max == min, so it was vacuous. Now pinned on the two-cluster fixture (sizes 4 and 3). This is AC2.
  • share_of_store: denominator n_beliefs_scannedn_beliefs_in_clusters, and the 100.0 factor→1.0. Both were free to change silently, and this property is the headline 2.23%. The new fixture adds an unclustered belief so the two candidate denominators differ (62.5% vs 71.43%).
  • max_shingle_df: >>=. An off-by-one on the blocking cap changes which pairs are examined and therefore the published share.

b9bfc292 — help-text warning. The audit prints nothing until it finishes. Measured on the 44.5k-belief store: 93.5 s total, of which the medoid phase is 64.8 s (69%); the single largest component (90 members) accounts for 29.7 s on its own, while blocking + tokenisation + component-building together are 1.6 s. Cost is O(k² · L²) in the largest cluster's member count and belief length, so runtime does not track the belief count. The help text now says so.

Not fixed — author's call

The medoid phase is the only phase with no budget knob, unlike the sibling doctor --dedup, which ships max_candidate_pairs plus a truncated flag. A store that accumulates one ~300-member cluster of 1,000-char near-duplicates would sit inside _medoid for tens of minutes with no output and no way to bound it (this store already has a 90-member cluster and a 14,360-char belief). A max_medoid_members cap falling back to min(member_ids) above the threshold, surfacing a medoid_truncated flag, would mirror dedup — but it changes reported output, so it is a behaviour decision rather than a review fix. Fine as a follow-up; not blocking.

@robotrocketscience robotrocketscience added the ready-to-merge Trigger merge-train: FF main to this PR's head label Aug 4, 2026
@github-actions
github-actions Bot merged commit b9bfc29 into main Aug 4, 2026
36 checks passed
@github-actions github-actions Bot removed the ready-to-merge Trigger merge-train: FF main to this PR's head label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

merge-train: merged b9bfc29main via FF push.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:Garsecg:2026-08-04T03:04:56Z]

robotrocketscience added a commit that referenced this pull request Aug 4, 2026
test_doctor_consolidate_runs resolves thresholds through
load_dedup_config(), which walks up from the working directory, so the
assertion depended on where pytest was launched: a developer with
[dedup] levenshtein_min set at or above the repo got a failure with
nothing to do with the code. CI green, local red — the same shape as
#1295, one release later.

Written before #1313 merged and missed the push, so it did not land
with the rest of that PR.

Pinned by chdir to a scratch directory, with _assert_no_ambient_config
verifying the walk is clean rather than assuming it — resolving first,
because load_dedup_config resolves its start while Path.parents is
lexical. Two arms then cover the TOML tier, which had none: [dedup]
reaches the audit, and --consolidate-* outrank it.

Every arm terminates by construction: in-process, no subprocess, no
waiting.
robotrocketscience added a commit that referenced this pull request Aug 4, 2026
test_doctor_consolidate_runs resolves thresholds through
load_dedup_config(), which walks up from the working directory, so the
assertion depended on where pytest was launched: a developer with
[dedup] levenshtein_min set at or above the repo got a failure with
nothing to do with the code. CI green, local red — the same shape as
#1295, one release later.

Written before #1313 merged and missed the push, so it did not land
with the rest of that PR.

Pinned by chdir to a scratch directory, with _assert_no_ambient_config
verifying the walk is clean rather than assuming it — resolving first,
because load_dedup_config resolves its start while Path.parents is
lexical. Two arms then cover the TOML tier, which had none: [dedup]
reaches the audit, and --consolidate-* outrank it.

Every arm terminates by construction: in-process, no subprocess, no
waiting.
robotrocketscience added a commit that referenced this pull request Aug 4, 2026
test_doctor_consolidate_runs resolves thresholds through
load_dedup_config(), which walks up from the working directory, so the
assertion depended on where pytest was launched: a developer with
[dedup] levenshtein_min set at or above the repo got a failure with
nothing to do with the code. CI green, local red — the same shape as
#1295, one release later.

Written before #1313 merged and missed the push, so it did not land
with the rest of that PR.

Pinned by chdir to a scratch directory, with _assert_no_ambient_config
verifying the walk is clean rather than assuming it — resolving first,
because load_dedup_config resolves its start while Path.parents is
lexical. Two arms then cover the TOML tier, which had none: [dedup]
reaches the audit, and --consolidate-* outrank it.

Every arm terminates by construction: in-process, no subprocess, no
waiting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attn:review Needs review (PR open, awaiting reviewer) author-Setr PR coordination mutex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(consolidate): audit-only near-duplicate cluster report (aelf doctor --consolidate) — #1176 proposal 4, audit shape only

1 participant