#12960·weaviate

[HFresh] Stale posting is retained after the seven-bit generation counter wraps from 127 to 1

Author: leemeiiCreated Sep 7, 2026Updated Sep 7, 2026
Labelsbugcommunity

How to reproduce this bug?

python
#!/usr/bin/env python3

import subprocess
from pathlib import Path

WEAVIATE_SRC = Path("/path/to/weaviate")
GO = "go"

PACKAGE = "./adapters/repos/db/vector/hfresh"

def run(test_name):
    command = [
        GO,
        "test",
        "-mod=mod",
        PACKAGE,
        "-run",
        test_name,
        "-count=1",
        "-v",
    ]

    result = subprocess.run(
        command,
        cwd=WEAVIATE_SRC,
        text=True,
        capture_output=True,
    )

    print(result.stdout, end="")
    if result.stderr:
        print(result.stderr, end="")

    return result.returncode


target_code = run(
    "^TestAuditHFreshVersionWrapRetainsStalePosting$"
)

control_code = run(
    "^TestAuditHFreshVersionNoWrapRemovesOlderPosting$"
)

if target_code == 1 and control_code == 0:
    print("BUG_REPRODUCED")
else:
    print("BUG_NOT_REPRODUCED")

What is the expected behavior?

When the generation counter wraps from 127 to 1, generation 127 must be recognized as the immediately preceding generation and its stale posting must be removed.

Expected result for the wrapped case:

current_generation=1
control_removed=True
search_ids=[]

For the non-wrapped control case, generation 1 to 2 should also remove the old posting:

current_generation=2
control_removed=True

What is the actual behavior?

The generation-127 posting is incorrectly retained after the counter wraps:

current_generation=1
retained_version=127
search_ids=[900]
expected_removed=True

The last line shows that the independent oracle expects the posting to be removed, while the implementation retains it.

Supporting information

No response

Server Version

1.40.0-dev

Weaviate Setup

Single Node

Nodes count

No response

Code of Conduct