This repository was archived by the owner on May 29, 2026. It is now read-only.
retrofit: reverse-spec search partial (5 REQs / 37 methods, 111 deferred)#1791
Open
rubenvdlinde wants to merge 1 commit into
Open
retrofit: reverse-spec search partial (5 REQs / 37 methods, 111 deferred)#1791rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
…red) Reverse-engineer the user-facing `search` capability from observed code as 5 new REQs. No canonical spec existed — this commit creates openspec/specs/search/spec.md (status: implemented, retrofit: true) with the first content for the capability. This is a PARTIAL pass over the 148-method Bucket 2a batch (/tmp/or-scan/rspec-cluster-search.json). 84 methods belong to the parallel `search-index` capability (Elasticsearch backend mirror of the Solr layer + SearchBackendInterface, see PR #1765 — retrofit-2026-05-24-search-index) and are DROP'd from this scope. 27 additional methods (frontend Vue stores/views, facet UI, facet integration tests, FacetCacheHandler clearing internals, several SearchTrailService analytics helpers, two stub controllers) are deferred under `future-pass:next` in tasks.md. New REQs: 1. The system SHALL expose three file-search HTTP endpoints on FileSearchController (keyword / semantic / hybrid, all @NoAdminRequired + @NoCSRFRequired, empty-query 400, on-failure 500). 2. Vector search SHALL support PHP cosine and Solr KNN backends with Reciprocal Rank Fusion for hybrid mode (cosineSimilarity dimension guard + zero-magnitude safety; KNN query shape `{!knn f=… topK=N}[v]`; RRF score `weight / (60 + rank + 1)`). 3. The system SHALL log every search request as a search trail with system-param filtering and optional self-clearing (mapper filters `_` keys; service-level exception wrap; selfClearing toggle gated on constructor flag; processConfig honours both bare and underscored parameter pairs). 4. SearchTrailController SHALL expose the search-trail REST API and analytics aggregators (index / show / statistics / popularTerms / activity / registerSchemaStats / userAgentStats / cleanup / export / destroy / destroyMultiple / clearAll; controller-level paginate helper enforces consistent shape; service aggregators decorate raw counts with percentages / success_rate / trend classifiers / browser_distribution). 5. PlaceholderResolver SHALL resolve `$now` / `$startOf*` / `$currentUser` DSL with optional `±N[dwmy]` offset arithmetic (natural-unit default per placeholder; unknown placeholders return verbatim; resolveArray recurses leaves). Annotated 37 methods across 5 files with @SPEC pointers back to this change's tasks. Notes section flags two stub controllers (SearchTrailController::destroy / destroyMultiple), a service-layer container leak (clearAll), a hard-coded query_complexity placeholder, a documented `$_before`-ignored param on cleanupSearchTrails, the hybrid-mode 2x vector oversearch asymmetry, the PHP-serialized embedding column, and the timing of the search-index capability merge (PR #1765 still pre-merge). No runtime behaviour changes (docblock-only).
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ❌ | ||||
| stylelint | ❌ | ||||
| composer | ✅ | ✅ 162/162 | |||
| npm | ✅ | ✅ 532/532 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-05-24 19:19 UTC
Download the full PDF report from the workflow artifacts.
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reverse-engineer the user-facing search capability from observed code as 5 new REQs. No canonical spec existed — this PR creates
openspec/specs/search/spec.md(status: implemented, retrofit: true) with the first content for the capability.This is a partial pass over the 148-method Bucket 2a batch (
/tmp/or-scan/rspec-cluster-search.json). 84 methods belong to the parallelsearch-indexcapability (Elasticsearch backend mirror of the Solr layer +SearchBackendInterface, see #1765) and are DROP'd from this scope. 27 additional methods are deferred underfuture-pass:nextintasks.md.REQs introduced
FileSearchController— keyword / semantic / hybrid, all@NoAdminRequired+@NoCSRFRequired, empty-query 400, on-failure 500.{!knn f=… topK=N}[v]; RRF scoreweight / (60 + rank + 1))._keys; service-level exception wrap;selfClearingtoggle gated on constructor flag;processConfighonours both bare and underscored parameter pairs).SearchTrailControllerSHALL expose the search-trail REST API and analytics aggregators (index / show / statistics / popularTerms / activity / registerSchemaStats / userAgentStats / cleanup / export / destroy / destroyMultiple / clearAll; controller-level paginate helper enforces consistent shape; service aggregators decorate raw counts with percentages / success_rate / trend classifiers / browser_distribution).PlaceholderResolverSHALL resolve\$now/\$startOf*/\$currentUserDSL with optional±N[dwmy]offset arithmetic (natural-unit default per placeholder; unknown placeholders return verbatim;resolveArrayrecurses leaves).Annotations
@specreferences — 2 methods carry both REQ-003 and REQ-004 tags) across 5 files:lib/Controller/FileSearchController.php(REQ-001)lib/Service/Vectorization/Handlers/VectorSearchHandler.php(REQ-002)lib/Service/SearchTrailService.php(REQ-003 + REQ-004)lib/Controller/SearchTrailController.php(REQ-004)lib/Service/Search/PlaceholderResolver.php(REQ-005)Notes / drifts surfaced (not fixed)
SearchTrailController::destroyanddestroyMultipleare stubs that return 200 with "not implemented yet" — misleading callers behind@NoAdminRequiredDELETE routes.SearchTrailController::clearAllreaches into the container (\OC::\$server->get(...)) instead of going through the injectedSearchTrailService.SearchTrailService::getSearchStatisticsships a hard-codedquery_complexity = {simple: 60%, medium: 30%, complex: 10%}placeholder.cleanupSearchTrails(\$_before)ignores its\$beforeparameter (mapper deletes byexpirescolumn only).VectorSearchHandler::hybridSearchoversearches the vector half by 2x but consumes Solr-side input as-is — asymmetric merge.openregister_vectors.embeddingcolumn is PHP-serialize()'d, not JSON.search-index/spec.md(PR retrofit: reverse-spec search-index (5 new REQs, new capability) #1765) is the canonical home for the 84 search-index methods DROP'd here, but is still pre-merge onorigin/development.Deferred (
future-pass:next)search-index/spec.md(PR retrofit: reverse-spec search-index (5 new REQs, new capability) #1765) to cover Elasticsearch.SearchTrailServiceanalytics helper internals.SearchTrailControllerstub endpoints (destroy,destroyMultiple).FacetCacheHandler::clearDistributedFacetCaches).See
openspec/changes/retrofit-2026-05-24-search/tasks.mdfor the full deferred list.Test plan
composer check:strict(PHPCS / PHPMD / Psalm / PHPStan) — docblock changes only, expect no new violationsopenspec validate retrofit-2026-05-24-search --strict— verify ghost change shape@spec openspec/changes/retrofit-2026-05-24-search/tasks.md#task-Nresolves to an existing task line