Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ on:
type: boolean
default: false
script_catalog:
description: "docs/script-catalog (custom scripts load + behavior; PRs run it only when the catalog changes)"
description: "docs/script-catalog (custom scripts load + behavior; nightly always, PRs only when the catalog changes)"
type: boolean
default: false
schedule:
Expand Down Expand Up @@ -164,15 +164,18 @@ jobs:
# .git is rsync'd to the VM (the maven buildnumber plugin needs it); don't carry the token.
persist-credentials: false

# Script-catalog tests run only on demand: a PR touching the catalog/harness, or a ticked dispatch.
# Script-catalog tests run nightly (so the Zulip report covers them), on a PR touching the
# catalog/harness, or on a dispatch with the box (or "all modules") ticked.
- name: Decide script-catalog tests
id: catalog
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
run=false
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
run="${{ inputs.script_catalog }}"
if [ "${{ github.event_name }}" = "schedule" ]; then
run=true
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
[ "${{ inputs.script_catalog }}" = "true" ] || [ "${{ inputs.all_modules }}" = "true" ] && run=true
elif [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch -q --no-tags --depth=1 origin "$BASE_SHA"
rc=0
Expand Down
4 changes: 2 additions & 2 deletions automation/ci/script_catalog/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ def basic_lock():
assert login_code(client, lock_acr, lock_uid, password), f"{lock_acr} login with the right password failed"
for _ in range(3):
assert not aio.login(client, lock_acr, lock_uid, "wrong-" + password), "wrong password accepted"
status = (aio.get_user(lock_inum) or {}).get("jansStatus")
assert status == "inactive", f"jansStatus={status!r} after 3 failed logins, expected 'inactive'"
status = (aio.get_user(lock_inum) or {}).get("status")
assert status == "inactive", f"status={status!r} after 3 failed logins, expected 'inactive'"
assert not aio.login(client, lock_acr, lock_uid, password), "locked account still logs in"

behavior(run, "ScriptCatalog.behavior", "introspection_custom_params.py returns public sid", introspection_sid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.security.SecureRandom;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
Expand Down Expand Up @@ -68,7 +69,7 @@
* variation of that noise, the pool validation query and the probe itself are covered by
* {@link #WRITE_NOISE_TOLERANCE} and {@link #XACT_NOISE_TOLERANCE}. The write transaction count is the
* exact signal (1 for the batch, one per entry for single persist); {@code xact_commit} also counts
* read-only statements of other sessions, so its bound is looser.</p>
* read-only statements of other sessions, so the batch is only required to commit less than single persist.</p>
*
* @author Yuriy Movchan Date: 11/12/2026
*/
Expand Down Expand Up @@ -414,11 +415,15 @@ public void oneCommitPerBatch() throws Exception {
assertTrue(batchWriteTransactions >= 1 && batchWriteTransactions - noiseWriteTransactions <= 1 + WRITE_NOISE_TOLERANCE, report);
assertTrue(singlesWriteTransactions >= count, report);

long batchXactExcess = batchXactCommits - noiseXactCommits;
// Rows inserted by one transaction share its xmin: exact per-batch count, immune to other sessions
assertEquals(countInsertTransactions(sqlEntryManager, batch), 1L, report);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
assertEquals(countInsertTransactions(sqlEntryManager, singles), (long) count, report);

// xact_commit noise is bursty on a busy stand (CI AIO: 8 idle, 47 extra in the batch window), so
// it gets no absolute bound for the batch
long singlesXactExcess = singlesXactCommits - noiseXactCommits;
assertTrue(batchXactCommits >= 1 && batchXactExcess <= 1 + XACT_NOISE_TOLERANCE, report);
assertTrue(batchXactCommits >= 1 && batchXactCommits < singlesXactCommits, report);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
assertTrue(singlesXactExcess >= count - XACT_NOISE_TOLERANCE, report);
assertTrue(batchXactExcess * 4 < singlesXactExcess, report);
}

@Test
Expand Down Expand Up @@ -580,6 +585,21 @@ private long[] readCommitCounters(SqlEntryManager sqlEntryManager) throws Except
}
}

private long countInsertTransactions(SqlEntryManager sqlEntryManager, List<SessionId> sessions) throws Exception {
String[] ids = sessions.stream().map(SessionId::getId).toArray(String[]::new);
String schema = sqlEntryManager.getOperationService().getConnectionProvider().getSchemaName();
String table = (schema == null ? "" : "\"" + schema + "\".") + "\"jansSessId\"";
try (Connection connection = sqlEntryManager.getOperationService().getConnection();
PreparedStatement statement = connection.prepareStatement(
"SELECT count(DISTINCT xmin::text) FROM " + table + " WHERE doc_id = ANY(?)")) {
statement.setArray(1, connection.createArrayOf("varchar", ids));
try (ResultSet resultSet = statement.executeQuery()) {
assertTrue(resultSet.next());
return resultSet.getLong(1);
}
}
}

private List<SessionId> buildSessions(List<String> ids) {
List<SessionId> result = new ArrayList<>();
for (String id : ids) {
Expand Down