Skip to content

Commit 70b45df

Browse files
committed
chore: harden ci and maximize typing for 4.0
1 parent 3d9c06c commit 70b45df

36 files changed

+976
-519
lines changed

.github/workflows/buddy-integration.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
packages: read
1414
env:
1515
SEARCH_BUILD: MANTICORE
16+
MANTICORE_IMAGE: manticoresearch/manticore@sha256:24835e1b590a31da0f45809b032865b1caab0a1b58f4ed14da9128a338f2d365
1617

1718
steps:
1819
- name: Checkout
@@ -28,24 +29,33 @@ jobs:
2829

2930
- name: Start Manticore with Buddy extras
3031
run: |
31-
docker pull manticoresearch/manticore:latest
32+
docker pull "$MANTICORE_IMAGE"
3233
docker run -d --name searchd \
3334
-e EXTRA=1 \
3435
-p 9307:9306 \
3536
-p 9312:9312 \
36-
manticoresearch/manticore:latest
37+
"$MANTICORE_IMAGE"
3738
3839
- name: Wait for searchd
3940
run: |
4041
n=0
4142
while [ "$n" -lt 60 ]; do
42-
if (echo > /dev/tcp/127.0.0.1/9307) >/dev/null 2>&1; then
43+
if php -r '
44+
try {
45+
$pdo = new PDO("mysql:host=127.0.0.1;port=9307", "", "");
46+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
47+
$pdo->query("SHOW TABLES");
48+
exit(0);
49+
} catch (Throwable $exception) {
50+
exit(1);
51+
}
52+
' >/dev/null 2>&1; then
4353
exit 0
4454
fi
4555
n=$((n + 1))
4656
sleep 1
4757
done
48-
echo "searchd did not become ready on 127.0.0.1:9307"
58+
echo "searchd did not become SQL-ready on 127.0.0.1:9307"
4959
docker logs searchd || true
5060
exit 1
5161

.github/workflows/ci.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
steps:
3333
- name: Checkout
3434
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
3537

3638
- name: Setup PHP
3739
if: env.COVERAGE_LANE != 'true'
@@ -101,13 +103,22 @@ jobs:
101103
run: |
102104
n=0
103105
while [ "$n" -lt 60 ]; do
104-
if (echo > /dev/tcp/127.0.0.1/9307) >/dev/null 2>&1; then
106+
if php -r '
107+
try {
108+
$pdo = new PDO("mysql:host=127.0.0.1;port=9307", "", "");
109+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
110+
$pdo->query("SHOW TABLES");
111+
exit(0);
112+
} catch (Throwable $exception) {
113+
exit(1);
114+
}
115+
' >/dev/null 2>&1; then
105116
exit 0
106117
fi
107118
n=$((n + 1))
108119
sleep 1
109120
done
110-
echo "searchd did not become ready on 127.0.0.1:9307"
121+
echo "searchd did not become SQL-ready on 127.0.0.1:9307"
111122
docker logs searchd || true
112123
exit 1
113124
@@ -147,36 +158,25 @@ jobs:
147158
148159
if [ "${{ github.event_name }}" = "pull_request" ]; then
149160
BASE_SHA="${{ github.event.pull_request.base.sha }}"
150-
BASE_REF="${{ github.event.pull_request.base.ref }}"
151161
BASE_LABEL="PR base (${BASE_SHA})"
152-
git fetch --no-tags --depth=1 origin "${BASE_REF}" || true
153-
154-
if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
155-
if git cat-file -e "origin/${BASE_REF}^{commit}" 2>/dev/null; then
156-
BASE_SHA="origin/${BASE_REF}"
157-
BASE_LABEL="PR base ref (${BASE_SHA})"
158-
else
159-
BASE_SHA="$(git rev-parse HEAD~1)"
160-
BASE_LABEL="fallback (HEAD~1)"
161-
fi
162-
fi
163162
else
164163
BASE_SHA="${{ github.event.before }}"
164+
BASE_LABEL="push before (${BASE_SHA})"
165+
fi
166+
167+
if [ -z "${BASE_SHA}" ] \
168+
|| [ "${BASE_SHA}" = "0000000000000000000000000000000000000000" ] \
169+
|| ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
165170
DEFAULT_BRANCH="${{ github.event.repository.default_branch }}"
166-
if [ -z "${BASE_SHA}" ] \
167-
|| [ "${BASE_SHA}" = "0000000000000000000000000000000000000000" ] \
168-
|| ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
169-
git fetch --no-tags --depth=2 origin "${DEFAULT_BRANCH}" || true
170-
if git cat-file -e "origin/${DEFAULT_BRANCH}~1^{commit}" 2>/dev/null; then
171-
BASE_SHA="origin/${DEFAULT_BRANCH}~1"
172-
BASE_LABEL="fallback (${BASE_SHA})"
173-
else
174-
BASE_SHA="$(git rev-parse HEAD~1)"
175-
BASE_LABEL="fallback (HEAD~1)"
176-
fi
171+
if git show-ref --verify --quiet "refs/remotes/origin/${DEFAULT_BRANCH}"; then
172+
BASE_SHA="$(git merge-base "origin/${DEFAULT_BRANCH}" HEAD)"
173+
BASE_LABEL="merge-base (origin/${DEFAULT_BRANCH})"
174+
elif git cat-file -e "HEAD~1^{commit}" 2>/dev/null; then
175+
BASE_SHA="$(git rev-parse HEAD~1)"
176+
BASE_LABEL="fallback (HEAD~1)"
177177
else
178-
BASE_LABEL="push before (${BASE_SHA})"
179-
git fetch --no-tags --depth=1 origin "${BASE_SHA}" || true
178+
BASE_SHA="$(git rev-parse HEAD)"
179+
BASE_LABEL="fallback (HEAD)"
180180
fi
181181
fi
182182

.github/workflows/docs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ on:
88
- README.md
99
- .github/workflows/docs.yml
1010
push:
11-
branches:
12-
- master
1311
paths:
1412
- docs/**
1513
- README.md

.github/workflows/publish-search-images.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- tests/sphinx.conf
1212
- tests/manticore.conf
1313
- tests/test_udf.c
14+
- tests/s3_test_udf.c
1415
- tests/ms_test_udf.c
1516

1617
permissions:

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#### 4.0.0
22
* Dropped support for PHP 8.1 and lower (minimum PHP is now 8.2)
33
* Updated CI PHP matrix to 8.2 and 8.3
4-
* Restored runtime-level driver normalization for PDO/MySQLi scalar fetch values
54
* Normalized MySQLi driver exception handling for modern PHP `mysqli_sql_exception` behavior
65
* Hardened runtime validation for `SphinxQL`, `Facet`, `Helper`, and `Percolate` input contracts (fail-fast exceptions for invalid query-shape input)
76
* Standardized driver exception message prefixes for better diagnostics (`[mysqli][...]`, `[pdo][...]`)
@@ -16,10 +15,14 @@
1615
* Added and stabilized Sphinx 3 compatibility coverage while preserving Sphinx 2 and Manticore test behavior
1716
* Added support for optional connection credentials (`username`/`password`) in both PDO and MySQLi drivers (closes #208)
1817
* Added optional-index `update($index = null)` flow for fluent `->update()->into($index)` usage (closes #184)
18+
* Added explicit `update()->compile()/execute()` guard when no target index is set via `into($index)` (prevents invalid `UPDATE` SQL emission)
19+
* Restored `showTables($index = null)` compatibility (`SHOW TABLES` for null/empty, `SHOW TABLES LIKE ...` for non-empty) and removed hardcoded `rt` assumptions from runtime capability probes
20+
* Aligned Buddy capability flags so `callQSuggest()`/`callAutocomplete()` are gated by detected Buddy availability
1921
* Added MVA insert/update array example in README (closes #178)
2022
* Corrected escaping docs to reference connection-level helpers and clarified `quoteIdentifier()` availability (closes #203)
2123
* Added a root `LICENSE` file (closes #171)
2224
* Migrated CI to GitHub Actions-only validation with strict composer metadata checks
25+
* Hardened GitHub Actions reliability with SQL-readiness checks, full-history checkout for changed-line artifacts, and digest-pinned Buddy integration runtime image
2326
* Updated documentation and added a dedicated `MIGRATING-4.0.md` guide
2427

2528
#### 3.0.2

MIGRATING-4.0.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The following now throw on invalid input:
2525
- `groupNBy()` non-positive values
2626
- `where()` / `having()` invalid filter value shape for `IN`/`NOT IN`/`BETWEEN`
2727
- `into()`, `columns()`, `values()`, `value()`, `set()` invalid/empty input
28+
- `update()->compile()` / `update()->execute()` without `into($index)`
2829
- `setQueuePrev()` non-`SphinxQL` argument
2930

3031
### Facet strict validation
@@ -38,7 +39,8 @@ The following now throw on invalid input:
3839

3940
Helper methods now validate required identifiers and argument shapes:
4041

41-
- `showTables()`, `describe()`, `showIndexStatus()`, `flushRtIndex()`,
42+
- `showTables()` accepts `null`/empty for unfiltered `SHOW TABLES`, and validates non-string filters
43+
- `describe()`, `showIndexStatus()`, `flushRtIndex()`,
4244
`truncateRtIndex()`, `optimizeIndex()`, `flushRamchunk()`, etc.
4345
- `setVariable()` validates variable names and array values
4446
- `callSnippets()` and `callKeywords()` validate required arguments

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,12 @@ Will return an array with an `INT` as first member, the number of rows deleted.
277277
$sq->where('column', 'BETWEEN', array('value1', 'value2'));
278278
```
279279

280-
You can compose grouped boolean filters with:
281-
`orWhere()`, `whereOpen()`, `orWhereOpen()`, and `whereClose()`.
280+
You can compose grouped boolean filters with:
281+
`orWhere()`, `whereOpen()`, `orWhereOpen()`, and `whereClose()`.
282+
The same grouped API exists for `HAVING` via `having()`, `orHaving()`,
283+
`havingOpen()`, `orHavingOpen()`, and `havingClose()`.
284+
Repeated `having()` calls are additive (`AND`) unless you explicitly use
285+
`orHaving()` or grouped clauses.
282286

283287
#### MATCH
284288

@@ -526,7 +530,7 @@ $result = (new SphinxQL($this->conn))
526530
* `(new Helper($conn))->showDatabases() => 'SHOW DATABASES'`
527531
* `(new Helper($conn))->showCharacterSet() => 'SHOW CHARACTER SET'`
528532
* `(new Helper($conn))->showCollation() => 'SHOW COLLATION'`
529-
* `(new Helper($conn))->showTables($index) => 'SHOW TABLES LIKE <quoted index>'`
533+
* `(new Helper($conn))->showTables($index = null) => 'SHOW TABLES' (null/empty) or 'SHOW TABLES LIKE <quoted index>'`
530534
* `(new Helper($conn))->showVariables() => 'SHOW VARIABLES'`
531535
* `(new Helper($conn))->showCreateTable($table)`
532536
* `(new Helper($conn))->showTableStatus($table = null) => 'SHOW TABLE STATUS' or 'SHOW TABLE <table> STATUS'`

docs/feature-matrix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: 1
2-
updated_at: "2026-02-27"
2+
updated_at: "2026-02-28"
33
notes:
44
- "supported means covered by runtime tests in at least one CI lane."
55
- "conditional means feature depends on engine/runtime capability checks."
@@ -43,7 +43,7 @@ helper:
4343
sphinx3: supported
4444
manticore: supported
4545
notes:
46-
- "showTables($index) compiles to SHOW TABLES LIKE <quoted index>; index must be a non-empty string."
46+
- "showTables($index = null) compiles to SHOW TABLES when index is null/empty, or SHOW TABLES LIKE <quoted index> for non-empty strings."
4747
diagnostic_show:
4848
api: ["showProfile", "showPlan", "showThreads", "showPlugins", "showQueries"]
4949
sphinx2: conditional

docs/helper.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Available Methods
3232
- ``showDatabases()``
3333
- ``showCharacterSet()``
3434
- ``showCollation()``
35-
- ``showTables($index)``
35+
- ``showTables($index = null)``
3636
- ``showVariables()``
3737
- ``showCreateTable($table)``
3838
- ``showTableStatus($table = null)``
@@ -66,7 +66,10 @@ Available Methods
6666
Filtered SHOW Wrappers
6767
----------------------
6868

69-
- ``showTables($index)`` compiles to ``SHOW TABLES LIKE <quoted index>``.
69+
- ``showTables($index = null)`` compiles to:
70+
71+
- ``SHOW TABLES`` when ``$index`` is ``null`` or an empty string
72+
- ``SHOW TABLES LIKE <quoted index>`` when ``$index`` is a non-empty string
7073
- ``showTableStatus($table = null)`` compiles to:
7174

7275
- ``SHOW TABLE STATUS`` when ``$table`` is ``null``

docs/query-builder.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ The builder supports grouped boolean filters for ``WHERE`` and ``HAVING``:
7373
- ``orHaving()``
7474
- ``havingOpen()`` / ``orHavingOpen()`` / ``havingClose()``
7575

76+
Repeated ``having()`` calls are additive and compile as ``AND`` conditions unless
77+
you explicitly use ``orHaving()`` / grouped clauses.
78+
7679
JOIN and KNN Ordering
7780
---------------------
7881

@@ -100,7 +103,7 @@ The same capability model is used by ``Helper`` wrappers:
100103

101104
- filtered ``SHOW`` wrappers:
102105

103-
- ``showTables($index)`` => ``SHOW TABLES LIKE <quoted index>``
106+
- ``showTables($index = null)`` => ``SHOW TABLES`` (when ``null`` or empty) or ``SHOW TABLES LIKE <quoted index>``
104107
- ``showTableStatus($table = null)`` => ``SHOW TABLE STATUS`` or ``SHOW TABLE <table> STATUS``
105108

106109
- suggest-family option contract (``callSuggest()``, ``callQSuggest()``,

0 commit comments

Comments
 (0)