Skip to content

Commit efb4de6

Browse files
wheels-bot[bot]github-actions[bot]bpamiri
authored
fix(model): skip CockroachDB advisory-lock specs via capability override (#2747)
* fix(model): skip CockroachDB advisory-lock specs via capability override CockroachDBModel extends PostgreSQLModel, which reports `$supportsAdvisoryLocks() = true` because Postgres has pg_advisory_lock. CockroachDB does not, so its $acquireAdvisoryLock / $releaseAdvisoryLock throw Wheels.AdvisoryLockNotSupported. Without a capability override the four standalone advisory-lock specs in `lockingSpec.cfc` skipped past their beforeEach guard and errored on every Cockroach-backed compat- matrix run (Lucee 6, Lucee 7, BoxLang). Adding the override lets them skip cleanly, matching the H2 / SQL Server treatment from #2665. Fixes #2743 Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> * docs(model): rework CockroachDB $supportsAdvisoryLocks docblock per review Reviewer A flagged that the existing wording led with "lets the test suite skip standalone-lock paths instead of erroring" — framing the override as a test workaround rather than a correctness fix. Reorder to lead with the underlying behavior ($acquireAdvisoryLock / $releaseAdvisoryLock throw Wheels.AdvisoryLockNotSupported), then explain what consulting the flag enables, then cite the H2 / SQL Server precedent from #2665. No functional change. Signed-off-by: Peter Amiri <peter@alurium.com> --------- Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Signed-off-by: Peter Amiri <peter@alurium.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Peter Amiri <peter@alurium.com>
1 parent b6313cc commit efb4de6

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

vendor/wheels/databaseAdapters/CockroachDB/CockroachDBModel.cfc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ component extends="wheels.databaseAdapters.PostgreSQL.PostgreSQLModel" output=fa
3939
}
4040

4141
/**
42-
* CockroachDB intentionally omits the PostgreSQL advisory-lock primitives
43-
* (`pg_advisory_lock` / `pg_advisory_unlock`) — it surfaces them as no-op
44-
* stubs that error rather than honoring the contract. Override the
45-
* PostgreSQL adapter's `true` and report unsupported so `withAdvisoryLock`
46-
* callers (and the capability-aware lockingSpec `beforeEach`) skip
47-
* standalone-lock paths instead of erroring.
42+
* CockroachDB lacks a pg_advisory_lock equivalent — its
43+
* $acquireAdvisoryLock and $releaseAdvisoryLock both throw
44+
* Wheels.AdvisoryLockNotSupported. Overriding the parent PostgreSQL
45+
* adapter's `true` to `false` lets capability-aware callers
46+
* (`withAdvisoryLock`, the lockingSpec `beforeEach` guard) route around
47+
* the missing primitive instead of hitting the throw, matching the
48+
* H2 / SQL Server pattern from #2665.
4849
*/
4950
public boolean function $supportsAdvisoryLocks() {
5051
return false;

vendor/wheels/tests/specs/database/CockroachDBUnitSpec.cfc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ component extends="wheels.WheelsTest" {
5151
});
5252
});
5353

54+
describe("$supportsAdvisoryLocks", () => {
55+
56+
it("returns false (CockroachDB has no pg_advisory_lock equivalent)", () => {
57+
expect(adapter.$supportsAdvisoryLocks()).toBeFalse();
58+
});
59+
});
60+
5461
describe("$identitySelect", () => {
5562

5663
it("returns lastId from result.generatedKey", () => {

0 commit comments

Comments
 (0)