Skip to content

Remove the superseded v5/v6/v7 search schema revisions#3523

Draft
jonathangreen wants to merge 6 commits into
mainfrom
chore/remove-old-search-schema-revisions
Draft

Remove the superseded v5/v6/v7 search schema revisions#3523
jonathangreen wants to merge 6 commits into
mainfrom
chore/remove-old-search-schema-revisions

Conversation

@jonathangreen

Copy link
Copy Markdown
Member

Description

Stacked on top of #3522 (feature/search-v8). Removes the superseded v5/v6/v7 search schema revisions now that v8 is self-contained and is the only revision production creates indexes from.

  • Deletes src/palace/manager/search/v5.py, v6.py, and v7.py, along with their dedicated tests (test_search_v6.py, test_search_v7.py).
  • Drops the old revisions from SearchRevisionDirectory, leaving REVISIONS = [SearchV8()].
  • Repoints the remaining references at v8: the MockSearchSchemaRevisionLatest mapping document and a name_for_index docstring example.
  • Moves the author char-filter test (previously written against v5 in test_external_search.py) into TestSearchV8, and drops v8's v7-equivalence test now that v7 no longer exists to compare against.

Important

Do not merge until the release containing #3522 has shipped and production has reindexed onto v8. This is the "release 2" half of the two-stacked-PRs workflow in CLAUDE.md. While any production index is still on v5/v6/v7, the running application must be able to load those revisions (e.g. to read the current index version), so their removal is only safe once nothing in production references them. Kept in draft until then.

Motivation and Context

#3522 made v8 self-contained specifically so that older revisions could be deleted once they fell out of use, instead of accumulating indefinitely behind the inheritance chain. This PR is that cleanup. Opening it now (in draft) keeps the follow-up visible so the removal isn't forgotten after the v8 release goes out.

How Has This Been Tested?

Ran the affected suites under the docker tox environment — tests/manager/search/, tests/manager/scripts/test_initialization.py, and tests/manager/celery/tasks/test_search.py (the latter two exercise MockSearchSchemaRevisionLatest, whose backing document now comes from v8). All 171 tests pass. mypy is clean on the changed source.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

v8 subclasses SearchSchemaRevision directly and defines its full mapping inline, instead of chaining off v7 the way earlier revisions did. With the chain broken, old revisions can be deleted once production no longer uses them.

v8 also pins number_of_shards to 1. Earlier indexes inherited a 5-primary-shard count from the Elasticsearch 6.x era, carried forward through every reindex because nothing set it explicitly. Per-library indexes are well under a gigabyte, so a single primary shard is correct, and the setting is immutable after index creation. number_of_replicas is left to runtime management.
v8 now sets index.search.slowlog.threshold.* on every index it creates, so
slow query- and fetch-phases are written to the cluster slow log. Paired with
the SEARCH_SLOW_LOGS publishing wired up in the hosting-playbook, these entries
reach the domain's CloudWatch log group for investigation.

The thresholds are dynamic settings, so they establish a baseline at index
creation that can still be retuned on a live index without a reindex.
v8 now sets number_of_replicas explicitly (to 1) alongside number_of_shards,
so a newly created index has a fully deterministic configuration rather than
relying on an inherited cluster default. One replica matches what every
production index already runs and is also the OpenSearch default, so this is
operationally a no-op. The setting is dynamic and can still be retuned at
runtime for a larger topology.
v8 is self-contained and is the only revision production creates indexes
from, so the older chained revisions (v7 -> v6 -> v5) are no longer
referenced and can be deleted. This removes their modules, drops them from
the revision directory, and repoints the remaining test/mock usages at v8.

The v8 module test absorbs the author char-filter test that previously
lived against v5 in test_external_search, and drops its v7-equivalence
test now that v7 is gone.
@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @jonathangreen's task in 2m 32s —— View job


Code Review

  • Gather context (diff against origin/feature/search-v8)
  • Verify no remaining references to v5/v6/v7
  • Verify v8 is self-contained / ported tests are faithful
  • Post review

Summary

This is a clean, well-scoped deletion that does exactly what it says: removes the superseded v5/v6/v7 revision modules and their tests, trims REVISIONS to [SearchV8()], and repoints the two remaining references (MockSearchSchemaRevisionLatest and the name_for_index docstring) at v8. I confirmed there are no remaining imports or references to SearchV5/SearchV6/SearchV7 (or the search.v5/v6/v7 modules) anywhere in the repo, v8.py imports only from search.document / search.revision so it is genuinely self-contained, and the test_character_filters port into TestSearchV8 is byte-for-byte faithful to the deleted v5 version while now correctly targeting SearchV8.CHAR_FILTERS / SearchV8.AUTHOR_CHAR_FILTER_NAMES (which exist). The test_mapping_matches_v7 removal is the right call now that v7 is gone, and the lane_priority_level / licensepools.last_updated fields the old v6/v7 micro-tests guarded still live in v8 (v8.py:233, v8.py:255) and are exercised by the end-to-end search suite. No findings — and the merge-ordering caveat in the description (wait until production has reindexed onto v8) is the correct operational gate, since trimming REVISIONS means the running app can no longer load older index versions.
· chore/remove-old-search-schema-revisions

With v5/v6/v7 removed in this PR, the docstring no longer needs to recount
the old inheritance chain to justify v8 being self-contained.
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes the now-superseded v5, v6, and v7 search schema revision modules and their test files, following the self-contained v8 revision introduced in #3522. The SearchRevisionDirectory is pared down to REVISIONS = [SearchV8()], and the MockSearchSchemaRevisionLatest backing document is updated to v8.

  • Deletes v5.py, v6.py, v7.py and their dedicated tests; the author char-filter test previously written against v5 is moved into TestSearchV8.
  • Drops the v8 ↔ v7 equivalence test (no longer meaningful without v7) and updates the docstring example and REVISIONS list to reference v8 only.

Confidence Score: 5/5

Safe to merge once the release containing v8 has shipped and production has reindexed — correctly kept as a draft until then.

All v5/v6/v7 references are completely removed from both source and tests with no dangling imports or dead code. The character-filter test is faithfully ported to TestSearchV8, the mock's backing document is updated to v8, and the revision directory contains exactly one entry. No logic was changed, only deleted. The deployment guard (keep draft until production migrates) is explicit in the PR description.

No files require special attention.

Important Files Changed

Filename Overview
src/palace/manager/search/revision_directory.py Removes v5/v6/v7 imports and trims REVISIONS to [SearchV8()]; logic is correct and complete.
src/palace/manager/search/revision.py Docstring example updated from v5 to v8; no logic changes.
src/palace/manager/search/v8.py Docstring trimmed to remove now-deleted v7 reference; retains historical 'Added in v6/v7' field comments as useful context.
tests/mocks/search.py MockSearchSchemaRevisionLatest now uses SearchV8().mapping_document() instead of SearchV5(); correctly reflects the new sole production revision.
tests/manager/search/test_search_v8.py Replaces test_mapping_matches_v7 (now obsolete) with test_character_filters migrated from TestSearchV5; test coverage is maintained.
tests/manager/search/test_external_search.py Removes TestSearchV5 class and its character-filter test (moved to TestSearchV8); import of re and SearchV5 dropped.
src/palace/manager/search/v5.py File deleted; entire 265-line v5 schema module removed as intended.
src/palace/manager/search/v6.py File deleted; small v6 subclass (adds lane_priority_level) removed.
src/palace/manager/search/v7.py File deleted; v7 subclass (adds licensepools.last_updated) removed.
tests/manager/search/test_search_v6.py File deleted alongside v6.py; test coverage not lost since v6 no longer exists.
tests/manager/search/test_search_v7.py File deleted alongside v7.py; test coverage not lost since v7 no longer exists.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before (feature/search-v8 base)"]
        R1["REVISIONS list"] --> V5["SearchV5"]
        R1 --> V6["SearchV6 (extends V5)"]
        R1 --> V7["SearchV7 (extends V6)"]
        R1 --> V8b["SearchV8 (self-contained)"]
        M1["MockSearchSchemaRevisionLatest"] -->|"uses mapping from"| V5
    end

    subgraph After["After (this PR)"]
        R2["REVISIONS list"] --> V8a["SearchV8 (self-contained)"]
        M2["MockSearchSchemaRevisionLatest"] -->|"uses mapping from"| V8a
    end

    subgraph Tests["Test migration"]
        T1["TestSearchV5.test_character_filters\n(test_external_search.py)"] -->|"moved to"| T2["TestSearchV8.test_character_filters\n(test_search_v8.py)"]
        T3["TestSearchV8.test_mapping_matches_v7"] -->|"removed (v7 deleted)"| X["❌"]
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    subgraph Before["Before (feature/search-v8 base)"]
        R1["REVISIONS list"] --> V5["SearchV5"]
        R1 --> V6["SearchV6 (extends V5)"]
        R1 --> V7["SearchV7 (extends V6)"]
        R1 --> V8b["SearchV8 (self-contained)"]
        M1["MockSearchSchemaRevisionLatest"] -->|"uses mapping from"| V5
    end

    subgraph After["After (this PR)"]
        R2["REVISIONS list"] --> V8a["SearchV8 (self-contained)"]
        M2["MockSearchSchemaRevisionLatest"] -->|"uses mapping from"| V8a
    end

    subgraph Tests["Test migration"]
        T1["TestSearchV5.test_character_filters\n(test_external_search.py)"] -->|"moved to"| T2["TestSearchV8.test_character_filters\n(test_search_v8.py)"]
        T3["TestSearchV8.test_mapping_matches_v7"] -->|"removed (v7 deleted)"| X["❌"]
    end
Loading

Reviews (2): Last reviewed commit: "Trim stale revision-chain history from t..." | Re-trigger Greptile

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (77650c4) to head (1558880).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           feature/search-v8    #3523      +/-   ##
=====================================================
- Coverage              93.46%   93.44%   -0.02%     
=====================================================
  Files                    512      509       -3     
  Lines                  46561    46464      -97     
  Branches                6344     6343       -1     
=====================================================
- Hits                   43516    43418      -98     
- Misses                  1968     1969       +1     
  Partials                1077     1077              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonathangreen
jonathangreen requested a review from a team June 30, 2026 14:26
@jonathangreen

Copy link
Copy Markdown
Member Author

I'm going to leave this in draft until its safe to merge, but its ready for a code review now, then it can just wait to get merged once approved.

@tdilauro tdilauro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! 🏁

Base automatically changed from feature/search-v8 to main July 7, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants