summaryrefslogtreecommitdiff
path: root/src/__tests__/VyOSElasticModernFulltextStorageEngineTestCase.php
AgeCommit message (Collapse)Author
2026-05-23Tests: refresh stale docblock after engine abstract→class revertYuriy Andamasov
The class docblock still described the engine as abstract, from before commit 011eec1 reverted 'abstract class' to plain 'class'. Updated wording to accurately describe the concrete engine and the test-double's role. πŸ€– Generated by [robots](https://vyos.io)
2026-05-23fix: correct Phase-0 findings from promotion PR review (3 issues)Yuriy Andamasov
1. TestDouble signatures: indexExists() and getIndexStats() in VyOSElasticModernFulltextStorageEngineTestDouble were missing the nullable host parameter added in E7/E8, causing a PHP fatal on 'arc unit --everything'. 2. buildSpec() zero-query sort bug: the falsy check (!$query->getParameter('query')) incorrectly treats the string '0' as empty (PHP falsy), enabling date-sorted path for a real search term. Changed to explicit null/empty-string checks to match the existing must-clause guard on line 316. All 22 unit tests now pass. πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E8 fixup: four correctness fixes from Phase 0 reviewYuriy Andamasov
1. strlen(\$query_string) β†’ null-safe check \$query->getParameter('query') may return null; strlen(null) is deprecated in PHP 8.1+. Switch to explicit !== null && !== '' check. 2. ids.values nesting fix in buildSpec() 'values' => array(\$exclude) wraps an already-array \$exclude in a nested array, producing invalid Elasticsearch ids syntax. Cast to (array) then re-index with array_values() so both scalar PHID and array-of-PHIDs produce a flat list. 3. initIndex() host consistency: pass write host to indexExists() initIndex() called indexExists() without a host argument, which fell back to the read host, then deleted via getHostForWrite(). A read/write split lag window could cause false-positive "index doesn't exist" results. Pass the already-resolved write host. 4. getIndexStats() unchecked array access \$res['indices'][\$this->index] was accessed without verifying the key exists. If the index was just deleted or the name drifted, this throws an undefined-offset PHP notice. Add an explicit isset() guard with a clear exception message naming the index. πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E6 fixup: use trim() + empty-string guard in setService(); use newEngine() ↡Yuriy Andamasov
in tests - str_replace('/', '', \$index) β†’ trim(\$index, '/') to preserve internal slashes in multi-segment index paths (e.g. 'phabricator/prod' must stay intact; only leading/trailing slashes are stripped). - Add empty-string guard: after trim, throw a clear exception if the result is '' so misconfigured paths fail loudly at setService() rather than silently at query time with a confusing endpoint URL. - Replace direct new VyOSElasticModernFulltextStorageEngine() in the four new test methods with \$this->newEngine() to avoid PHP fatal on abstract class instantiation. πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E5 fixup: detect intra-key duplicates in buildIndexMappings(); add collision ↡Yuriy Andamasov
tests πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E5 fixup: expand testBuildIndexMappingsShape coverage to ↡Yuriy Andamasov
body/comment/projectPHID πŸ€– Generated by [robots](https://vyos.io)
2026-05-23Engine: Add buildIndexMappings() helper (single typeless mapping)Yuriy Andamasov
Single 'properties' block, documentType as a keyword field inside it, no include_in_all anywhere (the field was removed in ES 6). Relationships emit as keyword fields with doc_values: false, matching the bundled engine's ES-5-mode behavior. Field-data multi-analyzer shape (raw, keywords, stems) preserved. πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E4 fixup: use newEngine() helper in testBuildTypeFilter testsYuriy Andamasov
πŸ€– Generated by [robots](https://vyos.io)
2026-05-23Engine: Add buildTypeFilter() helper (body-level documentType filter)Yuriy Andamasov
πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E3 fixup: use newEngine() helper in testGetSearchUriYuriy Andamasov
πŸ€– Generated by [robots](https://vyos.io)
2026-05-23Engine: Add getSearchUri() helper (typeless search endpoint)Yuriy Andamasov
πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E2 fixup: use newEngine() helper in testGetDocumentUri testsYuriy Andamasov
πŸ€– Generated by [robots](https://vyos.io)
2026-05-23Engine: Add getDocumentUri() helper for typeless document URLsYuriy Andamasov
πŸ€– Generated by [robots](https://vyos.io)
2026-05-23E1 fixup: initialize $version to null; getVersion() throws if unset; use ↡Yuriy Andamasov
TestDouble in tests πŸ€– Generated by [robots](https://vyos.io)
2026-05-23Engine: Add setVersion() with strict validationYuriy Andamasov
Engine accepts only versions 7 and above (covering ES 7.x, 8.x, and OpenSearch 1.x/2.x/3.x via the typeless API). Anything below 7 raises with a clear message pointing at the bundled engine for ES 5 users. πŸ€– Generated by [robots](https://vyos.io)