Skip to content

A corrupt search-index.json makes sync silently wipe all search data #163

Backlog

Description

@TMHSDigital

Summary

build_search_index preserves the skill/rule/tool name arrays from the existing docs/search-index.json. On a ValueError (for example a leftover merge-conflict marker) load_existing_search_index returns {}, and the sync writes an index with empty arrays for every tool, with no warning. Preservation across sync has no test.

Where

  • scripts/sync_from_registry.py:425-434
  • scripts/sync_from_registry.py:395-400
  • tests/test_sync_from_registry.py

Details

try:
    data = json.loads(path.read_text(encoding="utf-8"))
except (ValueError, OSError):
    return {}

Impact

A registry edit followed by sync can drop all scanned search data behind catalog search; recovering needs a full aggregate_search.py --clone.

Suggested fix

Fail loudly on a present-but-unparseable file (non-zero exit with a message). Add tests: preserved arrays survive a description change; a new entry gets empty arrays; a removed entry leaves the index; a corrupt file fails.

Acceptance criteria

  • Corrupt search-index.json fails sync with a clear error
  • Preservation tests added

Getting started

  • Relevant files: scripts/sync_from_registry.py, tests/test_sync_from_registry.py
  • How to run tests: pip install -r requirements-test.txt && python -m pytest
  • After any registry or standards change: python scripts/sync_from_registry.py
  • Conventions: see CONTRIBUTING.md and standards/writing-style.md

Filed by repo-audit/full-audit at 2c7a7fe. Severity: medium. Effort: S. audit-key: bug|scripts/sync_from_registry.py|load_existing_search_index

Activity

  1. added
    bug
    good first issue
    severity: medium
    on Nov 30, 2026
  2. abhicodes-007 commented on Nov 30, 2026

    @abhicodes-007

    Fixed in PR #198: #198 — fix/issue-163-corrupt-search-index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions