Skip to content

build support - #1

Merged
lvca merged 2 commits into
mainfrom
setup-gh-actions
Aug 16, 2021
Merged

lvca merged 2 commits into
mainfrom
setup-gh-actions

Conversation

@arcade-player

Copy link
Copy Markdown
Contributor

add pre-commit configuration
add gh actions
add dependabot configuration

add pre-commit configuration
add gh actions
add dependabot configuration
@arcade-player
arcade-player requested a review from lvca August 16, 2021 20:33
@lvca
lvca merged commit 99ee631 into main Aug 16, 2021
@lvca

lvca commented Aug 16, 2021

Copy link
Copy Markdown
Member

Thanks!

lvca pushed a commit that referenced this pull request Sep 7, 2021
Get latest commits from main project
@lvca lvca mentioned this pull request Aug 3, 2022
@lvca
lvca deleted the setup-gh-actions branch May 6, 2023 15:30
mergify Bot added a commit that referenced this pull request Aug 29, 2025
….3.8 to 0.3.13 in /studio [skip ci]

Bumps [@jridgewell/gen-mapping](https://github.com/jridgewell/sourcemaps/tree/HEAD/packages/gen-mapping) from 0.3.8 to 0.3.13.
Changelog

*Sourced from [`@​jridgewell/gen-mapping`'s changelog](https://github.com/jridgewell/sourcemaps/blob/main/packages/gen-mapping/CHANGELOG.md).*

> [0.3.13] - 2025-08-12
> =====================
>
> * Use `default` subpath export: <jridgewell/sourcemaps@aab8d72>
> * Transform `export default` into `module.exports =` in UMD plugin: <jridgewell/sourcemaps@cf85c75>
>
> **Full Changelog**: <jridgewell/sourcemaps@gen-mapping/0.3.12...gen-mapping/0.3.13>
>
> [0.3.12] - 2025-07-01
> =====================
>
> * Use `Object.assign` to avoid polyfill in old Node versions: <jridgewell/sourcemaps@dd0615a>
> * Optimize UMD wrapper: <jridgewell/sourcemaps@557ca37>
> * Reorder subpath exports to improve import usage: [#35](https://github.com/jridgewell/sourcemaps/tree/HEAD/packages/gen-mapping/issues/35)
>
> **Full Changelog**: <jridgewell/sourcemaps@gen-mapping/0.3.11...gen-mapping/0.3.12>
>
> [0.3.11] - 2025-06-30
> =====================
>
> * Update UMD Wrapper to fix webpack build issue: [#33](https://github.com/jridgewell/sourcemaps/tree/HEAD/packages/gen-mapping/issues/33)
> * Add `getOwnPropertyDescriptors` polyfill to support Node v6: [#34](https://github.com/jridgewell/sourcemaps/tree/HEAD/packages/gen-mapping/issues/34)
>
> **Full Changelog**: <jridgewell/sourcemaps@gen-mapping/0.3.10...gen-mapping/0.3.11>
>
> [0.3.10] - 2025-06-30
> =====================
>
> * Remove `require(esm)` support to fix bug with Node v22: <jridgewell/sourcemaps@e957842>
>
> **Full Changelog**: <jridgewell/sourcemaps@gen-mapping/0.3.9...gen-mapping/0.3.10>
>
> [0.3.9] - 2025-06-29
> ====================
>
> * Fix package types for CJS and ESM imports: <jridgewell/sourcemaps@a924ed3>
> * fix: use stable version of sourcemap-codec dependency: [#26](https://github.com/jridgewell/sourcemaps/tree/HEAD/packages/gen-mapping/issues/26) (thanks [`@​benmccann`](https://github.com/benmccann))
> * Add `module-sync` exports type for [require(esm)](https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js/): <jridgewell/sourcemaps@3836f6c>
> * Add type declaration source maps to assist go-to-definition: <jridgewell/sourcemaps@9a02665>
> * Temporarily remove scopes/ranges APIs: <jridgewell/sourcemaps@7575b63>
> * Include set-array source directly in gen-mapping project: [#1](https://github.com/jridgewell/sourcemaps/tree/HEAD/packages/gen-mapping/issues/1) (thanks [`@​benmccann`](https://github.com/benmccann))
>
> **Full Changelog**: <jridgewell/sourcemaps@gen-mapping/0.3.5...gen-mapping/0.3.9>
>
> [0.3.5] - 2024-03-01
> ====================
>
> * Add `ignoreList` support: <jridgewell/gen-mapping@9add0c2>
>
> **Full Changelog**: <jridgewell/gen-mapping@v0.3.4...v0.3.5>
>
> [0.3.4] - 2024-02-24
> ====================
>
> **Full Changelog**: <jridgewell/gen-mapping@v0.3.3...v0.3.4>
>
> [0.3.3] - 2023-04-07
> ====================

... (truncated)


Commits

* [`a969b67`](jridgewell/sourcemaps@a969b67) gen-mapping/0.3.13
* [`aab8d72`](jridgewell/sourcemaps@aab8d72) Use default subpath condition for fallback
* [`c780a90`](jridgewell/sourcemaps@c780a90) Update links to point to monorepo
* [`e2fa5d7`](jridgewell/sourcemaps@e2fa5d7) remapping/2.3.4
* [`26fe89d`](jridgewell/sourcemaps@26fe89d) gen-mapping/0.3.12
* [`a1c0fa0`](jridgewell/sourcemaps@a1c0fa0) Reorder subpath exports
* [`dd0615a`](jridgewell/sourcemaps@dd0615a) gen-mapping: Use `Object.assign` to avoid needing `getOwnPropertyDescriptors`...
* [`82195c5`](jridgewell/sourcemaps@82195c5) gen-mapping/0.3.11
* [`58ea44b`](jridgewell/sourcemaps@58ea44b) Update changelogs
* [`e0c7250`](jridgewell/sourcemaps@e0c7250) Why isn't GH autolinking commit SHAs?
* See full diff in [compare view](https://github.com/jridgewell/sourcemaps/commits/gen-mapping/0.3.13/packages/gen-mapping)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=@jridgewell/gen-mapping&package-manager=npm\_and\_yarn&previous-version=0.3.8&new-version=0.3.13)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
mergify Bot added a commit that referenced this pull request Oct 12, 2025
…4 [skip ci]

Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.13 to 0.8.14.
Release notes

*Sourced from [org.jacoco:jacoco-maven-plugin's releases](https://github.com/jacoco/jacoco/releases).*

> 0.8.14
> ------
>
> New Features
> ------------
>
> * JaCoCo now officially supports Java 25 (GitHub [#1950](https://redirect.github.com/jacoco/jacoco/issues/1950)).
> * Experimental support for Java 26 class files (GitHub [#1870](https://redirect.github.com/jacoco/jacoco/issues/1807)).
> * Branches added by the Kotlin compiler for default argument number 33 or higher are filtered out during generation of report (GitHub [#1655](https://redirect.github.com/jacoco/jacoco/issues/1655)).
> * Part of bytecode generated by the Kotlin compiler for elvis operator that follows safe call operator is filtered out during generation of report (GitHub [#1814](https://redirect.github.com/jacoco/jacoco/issues/1814), [#1954](https://redirect.github.com/jacoco/jacoco/issues/1954)).
> * Part of bytecode generated by the Kotlin compiler for more cases of chained safe call operators is filtered out during generation of report (GitHub [#1956](https://redirect.github.com/jacoco/jacoco/issues/1956)).
> * Part of bytecode generated by the Kotlin compiler for invocations of suspendCoroutineUninterceptedOrReturn intrinsic is filtered out during generation of report (GitHub [#1929](https://redirect.github.com/jacoco/jacoco/issues/1929)).
> * Part of bytecode generated by the Kotlin compiler for suspending lambdas with parameters is filtered out during generation of report (GitHub [#1945](https://redirect.github.com/jacoco/jacoco/issues/1945)).
> * Part of bytecode generated by the Kotlin compiler for suspending functions and lambdas with suspension points that return inline value class is filtered out during generation of report (GitHub [#1871](https://redirect.github.com/jacoco/jacoco/issues/1871)).
> * Part of bytecode generated by the Kotlin Compose compiler plugin for pausable composition is filtered out during generation of report (GitHub [#1911](https://redirect.github.com/jacoco/jacoco/issues/1911)).
> * Methods generated by the Kotlin serialization compiler plugin are filtered out (GitHub [#1885](https://redirect.github.com/jacoco/jacoco/issues/1885), [#1970](https://redirect.github.com/jacoco/jacoco/issues/1970), [#1971](https://redirect.github.com/jacoco/jacoco/issues/1971)).
>
> Fixed bugs
> ----------
>
> * Fixed handling of implicit else clause of when with String subject in Kotlin (GitHub [#1813](https://redirect.github.com/jacoco/jacoco/issues/1813), [#1940](https://redirect.github.com/jacoco/jacoco/issues/1940)).
> * Fixed handling of implicit default clause of switch by String in Java when compiled by ECJ (GitHub [#1813](https://redirect.github.com/jacoco/jacoco/issues/1813), [#1940](https://redirect.github.com/jacoco/jacoco/issues/1940)).
>   Fixed handling of exceptions in chains of safe call operators in Kotlin (GitHub [#1819](https://redirect.github.com/jacoco/jacoco/issues/1819)).
>
> Non-functional Changes
> ----------------------
>
> * JaCoCo now depends on ASM 9.9 (GitHub [#1965](https://redirect.github.com/jacoco/jacoco/issues/1965)).


Commits

* [`2eb2483`](jacoco/jacoco@2eb2483) Prepare release v0.8.14
* [`de76181`](jacoco/jacoco@de76181) KotlinSerializableFilter should filter more methods ([#1971](https://redirect.github.com/jacoco/jacoco/issues/1971))
* [`89c4bd5`](jacoco/jacoco@89c4bd5) Fix NPE in KotlinSerializableFilter ([#1970](https://redirect.github.com/jacoco/jacoco/issues/1970))
* [`0981128`](jacoco/jacoco@0981128) Migrate release staging to the Central Publisher Portal ([#1968](https://redirect.github.com/jacoco/jacoco/issues/1968))
* [`d07bc6b`](jacoco/jacoco@d07bc6b) Add filter for bytecode generated by Kotlin serialization compiler plugin ([#1](https://redirect.github.com/jacoco/jacoco/issues/1)...
* [`5e35fd5`](jacoco/jacoco@5e35fd5) Upgrade maven-dependency-plugin to 3.9.0 ([#1966](https://redirect.github.com/jacoco/jacoco/issues/1966))
* [`c2fe5cc`](jacoco/jacoco@c2fe5cc) Upgrade ASM to 9.9 ([#1965](https://redirect.github.com/jacoco/jacoco/issues/1965))
* [`b0f8e23`](jacoco/jacoco@b0f8e23) KotlinSafeCallOperatorFilter should filter "unoptimized" safe call followed b...
* [`c7bd3f4`](jacoco/jacoco@c7bd3f4) Upgrade spotless-maven-plugin to 3.0.0 ([#1961](https://redirect.github.com/jacoco/jacoco/issues/1961))
* [`faa289d`](jacoco/jacoco@faa289d) KotlinSafeCallOperatorFilter should not be affected by presence of pseudo ins...
* Additional commits viewable in [compare view](jacoco/jacoco@v0.8.13...v0.8.14)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.jacoco:jacoco-maven-plugin&package-manager=maven&previous-version=0.8.13&new-version=0.8.14)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
mergify Bot added a commit that referenced this pull request Dec 1, 2025
…in /studio [skip ci]

Bumps [swagger-ui-dist](https://github.com/swagger-api/swagger-ui) from 5.30.2 to 5.30.3.
Release notes

*Sourced from [swagger-ui-dist's releases](https://github.com/swagger-api/swagger-ui/releases).*

> v5.30.3
> -------
>
> [5.30.3](swagger-api/swagger-ui@v5.30.2...v5.30.3) (2025-11-25)
> ------------------------------------------------------------------------------------------
>
> ### Bug Fixes
>
> * **deps:** update vulnerable `@​release-it/conventional-changelog` to 10.0.2 ([#10645](https://redirect.github.com/swagger-api/swagger-ui/issues/10645)) ([6acfc6e](swagger-api/swagger-ui@6acfc6e))
> * **deps:** update vulnerable dependencies (js-yaml & glob) ([#10644](https://redirect.github.com/swagger-api/swagger-ui/issues/10644)) ([03cf01b](swagger-api/swagger-ui@03cf01b))
> * **utils:** handle sanitizing multi-level relative paths ([#10640](https://redirect.github.com/swagger-api/swagger-ui/issues/10640)) ([58aff59](swagger-api/swagger-ui@58aff59)), closes [#4107](https://redirect.github.com/swagger-api/swagger-ui/issues/4107)


Commits

* [`199761a`](swagger-api/swagger-ui@199761a) chore(release): cut the 5.30.3 release
* [`6acfc6e`](swagger-api/swagger-ui@6acfc6e) fix(deps): update vulnerable `@​release-it/conventional-changelog` to 10.0.2 ([#1](https://redirect.github.com/swagger-api/swagger-ui/issues/1)...
* [`03cf01b`](swagger-api/swagger-ui@03cf01b) fix(deps): update vulnerable dependencies (js-yaml & glob) ([#10644](https://redirect.github.com/swagger-api/swagger-ui/issues/10644))
* [`8d9142e`](swagger-api/swagger-ui@8d9142e) chore(deps): bump actions/checkout from 5 to 6 ([#10643](https://redirect.github.com/swagger-api/swagger-ui/issues/10643))
* [`58aff59`](swagger-api/swagger-ui@58aff59) fix(utils): handle sanitizing multi-level relative paths ([#10640](https://redirect.github.com/swagger-api/swagger-ui/issues/10640))
* [`85f0c5f`](swagger-api/swagger-ui@85f0c5f) chore(deps): bump js-yaml from 4.1.0 to 4.1.1 ([#10637](https://redirect.github.com/swagger-api/swagger-ui/issues/10637))
* [`7f75ee3`](swagger-api/swagger-ui@7f75ee3) chore(deps): bump actions/setup-node from 5 to 6 ([#10608](https://redirect.github.com/swagger-api/swagger-ui/issues/10608))
* [`2067270`](swagger-api/swagger-ui@2067270) chore(deps): bump github/codeql-action from 3 to 4 ([#10595](https://redirect.github.com/swagger-api/swagger-ui/issues/10595))
* See full diff in [compare view](swagger-api/swagger-ui@v5.30.2...v5.30.3)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=swagger-ui-dist&package-manager=npm\_and\_yarn&previous-version=5.30.2&new-version=5.30.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
lvca referenced this pull request in shaunpatterson/arcadedb Nov 17, 2026
…he record, also when the difference is the transaction's own

Builds on the contributor's fix, which reads the record's slot when a concurrent commit changed it after the read.
The object handed to the delete can differ from what the index holds for two more reasons, both inside one transaction
and both leaving the same orphan entry:

- a property assigned on a MutableDocument and never saved: the cleanup removed the entry of the assigned value, which
  the index never held, and kept the one of the stored value;
- an update saved earlier in the transaction, the delete going through an object read before it (or through the saved
  object after another assignment): the update is deferred to the commit, so the slot is unchanged, and the cleanup
  removed the entry the update had already replaced and kept the one it added.

The delete now resolves the image as GraphEngine.indexedImageOf does for a moved edge: the transaction's last indexed
snapshot for the index, otherwise the stored image (the slot when it changed, an immutable record over the buffer for a
MutableDocument with pending changes, the object itself in every other case). The record that is neither changed nor
pending still costs the pin its delete takes anyway and one comparison in place, with nothing allocated.

LocalBucket.getRecordInternal(rid, readPlaceHolderContent, fireEvents) goes back to package-private: the delete reads
the slot through the purpose-named getRecordForDeleteCleanup(rid), so skipping the before-read listeners is not offered
as a general way to read a record.

Test: three cases added for the own-transaction shapes (each failed with "Expecting empty but was: [#1:0]"), and the
before-read listener is unregistered in a finally block.

Not here, filed separately: CHECK DATABASE does not detect the entries an affected version left (ArcadeData#12471); a delete
through a stale object removes an unrelated record that reused the RID (ArcadeData#12472).
lvca added a commit that referenced this pull request Nov 18, 2026
… is now, not as it was read (#11735)

* fix(#11733): a delete cleans up the index entries of the record as it is now, not as it was read

* fix(#11733): read the current image for the cleanup without the READ_RECORD check, and fail the test on a failed concurrent update

* fix(#11733): read the delete's cleanup image without the before-read events, so a listener hiding the record does not keep the stale image

* fix(#11733): a delete cleans up from the indexed state of the record, also when the difference is the transaction's own

Builds on the contributor's fix, which reads the record's slot when a concurrent commit changed it after the read.
The object handed to the delete can differ from what the index holds for two more reasons, both inside one transaction
and both leaving the same orphan entry:

- a property assigned on a MutableDocument and never saved: the cleanup removed the entry of the assigned value, which
  the index never held, and kept the one of the stored value;
- an update saved earlier in the transaction, the delete going through an object read before it (or through the saved
  object after another assignment): the update is deferred to the commit, so the slot is unchanged, and the cleanup
  removed the entry the update had already replaced and kept the one it added.

The delete now resolves the image as GraphEngine.indexedImageOf does for a moved edge: the transaction's last indexed
snapshot for the index, otherwise the stored image (the slot when it changed, an immutable record over the buffer for a
MutableDocument with pending changes, the object itself in every other case). The record that is neither changed nor
pending still costs the pin its delete takes anyway and one comparison in place, with nothing allocated.

LocalBucket.getRecordInternal(rid, readPlaceHolderContent, fireEvents) goes back to package-private: the delete reads
the slot through the purpose-named getRecordForDeleteCleanup(rid), so skipping the before-read listeners is not offered
as a general way to read a record.

Test: three cases added for the own-transaction shapes (each failed with "Expecting empty but was: [#1:0]"), and the
before-read listener is unregistered in a finally block.

Not here, filed separately: CHECK DATABASE does not detect the entries an affected version left (#12471); a delete
through a stale object removes an unrelated record that reused the RID (#12472).

* test(#11733): a stale-read delete removes the EXTERNAL value a concurrent change added

The cascade of the EXTERNAL values follows the stored image as the index cleanup does, and nothing pinned it: the record is read without the value, a concurrent transaction sets it and commits, the delete goes through the object read first. Before the fix the value stayed in the paired bucket, referenced by nothing (the test fails on the pre-fix LocalDatabase).

* fix(#11733): the delete pins the page of a placeholder's content before it picks the image it cleans up with

A placeholder keeps its content on another page, and an update absorbed by the content record changes that page only: the pointer's page, the one the delete pinned before comparing, is untouched. The delete pinned the content's page when it freed it, after the cleanup, so a content-only update committed between the two was deleted with the record while the index entries removed were those of the content read before it. LocalBucket.pinRecordForDelete pins both pages before the comparison: a change of the content committed later is a newer version of a page the delete holds and poisons for the slot merge, hence the retryable conflict. It is the page the delete modifies anyway, so nothing is added for a plain record but two reads of its slot header.

A multi-page record needs nothing more: a rewrite of its chain goes through the head chunk, on the page already pinned.

Test: on a real placeholder (sealed page), an update of the content committed after the pin makes the delete's commit fail with ConcurrentModificationException and leaves record and index as the update wrote them. Without the content pin the commit went through.

* fix(#11733): a record deleted before it was loaded is cleaned up from the slot its delete pinned

A record handed out without its content (lookupByRID(rid, false)) has no buffer, and the cleanup returned it as it was: it then loaded itself when the index cleanup asked its properties, before its page was pinned, which is the window this issue is about, one step later. With no image to compare, the delete now pins the record and reads it from the slot, the caller's object left unloaded.

Test: the delete of an unloaded record after a concurrent committed change leaves no index entry and does not load the caller's object (the second assertion failed before: the cleanup loaded it).

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 18, 2026
…rops anything (#12064)

Fixes #12034

`DROP PROPERTY S.p FORCE` dropped `S`'s own indexes on `p` (the list
`getIndexesByProperties` gives), then `dropProperty` refused because an
index a SUBTYPE declared on the inherited `p` still used it. The refused
statement left the property in place and its UNIQUE index gone.

### What changes

- `LocalDocumentType.getSubTypeIndexesOnProperty(p)`: every index a sub
type (at any depth) declared on the property this type owns, with the
same shadowing rule `dropProperty` and `renameProperty` already apply (a
sub type that declares its own `p` is passed over).
- `LocalDocumentType.checkPropertyCanBeDropped(p, droppedWithIt)`: the
refusals of `dropProperty` (declared TIMESERIES column, an index on the
property anywhere in the hierarchy), passing over the indexes the caller
is about to drop. `dropProperty` itself now calls it with an empty list,
so the two cannot drift apart.
- `DropPropertyStatement`:
- the index list includes the sub types' indexes on the property, so
`FORCE` drops them with the type's own, in the same one `dropIndexes`
call (#10589), and the refusal without `FORCE` names them too;
- with `FORCE`, everything the property drop can refuse for is asked
before the first index goes. What `FORCE` cannot answer (an index of a
super type on a property of the same name) is refused with nothing
dropped.

### Tests

`SchemaDdlAtomicityTest.DropPropertyForceWithASubTypeIndex` (new nested
class):

- `DROP PROPERTY S.p FORCE` drops `S[p]` and `T[p,u]` and the property;
- `DROP PROPERTY S.p` without `FORCE` names both indexes and changes
nothing;
- with a super type's index on a same-named property, `FORCE` is refused
before any index is dropped: `S[p]` stays and still refuses a duplicate.

### Results

Engine tests (Docker, maven:3.9-eclipse-temurin-21):

- failing-first: `SchemaDdlAtomicityTest` 469 run, 3 fail
(`forceDropsTheSubTypeIndexTooAndThenTheProperty`,
`withoutForceTheRefusalNamesTheSubTypeIndexAndNothingChanges`,
`aRefusalForceCannotAnswerComesBeforeAnyIndexIsDropped`).
- `-Dtest='com/arcadedb/schema/**/*Test,SchemaDdlAtomicityTest'
-DexcludedGroups=slow`: 1809 tests, 0 failures, 0 errors, 0 skipped.

End to end, HTTP against a server built from main (`s12034` repro):

Server with the main jars (a7304ab):

| statement | HTTP | answer |
|---|---|---|
| `CREATE DOCUMENT TYPE S` | 200 | [{"operation": "create document
type", "typeName": "S", "created": true}] |
| `CREATE DOCUMENT TYPE T EXTENDS S` | 200 | [{"operation": "create
document type", "typeName": "T", "created": true}] |
| `CREATE PROPERTY S.p INTEGER` | 200 | [{"operation": "create
property", "typeName": "S", "propertyName": "p", "created": true}] |
| `CREATE PROPERTY S.u STRING` | 200 | [{"operation": "create property",
"typeName": "S", "propertyName": "u", "created": true}] |
| `CREATE INDEX ON S (p) UNIQUE` | 200 | [{"operation": "create index",
"name": "S[p]", "type": "LSM_TREE", "created": true, "totalIndexed": 0}]
|
| `CREATE INDEX ON T (p, u) NOTUNIQUE` | 200 | [{"operation": "create
index", "name": "T[p,u]", "type": "LSM_TREE", "created": true,
"totalIndexed": 0}] |
| `INSERT INTO S SET p = 1` | 200 | [{"@Rid": "#1:0", "@type": "S",
"@cat": "d", "p": 1}] |
| `INSERT INTO T SET p = 2, u = "x"` | 200 | [{"@Rid": "#2:0", "@type":
"T", "@cat": "d", "p": 2, "u": "x"}] |
| `SELECT name FROM schema:indexes WHERE associatedBucketId IS NULL
ORDER BY name` | 200 | [{"name": "S[p]"}, {"name": "T[p,u]"}] |
| `DROP PROPERTY S.p FORCE` | 400 | "SchemaException: Error on dropping
property 'p' because used by index 'T[p,u]'" |
| `SELECT name FROM schema:indexes WHERE associatedBucketId IS NULL
ORDER BY name` | 200 | [{"name": "T[p,u]"}] |
| `SELECT name, properties.name AS props FROM schema:types WHERE name =
'S'` | 200 | [{"name": "S", "props": ["p", "u"]}] |
| `INSERT INTO S SET p = 1` | 200 | [{"@Rid": "#1:1", "@type": "S",
"@cat": "d", "p": 1}] |

Same server, engine jar built from this branch:

| statement | HTTP | answer |
|---|---|---|
| `CREATE DOCUMENT TYPE S` | 200 | [{"operation": "create document
type", "typeName": "S", "created": true}] |
| `CREATE DOCUMENT TYPE T EXTENDS S` | 200 | [{"operation": "create
document type", "typeName": "T", "created": true}] |
| `CREATE PROPERTY S.p INTEGER` | 200 | [{"operation": "create
property", "typeName": "S", "propertyName": "p", "created": true}] |
| `CREATE PROPERTY S.u STRING` | 200 | [{"operation": "create property",
"typeName": "S", "propertyName": "u", "created": true}] |
| `CREATE INDEX ON S (p) UNIQUE` | 200 | [{"operation": "create index",
"name": "S[p]", "type": "LSM_TREE", "created": true, "totalIndexed": 0}]
|
| `CREATE INDEX ON T (p, u) NOTUNIQUE` | 200 | [{"operation": "create
index", "name": "T[p,u]", "type": "LSM_TREE", "created": true,
"totalIndexed": 0}] |
| `INSERT INTO S SET p = 1` | 200 | [{"@Rid": "#1:0", "@type": "S",
"@cat": "d", "p": 1}] |
| `INSERT INTO T SET p = 2, u = "x"` | 200 | [{"@Rid": "#2:0", "@type":
"T", "@cat": "d", "p": 2, "u": "x"}] |
| `SELECT name FROM schema:indexes WHERE associatedBucketId IS NULL
ORDER BY name` | 200 | [{"name": "S[p]"}, {"name": "T[p,u]"}] |
| `DROP PROPERTY S.p FORCE` | 200 | [{"operation": "cascade drop index",
"indexName": "S[p]"}, {"operation": "cascade drop index", "indexName":
"T[p,u]"}, {"operation": "drop property", "typeName": "S",
"propertyName": "p", "dropped": t |
| `SELECT name FROM schema:indexes WHERE associatedBucketId IS NULL
ORDER BY name` | 200 | [] |
| `SELECT name, properties.name AS props FROM schema:types WHERE name =
'S'` | 200 | [{"name": "S", "props": ["u"]}] |
| `INSERT INTO S SET p = 1` | 200 | [{"@Rid": "#1:1", "@type": "S",
"@cat": "d", "p": 1}] |

Overlap note: separate PRs for #12031, #12032, #12035, #12036, #12038
and #12039 are being prepared in the same area (`LocalDocumentType`,
`LocalSchema`, `ExistingRecordsCheck`, the ALTER/CREATE TYPE
statements). Textual merge conflicts with them are possible; the changes
are meant to be independent.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* `DROP PROPERTY ... FORCE` now removes indexes on the property across
applicable subtypes, including nested subtypes, while preserving indexes
on shadowing properties.
* Without `FORCE`, a property drop blocked by indexes reports the
blocking indexes and leaves the schema unchanged.
* If a drop is blocked by an index on a supertype, no subtype index or
property is removed.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 18, 2026
… once per older entry (#12237)

Fixes #12225.

### Problem

Since #11151 (d8a3c34) the crash recovery re-applies a WAL entry
older than the page on disk as a torn-page repair when the WAL holds
every version of the page after it, up to the version on disk.
`firstMissingChainVersion()` answered that by walking the versions from
the entry up to the disk version, for every older entry. A page with V
versions in the WAL whose disk copy is near the last of them cost about
V^2/2 lookups. A TIMESERIES shard page 0 is such a page: every row of an
INSERT is its own commit (#7410) and writes it. 160,000 rows written in
12 s took 192 s to replay on main (4.2 s on 26.10.1), and the server
answers `/api/v1/ready` only after the replay.

### Change

`TransactionManager.firstMissingChainVersion()` walks the chain of a
page once per replay, down from the disk version to the highest version
the WAL holds no entry of (0 when it holds them all), and keeps that
version per page in `recoveryChainGaps`. An older entry has a complete
chain exactly when it is at or above that version, so each later entry
of the page compares one number.

What #11151 and #11152 decide is unchanged:

- An entry is re-applied only when every version after it up to the disk
version is in the WAL. The answer is the same as the walk up from the
entry. A missing version above the entry exists iff the highest missing
version up to the disk version is above the entry.
- An entry with a gap is still skipped, and the page is still warned
about once. The first warning of a page still names the first missing
version after the entry (the walk up from the entry runs for that
warning only). Later skipped entries of a warned page get the highest
missing version, which only the warning would read.
- The cache is keyed on the disk version it was computed for and cleared
with the other replay state. During a replay a page's disk version does
not move under a repair (the repair keeps the version), and a page the
replay applied an entry to is answered -1 before the cache is read, as
before.

A package-visible counter of the versions looked up
(`getRecoveryChainProbesForTesting()`) is the seam the new tests read.

### Tests

Two tests in `WalRecoveryTest.TornMultiVersionPageRecovery`, next to the
#11151 tests: 3,000 updates of one record, each its own commit and so
its own version of one bucket page, kept off the disk with the flush
suspended, then a kill. The header of the page on disk is then set to
the last version (a complete chain) or to two versions beyond the last
one in the WAL (a gapped chain), as the #11151 tests do.

- `aCompleteChainOfManyVersionsIsCheckedOncePerPage`: the record reads
back with its last value, and the lookups are at most 3 x 3,000.
- `aGappedChainOfManyVersionsIsCheckedOncePerPage`: one warning for the
page, and the lookups are at most 3 x 3,000.

Failing first: with the counter added and the method otherwise as on
main, both fail with `Expecting actual: 4501503L to be less than or
equal to: 9000L`. With the change both pass.

- `WalRecoveryTest` (15 tests, the 4 tests of #11151/#11152 included):
15 tests, 0 failures, 0 errors
- Recovery and WAL tests of the engine (`*Recover*`, `*Wal*`, `*WAL*`,
`Dictionary*`, `TransactionManager*`, `ApplyChangesPartialReplayTest`,
`ACIDTransactionTest`, `StatementSavepointTest`): 285 tests in 41
classes, 0 failures, 0 errors
- Full engine module (`-pl engine test
-DexcludedGroups=slow,benchmark`): 2,026 classes, 31,846 tests, 4
failures, 3 errors, 106 skipped. The 7 are:
- `ParallelSafeExpressionsStateTest` (1) and
`CypherCallInTransactionsOnErrorIssue11595Test` (3), red on main.
- `ReplicatedApplyPublicationTest` (2). On main 7fffe29 the class
failed 1 of 3 runs on its own, with 2 of the same tests failing.
- `FacetExecutorTermsTest.includeLiteralIsConvertedAsWhereConvertsIt`
(1). The class passes on this branch when run alone.
- `PageSnapshotWindowTest` was left out of that run. In a first full run
its fork hung for 30 minutes in `TestHelper.afterTest`
(`PageManager.beginDatabaseClose`). Run alone afterwards it passes, 43
of 43 on this branch and on main.

### End to end

Server image 26.12.1-SNAPSHOT with the jars of main 1541bf7, the
engine jar from main or from this branch. A TIMESERIES type (`SHARDS 1`)
gets N rows in INSERT statements of 10,000 rows, the container is
SIGKILLed after the last answer and restarted. The replay time is
between the server's `Started recovery of database` and `Recovery of
database ... completed` lines. The script is in #12225.

| rows | WAL at the kill | main 1541bf7 | this branch | 26.10.1 |
|---|---|---|---|---|
| 20,000 | 4.1 MB | 6.5 s | 3.0 s | 1.7 s |
| 40,000 | 7.9 MB | 19.3 s | 4.9 s | 2.6 s |
| 80,000 | 15.5 MB | 55.6 s | 10.0 s | 3.4 s |
| 160,000 | 30.1 MB | 192.2 s | 17.8 s | 4.2 s |

Every recovered database held all its rows. The main and 26.10.1 columns
were measured in the same session before this change, on the same host.
With the change the replay grows about linearly (about 2x per doubling,
against about 3x on main). It is still about 4x slower than 26.10.1. The
repair itself writes the page once per older entry
(`writePageWithLock`), which 26.10.1 did not do. That cost is linear and
is part of the #11151 guarantee, so this PR leaves it. (Superseded: the
second commit, below, removes that per-entry write. The table above
measures the first commit only.)

### Second commit: a repaired page is written once, not once per older
entry

The first commit leaves the repair writing the page once per older
entry: it copies the page, writes it to the data file and publishes
another copy to the read cache. On a 3,000-version page that is 3,004
page writes for one open. The second commit removes that write and keeps
what #11151 guarantees.

- A complete chain always ends on the entry at the version on disk,
which the same replay reaches next and applies at an equal version. The
repairs of a page now accumulate on one in-memory image
(`recoveryPendingRepairs`, scoped to the replay). The equal-version
apply starts from a copy of that image (`MutablePage.copy()`) and writes
the page once. Working on a copy means an entry that fails part-way (a
segment outside the page aborts the replay) does not leave some of its
bytes in the repairs.
- Durability. The data written is the same as before, but later:
- Every exit of the replay loop (end of the WAL, version gap, corrupt
record, a replay that throws on what the pages hold) falls through to
`writePendingRecoveryRepairs()`. That runs before
`syncReplayedDataFiles()` and before the WAL is dropped or renamed to
`.corrupt`. The loop has no `return`.
- If a failure escapes the loop (an I/O error), the input is not
released, so the WAL stays in place and the next open repairs the pages
again. Nothing held is written then, and nothing needs to be.
- If a held image fails to write, a `WALException` is thrown. Neither
`applyChanges` nor the loop catches it, so it escapes the same way and
the WAL is kept. The map is cleared only after every image is written.
- Memory is bounded at 64 MB. A page can be held from its first older
entry to its last, which can be the whole length of the WAL. Over the
budget, every held image is written (what each repair did before) and
the map starts again, so the replay never writes more than it did
before. The budget is a static field so a test can shrink it, like
`applyChangesHookForTesting`, because the replay runs inside the open.
Any value is correct: the budget changes only how often the held images
are written, never what is written.
- The schema dictionary still writes each repair immediately, because it
is reloaded from its pages right after the entry.
- The probe counter and the new page-write counter are reset when each
replay starts.

Measured with the 3,000-version test page: 3,004 page writes and 103 ms
to open before, 4 writes and 48 ms after. The end-to-end table above was
not re-measured.

New and extended tests in
`WalRecoveryTest.TornMultiVersionPageRecovery`:

- `aCompleteChainOfManyVersionsIsCheckedOncePerPage` also asserts that
the replay writes at most 10 pages. With a write per repair it fails at
3,004.
- `aReplayStoppedBeforeTheEndOfTheChainStillWritesTheRepairs`: the last
entry of the chain is moved outside the page, so applying it throws. The
record must then hold the value of the entry before it. Without the
end-of-loop write it reads -1, the stale disk image.
- `repairsOverThePendingBudgetAreWrittenAndStillRepairEveryPage`: two
pages are repaired in turn with no budget, each version inserting its
own record, so every version writes bytes that no later version
rewrites. If the held images were dropped instead of written, records
would be lost (`Record #1:1 not found`).
- `anOlderEntryWithASegmentOutsideThePageLeavesTheHeldRepairsAsTheyWere`
(from the review): two repairs are already held when an older entry
arrives whose first segment fits the page and whose second does not.
Every segment is now checked against the page bounds before any of them
touches the held image, so the replay stops on that entry without any of
its bytes in the image that the end of the replay writes. Without the
check, the record holds 2 instead of 1.

Verification on this branch (`mvn -o -pl engine -am test -Dtest=...
-DexcludedGroups=benchmark`): 598 tests in the recovery, WAL,
replicated-apply, crash, columnar, time-series, sparse-vector and
dictionary classes, 0 failures, 0 errors. That includes
`WalRecoveryTest` (18), `PageSnapshotWindowTest` (43 of 43, no hang),
`PageSnapshotTest`, `PageSnapshotMetricsTest`, and all six
`ReplicatedApply*` classes (62 tests, `ReplicatedApplyPublicationTest`
21 of 21).

### Overlap with #12151

#12151 (open) touches `LocalDatabase`, `Dictionary`, `LocalProperty` and
`LocalSchema`, not `TransactionManager` or `WalRecoveryTest`: no textual
overlap. Semantically it changes what the schema load writes before the
replay (no dictionary name registered ahead of it), which decides how
many dictionary entries the replay finds older than the page on disk.
This PR changes only how the chain of such entries is checked, so the
two are independent and either can merge first.

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 18, 2026
…rty saved as null is read back (#12224)

Fixes #12197.

## Problem

Two value-fidelity gaps of the gRPC Java client (`RemoteGrpcDatabase`):

1. A persistent record set as a property value (`doc.set("owner",
otherDoc)`) was stored as the STRING `"#1:0@Doc[name=target]"`, the
record's `toString()`, instead of a LINK.
2. A property saved as null was stored (`IS DEFINED` true on the server)
but was missing from the record read back with `lookupByRID()`: `has()`
was false and `getPropertyNames()` left it out.

## Change

- `grpc-client` `ProtoUtils.toGrpcValue()`: an `Identifiable` with an
identity (a persistent document, vertex or edge) is encoded as a
`GrpcLink`, like a `RID`. Before, it matched no branch and reached the
`String.valueOf()` fallback. A document without an identity is still an
embedded document (the next branch).
- `grpcw` `ArcadeDbGrpcService.convertToGrpcRecord()`: a null-valued
property is sent as an unset `GrpcValue` instead of being skipped.
`convertResultToGrpcRecord()` already does this for projections "so
clients can always address every projected alias by key, matching the
HTTP serializer's {"key": null} behavior". The client already decodes an
unset value as null.

## Tests

New
`grpc-client/src/test/java/com/arcadedb/remote/grpc/Issue12197GrpcRecordValueAndNullPropertyIT`:

| test | before the fix | after |
|---|---|---|
| `aRecordSetAsAValueIsStoredAsALink`: `owner` set from a read record,
`creator` from the saved `MutableDocument` | stored type STRING | LINK,
`owner.name` = `target` |
| `aPropertySavedAsNullIsReadBack` | `has("nothing")` false | true,
value null |

Failing first: with `grpc-client/src/main` and `grpcw/src/main` reverted
to `origin/main`, both tests fail as in the "before" column.

gRPC regression run: `-pl grpcw,grpc-client -am test
-Dtest='com/arcadedb/remote/grpc/**,com/arcadedb/server/grpc/**'
-DexcludedGroups=benchmark,slow`: 245 classes, 1,545 tests, 0 failures,
0 errors.

End to end (differential harness, server and client from this branch): a
record set as a value is stored as LINK and `recordValue.name` traverses
to `target` (it was STRING `"#1:0@Doc[name=target]"`);
`has("nullValue")` after `lookupByRID()` is true (was false). The link
is still read back as its text: that is #12195, fixed separately.

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 20, 2026
…perty back as a RID (#12228)

Fixes #12195.

## Problem

A LINK stored in a property the schema does not declare was read back by
both Java remote clients as a `String` (`"#1:0"`), and lists and maps of
links as strings. `(Identifiable) doc.get("friend")` threw
`ClassCastException`. The HTTP client also disagreed with itself: a
projection of the same single link answered a `RID`.

## Change

HTTP (`engine` `JsonSerializer`):
- An element row already carried an `@props` hint for an undeclared
property whose value is non-finite (#10905), since nothing else tells
the client what the JSON text stands for. A link is in the same
position: it goes out as its `"#12:0"` text. So an undeclared property
holding a link, or a list or map of links only, now gets its hint too
(`friend:11`, `friends:9(11)`, `byName:10(11)`). Every other element row
keeps its shape. As before, hints are only emitted when the request asks
for them (`typeHints`, which `RemoteDatabase` sends).
- `appendTypeHint()` adds LINK as an element type for a LIST/MAP whose
non-null items are all links, so a projected list of links is typed too.
- No client change was needed for HTTP: `RemoteImmutableDocument`
already applies `@props` to undeclared properties, and converts a LINK
hint (and a LINK element hint) to `RID`. A string that only looks like a
RID (`'#1:0'` stored as text) gets no hint and stays a String.

gRPC (`grpc-client`):
- `ProtoUtils.fromGrpcValue()` decodes `LINK_VALUE` as a `RID` instead
of its text, for record properties and projections alike.
- Two places that cast what they received to `String` now accept a
`RID`. One is `RemoteImmutableEdge` for `@out`/`@in`, which the server
sends as links. The other is `RemoteImmutableDocument` for `@rid`, when
a projection row carries it as a property.

## Tests

- `server` `Issue12195RemoteLinkReadBackIT` (HTTP): link, list of links
and map of links read back as `RID` through `lookupByRID()`, a query row
and `iterateType()`, plus the `Identifiable` cast; a projected list of
links is a list of `RID`; a string that looks like a RID stays a string.
- `grpc-client` `Issue12195GrpcLinkReadBackIT`: link and list of links
read back as `RID` through `lookupByRID()` and a projection; edges still
resolve `getOut()`/`getIn()`, `countEdges()` works, and `SELECT @Rid,
@type, name` keeps its identity.

Failing first: with `engine/src/main`, `network/src/main` and
`grpc-client/src/main` reverted to `origin/main`: 3 of the 5 tests fail
as described in the issue (`"#1:0"` instead of `#1:0` for the HTTP
record read and projected list, and for the gRPC record read); the two
guards (a RID-looking string stays a string, edges and `@rid`
projections over gRPC) pass both before and after.

Regression run: `-pl engine,network,server,grpc-client -am test
-Dtest='com/arcadedb/serializer/**,com/arcadedb/remote/**,com/arcadedb/server/http/handler/**,*TypeHint*,*Issue5812*,*Issue10905*,*Issue4267*,*Issue4849*'
-DexcludedGroups=benchmark,slow`: 372 classes, 3,089 tests, 1 failure:
`ProtoUtilsTest.fromGrpcValueLink`, which asserted the old decoding
(`"#10:5"`). It now expects `new RID(10, 5)`, the behavior this PR
introduces; `com/arcadedb/remote/grpc/utils/**` is green after that
change (64 tests).

End to end with the differential harness (server and client jars from
this branch): HTTP: `friend` (LINK) reads back as `RID #1:0` from
`lookupByRID()` and a projection, `friends` as `[RID #1:0]`, `byName` as
`{x=#1:0}` (RID), `(Identifiable) d.get("friend")` works. gRPC:
`ridValue`/`ridList` read back as RID. The differential graph and
supernode probes (P2, P4) report the same set of differences before and
after, over HTTP and over gRPC.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Remote and gRPC reads now preserve database links as RID values,
including links nested in lists and maps, instead of returning them as
text.
* Remote edge endpoints and document identities correctly handle RID
values.
* JSON type hints now identify undeclared links and homogeneous
collections or maps of links, including projected results. Strings that
resemble RIDs and mixed-value collections remain distinguishable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 21, 2026
…ting by it deletes that edge only (#12145)

Fixes #12132.

### Problem

Every lightweight edge of a type answered the same `elementId()`, the
record-less marker `#<type bucket>:-1` that the edge lists store. The
relationship element-id filter is a per-row string compare, so with an
id read from ONE edge, `MATCH ()-[r:L]->() WHERE elementId(r) = $id
DELETE r` deleted EVERY lightweight edge of the type. Bolt put the same
string in `Relationship.element_id`, so a driver that sent it back hit
the same delete. SQL `SELECT DISTINCT(@this) FROM L` also collapsed all
the lightweight edges into one row.

### Semantics chosen

A lightweight edge gets an element id that names it, built from what its
`LightEdgeRID` already carries:

```
#<type bucket>:-1/<out RID>/<in RID>          e.g. #7:-1/#1:0/#4:0
#<type bucket>:-1/<out RID>/<in RID>/<n>      the n-th (n >= 1) parallel twin of the same (type, out, in)
```

Why this shape, and not refusing (`null`) the way `id()` does since
#9573:
- openCypher / Neo4j: `elementId()` identifies one relationship and is
meant to be handed back. A `null` would make the delete safe but would
break every application that reads relationship ids. Lightweight edges
have no properties, so endpoints plus the twin occurrence are their
whole identity. That is the identity the engine already uses for `=`,
`DISTINCT` and relationship uniqueness (`LightEdgeRID.isSameEdge` /
`distinctKey`, #9573, #10008).
- It is deliberately NOT a RID (`RID.is()` is false for it). No RID seek
and no `id()`/RID-string coercion in `ComparisonExpression` can take it
for a record address. The old `#7:-1` value now matches no edge at all,
instead of all of them.
- It is the same from either end. The out and in lists number twins
alike (tested from the OUT side, the IN side and undirected).
- Twins: the occurrence is resolved through the iteration's
`LightEdgeCensus`, so a list is walked about twice per iteration, not
once per edge. After one twin is deleted, the occurrences renumber.
Which twin a stale id names can therefore shift, but twins carry nothing
to tell them apart, and deleting by either twin's id removes exactly one
(tested for both twins).
- `id()` stays `null` (#9573): a lightweight edge has no position to
encode in the numeric id.

### Changes

- `LightEdgeRID.toElementId()`: the id above.
- `ElementIdFunction`: answers `ElementIdFunction.of(rid)`, the RID
string for records and `toElementId()` for a lightweight edge.
- `BoltStructureMapper.toRelationship` / `toUnboundRelationship`: use
the same `ElementIdFunction.of`, so the Bolt `element_id` and
`elementId(r)` agree. Mapping a lightweight edge also threw before
(`Cannot encode RID #4:-1 as a numeric id()`), so no Bolt query could
return one. A lightweight relationship now gets a negative numeric id, a
64-bit FNV-1a hash of its element id. No record id is negative, so the
two can never collide, and `id(r)` stays null, so no `WHERE id(r) = ...`
can resolve to it.
- `DistinctExecutionStep` (SQL `DISTINCT`): a row whose element identity
determines the output but has no record address (the RID fast path
refuses `position < 0`) was keyed by its properties alone, and a
lightweight edge has none. It is now keyed by its identity too, with
twins told apart by `LightEdgeRID.distinctKey()`, as in openCypher.

### Tests

- `CypherLightEdgeTest.Issue12132LightEdgeElementId` (engine; all red on
`main` except the side-independence check):
- three lightweight edges have three distinct ids, none parses as a RID,
and record-backed edges still answer their RID
- the id is the same read from the OUT side, the IN side and undirected
- deleting by the id of one edge, in a second statement or in the same
statement through `WITH`, deletes only that edge; the old `#bucket:-1`
value deletes nothing
- parallel twins have distinct ids, the same from both ends; deleting by
either twin's id leaves the other
- SQL `SELECT DISTINCT(@this) FROM L` and `SELECT DISTINCT @this FROM L`
return 3 rows
- `Issue12132LightEdgeElementIdTest` (bolt): the Bolt relationship and
unbound-relationship element ids equal `elementId(r)` and differ per
edge; the numeric ids are negative and differ per edge (on `main` the
mapping throws).

Ran: `CypherLightEdgeTest` (all nested), `LightEdgeRIDOccurrenceTest`,
`LightEdgeCensusTest`, `CollectDistinctTest`,
`CypherExplainTraditionalPlanTest`, `CypherMissingFunctionsTest`,
`OpenCypherCollectUnwindTest`, `OpenCypherFunctionTest`,
`OpenCypherScalarFunctionsComprehensiveTest`,
`DistinctWithGroupByUnwindExpandTest`, `DistinctExecutionStepTest`,
`SelectStatementExecutionTest`, `LightweightEdgeTypeTest`,
`LightweightEdgeScanAndWriteTest`, `LightEdgeRegressionTest` (engine);
`Issue12132LightEdgeElementIdTest`, `Bolt4998PathMappingTest`,
`BoltStructureTest` (bolt).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Lightweight relationships now have distinct, stable element IDs,
including when multiple relationships connect the same vertices.
* Using an element ID to delete a lightweight relationship now removes
only the matching relationship.
* Queries and returned paths now distinguish parallel lightweight
relationships correctly, including when applying `DISTINCT` or reading
relationships from either direction.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 21, 2026
…TTP (#11988)

Fixes #11974.

### Problem

Three openCypher user errors were raised as a plain
`CommandExecutionException`, which no `ErrorCategory` rule classifies,
so every protocol answered them as a server fault: Bolt
`Neo.DatabaseError.General.UnknownError`, HTTP 500. Neo4j answers each
with a client error.

### Change

Each is raised as the engine exception its classification comes from, at
the source; the protocols map the types, not the messages.

| user error | raised as | ErrorCategory | Bolt | HTTP |
|---|---|---|---|---|
| `DELETE` of a node that still has relationships
(`DeleteConnectedNode`, `DeleteStep`) | `ObjectInUseException` (exists,
#11803) | VALIDATION |
`Neo.ClientError.Schema.ConstraintValidationFailed` | 409 (existing arm)
|
| reading, setting or linking a node deleted earlier in the statement
(`DeletedEntityAccess`, `DeletedEntityMarker`, `WritePatternChecks`) |
new `DeletedEntityException` | NOT_FOUND (new rule) |
`Neo.ClientError.Statement.EntityNotFound` | 404 (new arm) |
| `LOAD CSV` URL that cannot be opened or read (`LoadCSVStep`) | new
`ExternalResourceException`, an `InvalidArgumentException` | VALIDATION
| `Neo.ClientError.Statement.ExternalResourceFailed` (new code) | 400
(existing arm) |

- `DeletedEntityException` is a `CommandExecutionException` and
deliberately not a `RecordNotFoundException`: the engine catches that
one around record loads to skip a dangling pointer, and a deleted entity
read inside such a block must still fail the statement.
- Bolt: two arms in `classifyExecutionError` for the VALIDATION
category, `ObjectInUseException` and `ExternalResourceException`, and
the `EXTERNAL_RESOURCE_FAILED_ERROR` code.
- Both new types are in `RemoteExceptionRebuilder`, so the HTTP and gRPC
Java drivers rebuild them as themselves (the census tests `Issue11045*`
require it).
- [Inference, not run] Postgres and gRPC classify by `ErrorCategory`, so
they follow the new categories as well.

### Tests

New:
- `Issue11974CypherUserErrorTypesTest` (engine, 3): each statement
raises its type, with its category; the statement that failed after a
DELETE left the node in place.
- `Issue11974BoltUserErrorClassificationTest` (bolt, 3): the Bolt code
of the exception the engine really throws.
- `Issue11974CypherUserErrorStatusTest` (server, 3): HTTP 409 / 404 /
400 with the exception class and the message.

Failing first, with `engine/src/main`, `bolt/src/main`,
`server/src/main` and `network/src/main` checked out from `origin/main`
(the two new exception classes kept, so the tests compile), all 9 new
tests fail:
- `Issue11974CypherUserErrorTypesTest` 3/3 (no `ObjectInUseException` /
`DeletedEntityException` / `ExternalResourceException` in the chain),
- `Issue11974BoltUserErrorClassificationTest` 3/3
(`Neo.DatabaseError.General.UnknownError` for each),
- `Issue11974CypherUserErrorStatusTest` 3/3 (HTTP 500 for each).

With the fix, the `com.arcadedb.query.opencypher` and
`com.arcadedb.exception` packages of the engine, every bolt unit test,
the new tests, `Issue11045RemoteExceptionTypeTest`,
`Issue11045GrpcCommandExceptionTypeTest`,
`Issue11803SqlUserErrorStatusTest` and `AbstractServerHttpHandler*Test`:
577 classes, 9307 tests, 4 not green, all also red on `origin/main` with
the same sources: `ParallelSafeExpressionsStateTest` (1, #11926) and
`CypherCallInTransactionsOnErrorIssue11595Test` (3 errors, "CALL { ... }
IN TRANSACTIONS can only be executed in an implicit transaction").

### End to end

Python neo4j driver 6.4.1 and HTTP against a server with the jars of
`origin/main` (`2eb615cd26`) and then of this branch (`bolt_fix_e2e.py
11974`):

Before:
```
== #11974
  bolt MATCH (n:A) DELETE n                                                   -> Neo.DatabaseError.General.UnknownError | DeleteConnectedNode: Cannot delete node #1:0 because it still has relationships. To delete this node, you must first delete its relationships, or use
  http MATCH (n:A) DELETE n                                                   -> 500 CommandExecutionException
  bolt MATCH (n:A) DELETE n RETURN n.x AS x                                   -> Neo.DatabaseError.General.UnknownError | DeletedEntityAccess: Cannot access a deleted entity
  http MATCH (n:A) DELETE n RETURN n.x AS x                                   -> 500 CommandExecutionException
  bolt MATCH (n:A) DELETE n SET n.y = 1                                       -> Neo.DatabaseError.General.UnknownError | DeletedEntityAccess: Cannot access a deleted entity
  http MATCH (n:A) DELETE n SET n.y = 1                                       -> 500 CommandExecutionException
  bolt MATCH (n:A) DELETE n CREATE (n)-[:R]->(:B)                             -> Neo.DatabaseError.General.UnknownError | DeletedEntityAccess: Failed to create the relationship: node `n` was deleted in this transaction
  http MATCH (n:A) DELETE n CREATE (n)-[:R]->(:B)                             -> 500 CommandExecutionException
  bolt LOAD CSV FROM 'file:///nope.csv' AS l RETURN l                         -> Neo.DatabaseError.General.UnknownError | Error opening CSV file: file:///nope.csv
  http LOAD CSV FROM 'file:///nope.csv' AS l RETURN l                         -> 500 CommandExecutionException
```
After:
```
== #11974
  bolt MATCH (n:A) DELETE n                                                   -> Neo.ClientError.Schema.ConstraintValidationFailed | DeleteConnectedNode: Cannot delete node #1:0 because it still has relationships. To delete this node, you must first delete its relationships, or use
  http MATCH (n:A) DELETE n                                                   -> 409 ObjectInUseException
  bolt MATCH (n:A) DELETE n RETURN n.x AS x                                   -> Neo.ClientError.Statement.EntityNotFound | DeletedEntityAccess: Cannot access a deleted entity
  http MATCH (n:A) DELETE n RETURN n.x AS x                                   -> 404 DeletedEntityException
  bolt MATCH (n:A) DELETE n SET n.y = 1                                       -> Neo.ClientError.Statement.EntityNotFound | DeletedEntityAccess: Cannot access a deleted entity
  http MATCH (n:A) DELETE n SET n.y = 1                                       -> 404 DeletedEntityException
  bolt MATCH (n:A) DELETE n CREATE (n)-[:R]->(:B)                             -> Neo.ClientError.Statement.EntityNotFound | DeletedEntityAccess: Failed to create the relationship: node `n` was deleted in this transaction
  http MATCH (n:A) DELETE n CREATE (n)-[:R]->(:B)                             -> 404 DeletedEntityException
  bolt LOAD CSV FROM 'file:///nope.csv' AS l RETURN l                         -> Neo.ClientError.Statement.ExternalResourceFailed | Error opening CSV file: file:///nope.csv
  http LOAD CSV FROM 'file:///nope.csv' AS l RETURN l                         -> 400 ExternalResourceException
```

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 21, 2026
…oes (#11967)

Fixes #11958.

### Problem

A Postgres-wire json column holding a record (`@this`, a Cypher node) or
a map (`properties(n)`, a map literal) was rendered by
`record.toJSON(true)` or `new JSONObject(map)`. Temporals came out as
epoch numbers: a DATE as epoch days in a record and epoch milliseconds
in a map, and a map dropped the zone of a ZONED_DATETIME and the
sub-millisecond digits of a DATETIME_NANOS. HTTP sends the same row as
formatted text.

### Change

- `PostgresType` renders a record, a result row, a map or a path through
`JsonSerializer`, the serializer the HTTP API uses, wherever a json
column carries one: the scalar column, an element of a json column
holding an array (a path included, e.g. `collect(p)`), and an element of
a `text[]` or `json[]` array in text and binary format. Vertex edge
counts are left out, as `toJSON(true)` left them out.
- The date patterns come from the database the value belongs to: the
record's, or the row's (`Result.getDatabase()`) when the row is not an
element. A value no database owns (a map literal, a row built without
one) uses the configured default patterns.
- One `JsonSerializer` instance serves every connection
(`PostgresType.JSON_DOCUMENT_SERIALIZER`). It is configured once in the
static initializer and never changed, and a serialization keeps no state
in the serializer (date patterns and type hints live in locals of each
call), the same pattern as gRPC's shared `FAST`/`SAFE` serializers. No
per-value allocation of a serializer on the row path.
- A record that is not a document (an edge segment, a stripe directory,
the payload of an EXTERNAL property) keeps its own `toJSON(true)`:
`JsonSerializer` has no form for those and would hand the record back,
so the column would carry its `toString()`.
`Issue11958JsonDocumentShapesTest.aRecordThatIsNotADocumentKeepsItsOwnJson`
pins it.
- `JsonSerializer` gets a public `serializeValue(Database, Object)` that
delegates to the existing private `serializeValue(database, value,
null)`. The schema pattern lookups now go through two helpers that fall
back to `GlobalConfiguration.DATE_FORMAT` / `DATE_TIME_FORMAT` when the
database is null. Every HTTP call site passes a database, so their
output is unchanged;
`Issue11958SerializeValueTest.httpRowRenderingIsUnchanged` pins the HTTP
rendering of these values.

### Behaviour change for clients (release notes)

This changes what a Postgres client receives in a json column. Scalar
temporal columns (DATE, TIMESTAMP OIDs) are unchanged.

- **Temporals inside json documents are text, not epoch numbers.** A
client that read a DATE or DATETIME inside a json column as a number
(epoch days or epoch milliseconds) must parse the formatted text
instead, the same text and the same schema `dateFormat` /
`dateTimeFormat` the HTTP API sends.
- **Paths** (`MATCH p = ... RETURN p`) keep the `{_type, nodes,
relationships, length}` object with the same members in the same order.
Each node and relationship gains the record attributes the HTTP API
sends with it: `@rid`, `@type`, `@cat`, plus `@in` / `@out` on a
relationship. `path.toMap()` wrote each record with `toJSON(false)`,
which left them out. Non-temporal property values are the same. Measured
in `aPathKeepsTheShapeOfItsMapAndGainsTheRecordAttributes`:
- before:
`{"_type":"path","nodes":[{"name":"a","n":7,"da":19782,"dt":1709212455123,"dtn":"2024-02-29
13:14:15.123456789",...}],"relationships":[{"da":19782,"w":2}],"length":1}`
- after:
`{"_type":"path","nodes":[{"@Rid":"#1:0","@type":"T11958","name":"a","n":7,"da":"2024-02-29","dt":"2024-02-29
13:14:15.123","dtn":"2024-02-29
13:14:15.123456789",...,"@cat":"v"}],"relationships":[{"@Rid":"#4:0","@type":"E11958","da":"2024-02-29","w":2,"@cat":"e","@in":"#1:1","@out":"#1:0"}],"length":1}`
- **Rows that are not elements** (a projection such as `SELECT da AS d,
name FROM T` yields one) keep the members and the order of
`result.toJSON()`; only the temporals change. Measured in
`aRowThatIsNotAnElementKeepsTheShapeOfItsJson`:
- before:
`{"name":"a","n":7,"da":1709164800000,"dt":1709212455123,"dtn":1709212455123,"nested":{"da":1709164800000}}`
- after: `{"name":"a","n":7,"da":"2024-02-29","dt":"2024-02-29
13:14:15.123","dtn":"2024-02-29
13:14:15.123456789","nested":{"da":"2024-02-29"}}`
- **DECIMAL still differs from HTTP.** A DECIMAL in those documents is
unchanged: a JSON number with its exact digits
(`12345678901234567890.123456789`), where HTTP sends a string.

### Measured (E2E, psycopg 3.3.9, container with this branch's engine
and postgresw jars)

`SELECT @this AS rec, {'da': da, 'dt': dt, 'dtn': dtn, 'zdt': zdt} AS m
FROM T` and `{cypher}MATCH (n:T) RETURN n, properties(n) AS props`:

| property | before, record | before, map | after, record and map (same
as HTTP) |
|---|---|---|---|
| DATE | `19782` | `1709164800000` | `"2024-02-29"` |
| DATETIME | `1709212455123` | `1709212455123` | `"2024-02-29
13:14:15.123"` |
| DATETIME_NANOS | `"2024-02-29 13:14:15.123456789"` | `1709212455123` |
`"2024-02-29 13:14:15.123456789"` |
| ZONED_DATETIME | `"2024-03-10T03:30-04:00[America/New_York]"` |
`1710055800000` | `"2024-03-10T03:30-04:00[America/New_York]"` |

This E2E table was measured on the first commit; the follow-up commit's
paths are covered by the tests below, not by a second psycopg run.

### Tests

- `Issue11958JsonColumnTemporalsIT` (pgjdbc): a record and a map in SQL
and Cypher (fails on main: DATE `19782` vs `"2024-02-29"`); a Cypher
path (`MATCH p = ... RETURN p`); Cypher lists of nodes, maps and paths
(`collect(n)`, `collect(properties(n))`, `collect(p)`); a map inside a
`text[]` (`SELECT ['text', {...}]`); the rows of a subquery (`SELECT
(SELECT da, dt, dtn, zdt FROM T) AS rows`).
- `Issue11958JsonDocumentShapesTest` (postgresw, embedded): a json
column holding a list of records, maps, nested lists and paths; a json
document inside a `text[]` literal and inside binary `text[]` and
`json[]` arrays; path and non-element row shapes compared with
`path.toMap()` and `result.toJSON()`; a non-element query row rendered
with its database's custom `dateFormat`; the non-document record branch.
- `Issue11958SerializeValueTest` (engine): pins the HTTP row rendering
and checks `serializeValue` matches it, with and without a database.
- Run on the latest commit: `mvn -o -pl postgresw -am verify
-DskipITs=false
-Dtest='com/arcadedb/postgres/**/*Test,Issue11958SerializeValueTest'
-Dit.test='com/arcadedb/postgres/**/*IT'`: postgresw unit 1001 run, ITs
624 run, engine 2 run; 0 failures, 0 errors, 0 skipped.

### Overlap with #11920

#11920 (#11838) also edits `PostgresType.java`, in the Bind parameter
decoding (`deserializeText` / `deserializeBinary`, UUID). This PR
touches only the json rendering of result values (`toText`,
`arrayElementToText`, the json array helpers), so the two do not change
the same code.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed JSON serialization of date and date-time values when records are
returned through PostgreSQL, including values nested in maps, lists,
arrays, and paths.
* Temporal values now retain their expected formatting in
database-backed and detached records, including date precision and time
zones.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 22, 2026
… from an index of the relationship's type (#13062)

Fixes #12483 (items 2 and 3; item 1 was fixed by #11786).

## Problem

A `MERGE (a)-[:R {uuid: $u}]->(b)` between two bound nodes found its
relationship by walking an edge list. Once the transaction had queued a
vertex (an earlier row gave it its first relationship), the walk
recorded a read of that vertex's list head, and any relationship a
concurrent transaction gave the same vertex, to any other node, moved
the head and refused the whole batch at commit (#12320). The reporter's
load, relationships with unique keys between shared vertices, was
refused several times per committed batch, and 8 writers loaded about 4x
slower than one.

## Change

- **`MergeStep`**: when the relationship's type has an exact-key index
whose whole key the pattern's properties cover with non-null values, the
existence check is an index lookup, filtered by endpoints, direction and
the pattern's remaining properties. No edge list is read, so no head
read is recorded. In every other case the walk still answers: a prefix
of a composite index, a null value, no index, or a user who may not read
the type or one of its subtypes. That last case stops the seek from
becoming an existence oracle, where a refusal would happen only when the
value exists.
- **`TransactionContext`**: at commit, every relationship the
transaction created of a type with an exact-key index marks the
`MergedEdgeRegistry` key `(pair, declaring type, {index properties:
committed values})`, whatever statement created it. A MERGE answered by
an index checks the same key, built from the relationship it wrote. Both
sides therefore compare the stored values: a LONG parameter against an
INTEGER property, a `date()` against text written to a DATE, and a key
assigned by a `SET` after the `CREATE` all count. A transaction that
only marks keys publishes them. A mark the transaction already holds
(usually the MERGE's own key) is not repeated, so the registry's table
does not fill faster.

### Compared with #12652

This keeps the core idea of @shaunpatterson's #12652 (answer the MERGE
from the relationship's index, and keep the protection through the
registry) and changes how the protection is built, which addresses the
triage findings on that PR:

| | #12652 | this PR |
|---|---|---|
| when keys are marked | in `GraphEngine.createEdge`, before any `SET` |
at commit, from the committed values (`CREATE ... SET e.uuid = 'x'` is
covered) |
| key values | marked from stored values, checked from evaluated values
| both from stored values (numeric forms, temporals, text-to-DATE) |
| per-edge cost on `createEdge` | index scan + key maps for every edge |
one `instanceof` and a per-type cached flag |
| prefix lookups | answered, protected by a pair+type key only | keep
the walk |
| ACL | none | users who may not read the type keep the walk
(value-independent answer) |
| per-row state | three mutable fields across calls | the answering
index is returned and passed down, set on every call |
| subtypes | marked under every super type | marked under the type that
declares the index |

## A correctness gap this closes

On `main`, the walk's head-read check refuses a MERGE only when a head
**moved**. A concurrent `CREATE` of the *same* relationship that only
appended inside an existing chunk was never refused, and both copies
were committed. Five of the new tests are red on the walk path for this
reason (same relationship by CREATE, by CREATE + SET, the other way
round against an undirected MERGE, a subtype, a numeric or DATE key in
another form). With the index answer, the registry key refuses all of
them.

## Tests

- `CypherMergeRelationshipByIndexIssue12483Test` (14 tests). Red on
`main` with the issue's exact refusal ("Edge list of vertex #1:1 was
read by this transaction before a concurrent transaction changed it"):
  - a concurrent first relationship of an endpoint;
  - another relationship between the same two nodes.

  Must refuse, and the retry finds the relationship:
  - the same relationship created by CREATE;
  - by CREATE + SET;
  - by MERGE;
  - the other way round against an undirected MERGE;
  - by a subtype;
  - with a numeric key in another form;
  - with a DATE key written as text.

  Must behave like the walk:
- an existing relationship is matched (direction, other nodes,
undirected, extra properties);
  - a relationship created earlier in the same transaction is found;
  - one deleted in the transaction is not matched;
  - a prefix of a composite index keeps the walk.

Finally, a concurrent load stores every relationship once, reachable
from both ends.
- `CypherMergeRelationshipByIndexAclIssue12483Test`: a user who may not
read the type gets the same outcome whether or not the key exists (red
without the gate).
- Load-bearing checks: disabling the index path turns the two refusal
tests red; disabling the commit-time marks turns the five "same
relationship" tests red.
- Regression runs: all openCypher engine tests (9,642), and the MERGE /
registry / edge-merge / graph / database / index suites (3,730), all
green.

## Measurements

`Issue12483ConcurrentMergeEdgeInsertBenchmark` (in process, 50,000
vertices, 80 transactions of 500 relationships, unique uuids, 2 rounds):

| writers | walk (no index): rel/s | refusals per commit | index answer:
rel/s | refusals per commit |
|---|---|---|---|---|
| 2 | 83-87K | 0.98 | 75-79K | 0.69 |
| 4 | 60-62K | 2.91 | 63-69K | 1.85-1.90 |
| 8 | 32K | 6.4-6.6 | 46-50K | 3.3-3.5 |

The head-read refusals are gone. Nearly all of the rest are `Concurrent
modification on page ... bucket`, the vertex read off the transaction's
own page image, which is #12642 (open PR #12650). Single-writer numbers
are not comparable between the two columns, because the walk column has
no index to maintain.

## Trade-offs

- A transaction that creates relationships of a type with an exact-key
index takes the registry's monitor once at commit, and hashes one key
per index per relationship. A transaction that creates none pays one
flag check.
- Relationships created through `GraphBatch`'s bulk path (which bypasses
`createRecord`) are not marked. Such a load reads nothing, so the
outcome is serializable with the MERGE first.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Relationship `MERGE` can use exact-key indexes to find matches when
both endpoint vertices are specified and the complete, non-null property
key is indexed.
* **Bug Fixes**
* Improved concurrency handling for indexed relationship creation:
conflicting attempts to create the same keyed relationship are detected,
while unrelated relationship changes can commit.
* Indexed relationship lookups preserve access-control behavior for
users with and without permission to read the relationship type.
* Commit-time checks use the relationship values that are actually saved
and account for index changes during a transaction.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

## Also in this PR

- `TransactionContextStatementStateTest` classifies `deferredCallbacks`
(#12251). It was unclassified on `main`, which keeps that census red;
the fix is needed here because this PR adds fields the same census
checks.
- Review round 1 (`1147bff57d`): the commit marks the key it writes for
a relationship changed after its save without a re-save (read from the
transaction page), and asks the types again when an index was registered
since the begin.
lvca added a commit that referenced this pull request Nov 23, 2026
…ndexes over the whole joining subtree (#12062)

## Root cause

`ALTER TYPE A SUPERTYPE +W` propagates W's indexes (and those of W's
super types) through `LocalDocumentType.propagateSuperTypeIndexes` /
`createSubIndexesFor`, which walked `buckets`, the joining type's OWN
buckets. The sub types of `A` join `W` with it (their records are `W`
records from then on, `SELECT FROM W` returns them), but their buckets
got no sub-index. So a UNIQUE index of `W` was not enforced for them,
`SEARCH_INDEX` on a FULL_TEXT index and `vectorNeighbors` on an
LSM_VECTOR index never returned them, and `SELECT FROM index:...` listed
nothing for them. A sub type created later and `ALTER TYPE A BUCKET +b`
were fine because both go through `addBucketInternal`, which propagates
`getAllIndexes(true)` per bucket.

## Fix

`createSubIndexesFor` walks `cachedPolymorphicBuckets` (the joining
type's buckets and those of every type below it, at any depth) instead
of `buckets`, and asks the type that owns each bucket
(`schema.getBucketOwner`) whether the bucket already carries the index,
since a sub type's sub-indexes are bound to that sub type (#10412;
`createBucketIndex` already binds a sub type's bucket to its owner under
the propagated wrapper). The question of whether the caller's
transaction wrote into the scanned buckets (#10450) is asked about the
same polymorphic bucket list.

Everything else is the existing path: the components are created in
their own transaction, the builds join the caller's transaction, and any
failure (a UNIQUE clash between a record of the subtree and one of `W`,
or between two types of the subtree) drops every component created and
unlinks the super type (#11302), so the change is refused with nothing
changed. This is the same for every index family the propagation handles
(LSM_TREE UNIQUE/NOTUNIQUE, BY ITEM, FULL_TEXT, LSM_VECTOR).

Possible textual overlap: a parallel change for
#12028/#12029/#12030/#12033/#12034/#12037/#12040 edits
`LocalDocumentType` (schema DDL validation). This change touches only
`propagateSuperTypeIndexes` (one line) and the head of
`createSubIndexesFor`.

## Tests

New `SuperTypeSubtreeIndexPropagationTest` (engine, `TestHelper`), with
a subtree `A`, `X EXTENDS A`, `Y EXTENDS X`, 7 tests:

- UNIQUE index of `W`: covers `A`, `X`, `Y` (sub-indexes on all three
buckets, lookups find `X`'s and `Y`'s keys), duplicates into `X`, `Y`,
`A` refused, also after reopen;
- NOTUNIQUE index of a super type above `W` (`W EXTENDS V0`) covers `X`
and `Y`;
- UNIQUE clash between `Y` and `W`, and between `A` and `X`:
`DuplicatedKeyException`, `A` not a sub type of `W`, no sub-index of
`W[s]` left on any bucket of the subtree, also after reopen;
- BY ITEM, FULL_TEXT (including a record inserted into `X` after the
change) and LSM_VECTOR indexes return the records of every type of the
subtree.

- Failing first: with `engine/src/main` from `origin/main`, 7 of 7 fail.
With the fix: 7/7 pass.
-
`-Dtest='com/arcadedb/schema/**,*SuperType*,*Polymorphic*,*FullText*,*Vector*,*AlterType*,*Inherit*,*Unique*,*TypeIndex*'
-DexcludedGroups=slow,benchmark`: 3993 tests, 0 failures, 0 errors.

## End to end

`arcadedata/arcadedb:26.12.1-SNAPSHOT` container with this branch's
engine jar, the issue's steps over HTTP.

UNIQUE (`ALTER TYPE A SUPERTYPE +W`, `X EXTENDS A`):

| statement | main | this branch |
|---|---|---|
| `schema:indexes` | `A_0_...`, `W[s]`, `W_0_...` (nothing on `X_0`) |
`A_0_...`, `W[s]`, `W_0_...`, `X_0_...` (bucket 8) |
| ``SELECT key, rid FROM index:`W[s]` `` | `a1 #5:0`, `w1 #1:0` | `a1
#5:0`, `w1 #1:0`, `x1 #8:0` |
| `INSERT INTO X SET s = 'w1'` | 200 accepted | 409
`DuplicatedKeyException` |
| `INSERT INTO X SET s = 'x1'` | 200 accepted | 409
`DuplicatedKeyException` |
| `INSERT INTO A SET s = 'x1'` | 200 accepted | 409
`DuplicatedKeyException` |
| `SELECT s, count(*) FROM W GROUP BY s` | `a1 1`, `w1 2`, `x1 3` | `a1
1`, `w1 1`, `x1 1` |
| after a restart: `INSERT INTO X SET s = 'w1'` / ``REBUILD INDEX `W[s]`
`` | 200 accepted / 500 (as measured in the issue) | 409 / 200
(`totalIndexed: 3`) |

With `X` holding `w1` before the change, `ALTER TYPE A SUPERTYPE +W`
answers 409 `DuplicatedKeyException`, `A` has no super type afterwards
and `schema:indexes` lists only `W[s]` and `W_0_...`.

Records of `A` returned / expected (`ALTER TYPE W SUPERTYPE +A`, `X
EXTENDS W`, 10 records each):

| index on `A` | main | this branch |
|---|---|---|
| FULL_TEXT, `SEARCH_INDEX('A[t]', 'alpha')` | 4 / 6 (X 0/2) | 6 / 6 |
| LSM_VECTOR, `vectorNeighbors('A[v]', [0.5, 0.5], 100)` | 20 / 30 (X
0/10) | 30 / 30 |
| LSM_TREE NOTUNIQUE, `t = 'alpha'` | 6 / 6 | 6 / 6 |
| LSM_TREE BY ITEM, `tags CONTAINS 'alpha'` | 6 / 6 | 6 / 6 |

Fixes #12036

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
…crosses record kinds (#12063)

Fixes #12028
Fixes #12029

Both issues are missing refusals in the same place: the checks a super
type link is asked before anything changes
(`LocalDocumentType.checkCanAddSuperType`, which `ALTER TYPE ...
SUPERTYPE +`, `Schema` API `addSuperType` and `TypeBuilder` on an
existing type all go through). So they are fixed together, in one PR.

### What changes

- **Cycle (#12028)**: `checkCanAddSuperType` refuses, first and for
every linkage, a super type that is the type itself or already one of
its sub types (`DocumentType.isSubTypeOf`, which only walks up the super
type lists and so ends). The statement is refused with a
`SchemaException` (HTTP 400) before the link is made, so nothing is left
in memory. It used to link, overflow the stack in the post-link steps (a
`StackOverflowError` is not the `RuntimeException` the unlink guard
catches), and keep the cycle.
- **Load**: a `schema.json` that already holds a cycle (the next schema
save after the old 500 could write one) still opens. The inheritance
restore leaves out the link that would close the cycle and logs a
warning naming it. Before, every polymorphic walk over the loaded cycle
overflowed.
- **Record kind (#12029)**: a new linkage refuses a graph super type of
another kind (a document or edge type under a vertex type, a vertex or
document type under an edge type), in `checkCanAddSuperType` for ALTER
and in `TypeBuilder` for a new type (`CREATE ... TYPE ... EXTENDS` and
the Java builder). A DOCUMENT super type stays legal for a vertex or an
edge type: existing schemas use it to share properties
(`SchemaTest.dropNonExistentIndexThenCreateProperty` has `CREATE VERTEX
TYPE ... EXTENDS <document type>`), and a vertex or an edge is a
document, so a scan of the super type reads nothing it cannot hold.
Linkages that already hold (schema load, re-attachment after `DROP
TYPE`) are not asked, so a database written before the check still
opens.

### Tests

`SuperTypeAdmissionTest` (new, engine, one nested class per issue):

- cycle refused through SQL (direct and two levels down), the Java API
and the type builder; schema unchanged, `SELECT FROM A` and `CREATE
PROPERTY A.y` work after;
- a hand-edited `schema.json` holding a cycle opens, keeps two of the
three links, scans and saves;
- ALTER refuses document under vertex, vertex under edge, edge under
vertex; same kind, and vertex or edge under document, stay legal; Cypher
`MATCH (v:V)` answers;
- `CREATE DOCUMENT TYPE ... EXTENDS <vertex>`, `CREATE EDGE TYPE ...
EXTENDS <vertex>`, `CREATE VERTEX TYPE ... EXTENDS <edge>` and
`buildDocumentType().withSuperType(<vertex>)` refused, no type created;
`CREATE VERTEX TYPE ... EXTENDS <document>` and an edge type built over
a document type stay legal;
- a hand-edited `schema.json` with a cross-kind link still opens.

### Results

Engine tests (Docker, maven:3.9-eclipse-temurin-21):

- failing-first with `engine/src/main` from origin/main:
`SuperTypeAdmissionTest` 6 run, 5 fail (4 failures, 1 error:
`aSchemaFileWithACycleStillOpens` StackOverflowError).
- `-Dtest='com/arcadedb/schema/**/*Test,SuperTypeAdmissionTest'
-DexcludedGroups=slow`: 1812 tests, 0 failures, 0 errors, 0 skipped.
- whole engine module, `-pl engine test -DexcludedGroups=slow`: 27969
tests, 2 failures, 3 errors, 22 skipped. None is from this change:
`ParallelSafeExpressionsStateTest` (1 failure) and
`CypherCallInTransactionsOnErrorIssue11595Test` (3 errors) fail the same
way with `engine/src/main` from origin/main;
`ReplicatedApplyPublicationTest` (1 failure) passed on origin/main and
passed again alone on this branch (timing-dependent).
- server module, `-pl server -am test
-Dtest='com/arcadedb/server/**/*Http*Test,com/arcadedb/server/**/*Command*Test,com/arcadedb/server/**/*Schema*Test'`:
263 tests, 0 failures, 0 errors, 0 skipped.
- server ITs that send DDL and assert HTTP statuses (28 classes, among
them `HTTPDocumentIT`, `HTTPGraphIT`, `RemoteDatabaseIT`,
`SchemaMutationAuthorizationIT`, `FacetsSubtypeAclIT`,
`TestLinkedPropertiesSchemaReloadIT`): 187 tests, 0 failures, 0 errors,
0 skipped.

End to end, HTTP against a server built from main (`s12028` repro):

Server with the main jars (a7304ab):

version 200
== cycle: A <- B <- C, then ALTER TYPE A SUPERTYPE +C
200 CREATE VERTEX TYPE A -> [{"operation": "create vertex type",
"typeName": "A", "created": true}]
200 CREATE VERTEX TYPE B EXTENDS A -> [{"operation": "create vertex
type", "typeName": "B", "created": true}]
200 CREATE VERTEX TYPE C EXTENDS B -> [{"operation": "create vertex
type", "typeName": "C", "created": true}]
200 INSERT INTO C SET x = 1 -> [{"@Rid": "#7:0", "@type": "C", "@cat":
"v", "x": 1}]
500 ALTER TYPE A SUPERTYPE +C -> "DatabaseOperationException: Error
during write lock -> StackOverflowError"
200 SELECT name, parentTypes FROM schema:types ORDER BY name ->
[{"name": "A", "parentTypes": ["C"]}, {"name": "B", "parentTypes":
["A"]}, {"name": "C", "parentTypes": ["B"]}]
  200 SELECT count(*) FROM A -> [{"count(*)": 1}]
500 SELECT FROM A -> "StackOverflowError: java.lang.StackOverflowError"
500 CREATE PROPERTY A.y INTEGER -> "DatabaseOperationException: Error
during write lock -> StackOverflowError"
400 INSERT INTO A SET x = 2 -> "CommandSQLParsingException: The
statement is nested or chained too deeply to be executed (the thread
stack overflowed while building the plan) -> StackOverflowError"
== cross kind: document type D gets vertex super type V; vertex type W
gets edge super type E
200 CREATE VERTEX TYPE V -> [{"operation": "create vertex type",
"typeName": "V", "created": true}]
200 CREATE DOCUMENT TYPE D -> [{"operation": "create document type",
"typeName": "D", "created": true}]
200 CREATE EDGE TYPE E -> [{"operation": "create edge type", "typeName":
"E", "created": true}]
200 CREATE VERTEX TYPE W -> [{"operation": "create vertex type",
"typeName": "W", "created": true}]
200 INSERT INTO V SET n = 1 -> [{"@Rid": "#1:0", "@type": "V", "@cat":
"v", "n": 1}]
200 INSERT INTO D SET n = 2 -> [{"@Rid": "#4:0", "@type": "D", "@cat":
"d", "n": 2}]
200 INSERT INTO W SET n = 3 -> [{"@Rid": "#6:0", "@type": "W", "@cat":
"v", "n": 3}]
200 ALTER TYPE D SUPERTYPE +V -> [{"supertype": ["V"], "operation":
"ALTER TYPE", "typeName": "D", "result": "OK"}]
200 ALTER TYPE W SUPERTYPE +E -> [{"supertype": ["E"], "operation":
"ALTER TYPE", "typeName": "W", "result": "OK"}]
200 SELECT name, type, parentTypes FROM schema:types ORDER BY name ->
[{"name": "D", "type": "document", "parentTypes": ["V"]}, {"name": "E",
"type": "edge", "parentTypes": []}, {"name": "V", "type": "vertex",
"parentTypes": []}, {"name": "W", "type": "vertex", "parentTypes":
["E"]}]
200 SELECT @Rid, @type, @cat, n FROM V -> [{"@Rid": "#1:0", "@type":
"V", "@cat": "v", "n": 1}, {"@Rid": "#4:0", "@type": "D", "@cat": "d",
"n": 2}]
500 MATCH (v:V) RETURN v.n -> "ClassCastException: Cannot cast the
document #4:0 to a vertex"
200 SELECT @Rid, @type, @cat, n FROM E -> [{"@Rid": "#6:0", "@type":
"W", "@cat": "v", "n": 3}]
  200 MATCH ()-[e:E]->() RETURN count(e) -> [{"count(e)": 0}]

Same server, engine jar built from this branch:

version 200
== cycle: A <- B <- C, then ALTER TYPE A SUPERTYPE +C
200 CREATE VERTEX TYPE A -> [{"operation": "create vertex type",
"typeName": "A", "created": true}]
200 CREATE VERTEX TYPE B EXTENDS A -> [{"operation": "create vertex
type", "typeName": "B", "created": true}]
200 CREATE VERTEX TYPE C EXTENDS B -> [{"operation": "create vertex
type", "typeName": "C", "created": true}]
200 INSERT INTO C SET x = 1 -> [{"@Rid": "#7:0", "@type": "C", "@cat":
"v", "x": 1}]
400 ALTER TYPE A SUPERTYPE +C -> "SchemaException: Cannot make type 'A'
a sub type of 'C': 'C' is already a sub type of 'A', and a type
hierarchy cannot have a cycle"
200 SELECT name, parentTypes FROM schema:types ORDER BY name ->
[{"name": "A", "parentTypes": []}, {"name": "B", "parentTypes": ["A"]},
{"name": "C", "parentTypes": ["B"]}]
  200 SELECT count(*) FROM A -> [{"count(*)": 1}]
200 SELECT FROM A -> [{"@Rid": "#7:0", "@type": "C", "@cat": "v", "x":
1}]
200 CREATE PROPERTY A.y INTEGER -> [{"operation": "create property",
"typeName": "A", "propertyName": "y", "created": true}]
200 INSERT INTO A SET x = 2 -> [{"@Rid": "#1:0", "@type": "A", "@cat":
"v", "x": 2}]
== cross kind: document type D gets vertex super type V; vertex type W
gets edge super type E
200 CREATE VERTEX TYPE V -> [{"operation": "create vertex type",
"typeName": "V", "created": true}]
200 CREATE DOCUMENT TYPE D -> [{"operation": "create document type",
"typeName": "D", "created": true}]
200 CREATE EDGE TYPE E -> [{"operation": "create edge type", "typeName":
"E", "created": true}]
200 CREATE VERTEX TYPE W -> [{"operation": "create vertex type",
"typeName": "W", "created": true}]
200 INSERT INTO V SET n = 1 -> [{"@Rid": "#1:0", "@type": "V", "@cat":
"v", "n": 1}]
200 INSERT INTO D SET n = 2 -> [{"@Rid": "#4:0", "@type": "D", "@cat":
"d", "n": 2}]
200 INSERT INTO W SET n = 3 -> [{"@Rid": "#6:0", "@type": "W", "@cat":
"v", "n": 3}]
400 ALTER TYPE D SUPERTYPE +V -> "SchemaException: Cannot make the
document type 'D' a sub type of the vertex type 'V': a type can only
extend a document type or a type of its own kind"
400 ALTER TYPE W SUPERTYPE +E -> "SchemaException: Cannot make the
vertex type 'W' a sub type of the edge type 'E': a type can only extend
a document type or a type of its own kind"
200 SELECT name, type, parentTypes FROM schema:types ORDER BY name ->
[{"name": "D", "type": "document", "parentTypes": []}, {"name": "E",
"type": "edge", "parentTypes": []}, {"name": "V", "type": "vertex",
"parentTypes": []}, {"name": "W", "type": "vertex", "parentTypes": []}]
200 SELECT @Rid, @type, @cat, n FROM V -> [{"@Rid": "#1:0", "@type":
"V", "@cat": "v", "n": 1}]
  200 MATCH (v:V) RETURN v.n -> [{"v.n": 1}]
  200 SELECT @Rid, @type, @cat, n FROM E -> []
  200 MATCH ()-[e:E]->() RETURN count(e) -> [{"count(e)": 0}]

Overlap note: separate PRs for #12031, #12032, #12035, #12036, #12038
and #12039 are being prepared in the same area (`LocalDocumentType`,
`LocalSchema`, `ExistingRecordsCheck`, the ALTER/CREATE TYPE
statements). Textual merge conflicts with them are possible; the changes
are meant to be independent. This PR and the one for #12030 both add a
step at the end of `LocalDocumentType.checkCanAddSuperType`, so the
second to merge needs a small rebase.

### Merge note: #12067

This PR conflicts textually with #12067 in `LocalDocumentType.java`,
around line 3496. Both add private methods directly after
`checkCanAddSuperType`. This PR adds `checkNoCycle`,
`checkSameRecordKind` and `recordKindName`; #12067 adds
`checkStoredRecordsMeetInheritedProperties`. To resolve it, keep both
blocks.

One ordering rule applies after the merge. #12067's stored-record scan
(`checkStoredRecordsMeetInheritedProperties`, which walks
`superType.getPolymorphicProperties()`) has to stay after the
`checkNoCycle` call that this PR puts at the head of
`checkCanAddSuperType`. Run before it, that walk could follow a cycle
before the cycle check refuses it.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Schema inheritance now rejects cycles and incompatible record types,
preventing invalid parent-child relationships from being created through
SQL commands or builders.
* Existing schema files with cyclic or incompatible inheritance links
can still load; invalid links are skipped.
* Type removal now refuses to proceed when reattaching child types would
create an incompatible relationship. Same-kind inheritance and document
supertypes for graph types remain supported.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
…ty type is refused at DDL time (#12066)

Fixes #12040

`CREATE PROPERTY T.n INTEGER (DEFAULT 'dflt')` and `ALTER PROPERTY T.n
DEFAULT 'zz'` were accepted, and every record create of the type then
failed with HTTP 500 (`Error on evaluating the default value ... For
input string`). Since #6134 an unparseable default is refused at DDL
time; one that parses but cannot be converted was not.

### What changes

`AbstractProperty.compileDefaultValue`: a default written as literals
alone (`Expression.isLiteral()`: a string, a number, a boolean, `null`,
arithmetic over them) has one value for every record, so it is evaluated
and converted to the property's type when it is set. A conversion
failure is refused with a `SchemaException` naming the property, the
type and the reason, and the property keeps the default it had. A
default that calls a function (`sysdate()`) is still evaluated per
record, as before.

The schema load stays lenient, as for the other #6134 refusals: a
`schema.json` that already holds such a default opens, logs a warning,
and `ALTER PROPERTY` repairs it.

### Tests

`PropertyDefaultValueTest` (2 new cases):

- `ALTER PROPERTY Probe.n DEFAULT 'dflt'` (INTEGER), `CREATE PROPERTY
Probe.d DATE (DEFAULT 'notadate')` and the Java API
`setDefaultValue("'x' + 1")` on a LONG are refused, nothing applied,
records still created; `'7'`, `4`, `null` and `sysdate()` stay legal and
fill in the values;
- a hand-edited `schema.json` with `'dflt'` on an INTEGER opens, the
insert names the property, `ALTER PROPERTY ... DEFAULT 2` repairs it.

### Results

Engine tests (Docker, maven:3.9-eclipse-temurin-21):

- failing-first: `PropertyDefaultValueTest` 27 run, 1 fails
(`aLiteralDefaultThatCannotBeConvertedIsRejectedAtDdlTime`).
- `-Dtest='com/arcadedb/schema/**/*Test,PropertyDefaultValueTest'
-DexcludedGroups=slow`: 1808 tests, 0 failures, 0 errors, 0 skipped.

End to end, HTTP against a server built from main (`s12040` repro):

Server with the main jars (a7304ab):

| statement | HTTP | answer |
|---|---|---|
| `CREATE DOCUMENT TYPE T` | 200 | [{"operation": "create document
type", "typeName": "T", "created": true}] |
| `CREATE PROPERTY T.n INTEGER (DEFAULT 'dflt')` | 200 | [{"operation":
"create property", "typeName": "T", "propertyName": "n", "created":
true, "DEFAULT": "'dflt'"}] |
| `INSERT INTO T SET x = 1` | 500 | "SchemaException: Error on
evaluating the default value `'dflt'` defined on property 'T.n' -> For
input string: \"dflt\"" |
| `CREATE PROPERTY T.m INTEGER (DEFAULT 7)` | 200 | [{"operation":
"create property", "typeName": "T", "propertyName": "m", "created":
true, "DEFAULT": "7"}] |
| `ALTER PROPERTY T.m DEFAULT 'zz'` | 200 | [{"type": "T", "property":
"m", "operation": "alter property", "attribute": "default", "oldValue":
"7", "newValue": "'zz'"}] |
| `INSERT INTO T SET x = 2` | 500 | "SchemaException: Error on
evaluating the default value `'zz'` defined on property 'T.m' -> For
input string: \"zz\"" |
| `CREATE PROPERTY T.d DATETIME (DEFAULT sysdate())` | 200 |
[{"operation": "create property", "typeName": "T", "propertyName": "d",
"created": true, "DEFAULT": "sysdate()"}] |
| `INSERT INTO T SET x = 3` | 500 | "SchemaException: Error on
evaluating the default value `'zz'` defined on property 'T.m' -> For
input string: \"zz\"" |

Same server, engine jar built from this branch:

| statement | HTTP | answer |
|---|---|---|
| `CREATE DOCUMENT TYPE T` | 200 | [{"operation": "create document
type", "typeName": "T", "created": true}] |
| `CREATE PROPERTY T.n INTEGER (DEFAULT 'dflt')` | 400 |
"SchemaException: Invalid default value `'dflt'` on property 'T.n'
because it cannot be converted to the property type INTEGER: For input "
|
| `INSERT INTO T SET x = 1` | 200 | [{"@Rid": "#1:0", "@type": "T",
"@cat": "d", "x": 1}] |
| `CREATE PROPERTY T.m INTEGER (DEFAULT 7)` | 200 | [{"operation":
"create property", "typeName": "T", "propertyName": "m", "created":
true, "DEFAULT": "7"}] |
| `ALTER PROPERTY T.m DEFAULT 'zz'` | 400 | "SchemaException: Invalid
default value `'zz'` on property 'T.m' because it cannot be converted to
the property type INTEGER: For input st" |
| `INSERT INTO T SET x = 2` | 200 | [{"@Rid": "#1:1", "@type": "T",
"@cat": "d", "x": 2, "m": 7}] |
| `CREATE PROPERTY T.d DATETIME (DEFAULT sysdate())` | 200 |
[{"operation": "create property", "typeName": "T", "propertyName": "d",
"created": true, "DEFAULT": "sysdate()"}] |
| `INSERT INTO T SET x = 3` | 200 | [{"@Rid": "#1:2", "@type": "T",
"@cat": "d", "x": 3, "d": "2026-11-15 22:55:31.883", "m": 7}] |

Overlap note: separate PRs for #12031, #12032, #12035, #12036, #12038
and #12039 are being prepared in the same area (`LocalDocumentType`,
`LocalSchema`, `ExistingRecordsCheck`, the ALTER/CREATE TYPE
statements). Textual merge conflicts with them are possible; the changes
are meant to be independent.

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
…12068)

Fixes #12037

Schema statements refused because of the data already stored left with
exception types the protocols answer as a server fault (HTTP 500), while
MIN, MAX and REGEXP refusals of the same kind answered 400. This changes
the engine exception TYPES at the source; no message is matched
anywhere, and the HTTP classifier is unchanged (its
`ValidationException` arm answers 400).

### What changes

- `ExistingRecordsCheck` (CREATE PROPERTY, ALTER PROPERTY and the Cypher
constraint DDL over stored records or TIMESERIES samples) throws a
`ValidationException` carrying the constraint kind (MANDATORY, NOT_NULL,
MIN, ...), instead of a `CommandExecutionException`. MIN/MAX/REGEXP
already reached 400 only because the wrapper happened to carry a
`ValidationException` cause; MANDATORY and NOTNULL carried none. A
failure to read the samples stays a `CommandExecutionException` (a
server fault). A value constraint keeps the refusal of the stored-value
check as the cause, through a new `ValidationException(kind, message,
cause)` constructor.
- `DocumentIndexer`: the refusal of a write that changes the partition
key of a partitioned type is a `ValidationException` instead of an
`IndexException` (the record is unchanged either way).
- A UNIQUE index build over duplicate keys needs no engine change. Since
#11973 the HTTP classifier reads the cause chain, so the
`IndexException` wrapping the `DuplicatedKeyException` is already
answered 409; `HttpErrorStatusServerTest` pins it (it passes with and
without this PR). An earlier revision of this PR retyped the build
failure as a `DuplicatedKeyException`. That is not part of it any more:
a `DuplicatedKeyException` is in the transaction retry family (retried
once, and every HTTP command runs in `database.transaction`), so a
refused build would have run twice before the refusal was reported, and
it changed the type embedded callers catch.
- The `SUPERTYPE +` row with a value the super type's index cannot
convert (`For input string: "abc"`) is answered by the PR for #12030
(#12067), which refuses it before the index propagation with a 400
naming the record.
- The partition guard in `DocumentIndexer` also refuses an update of any
other indexed property of a partitioned type, a separate defect that
this PR does not touch: #13178.

### Tests

- `StoredDataRefusalTest` (new): CREATE PROPERTY MANDATORY / NOTNULL and
ALTER PROPERTY MANDATORY / NOTNULL over violating records throw
`ValidationException` with the kind; a MIN refusal keeps its kind and
its cause; nothing is declared; a partition key update throws
`ValidationException`.
- `HttpErrorStatusServerTest.RefusedForTheStoredData` (new, end to end
over HTTP): MANDATORY and NOTNULL in CREATE and ALTER PROPERTY are 400
with the kind in `exceptionArgs`; a UNIQUE index over duplicate keys is
409 with no index left; a partition key update is 400 from SQL and
openCypher and the record is unchanged.
- `ValidationExceptionKindCensusTest`: the two refusals without a kind
are listed (the partition key change in
`DocumentIndexer#updateDocument`, the TIMESERIES sample refusal in
`ExistingRecordsCheck#requireSamples`); the census now reads every
constructor that takes the kind, the new one with a cause included, and
asserts it still reaches `ExistingRecordsCheck#requireValues`.
- Updated to the new types: `TimeSeriesColumnConstraintsTest` (12
sample-refusal assertions, messages unchanged), `PropertyDefinitionTest`
(3), `PropertyDefinitionRulesTest` (2), `SqlExistingRecordsDdlTest` (26)
and `TimeSeriesDeleteTest` (1) stored-data refusals that asserted
`CommandExecutionException`, messages unchanged. The parse errors and
the openCypher constraint refusals in `SqlExistingRecordsDdlTest` still
assert `CommandExecutionException`.

### Results

On the final head, merged with main `db12ad2fa9`:

- failing-first, against main's `ExistingRecordsCheck` and
`DocumentIndexer`: `StoredDataRefusalTest` 3 run, 3 fail;
`HttpErrorStatusServerTest` 14 run, 2 fail (the existence refusals and
the partition key refusal; the UNIQUE 409 already holds on main).
- engine, `-pl engine -am test
-Dtest='StoredDataRefusalTest,SqlExistingRecordsDdlTest*,PropertyDefinitionTest*,PropertyDefinitionRulesTest*,TimeSeriesColumnConstraintsTest*,TimeSeriesDeleteTest*,CypherExistenceConstraintWithSetIssue7945Test*,CypherVectorIndexTest*,CypherTypedConstraintTest*,OpenCypherConstraintTest*,CypherDropNamedConstraintTest*,CypherMultiLabelConstraintReloadTest*,Partition*,AlterTypeExecutionTest*,DocumentValidator*'`:
768 tests, 0 failures, 0 errors, 0 skipped.
- census, `-pl census -am test
-Dtest=ValidationExceptionKindCensusTest`: 1 test, 0 failures.
- server, `-pl server -am test
-Dtest='HttpErrorStatusServerTest*,HttpErrorStatusTest*,PartitionedStrategyRefusalHttpTest*'`:
24 tests, 0 failures, 0 errors, 0 skipped.

Earlier runs on the first revision (Docker,
maven:3.9-eclipse-temurin-21), kept for the record; the whole engine
module then had 27966 tests and the failures not from this change were
`ParallelSafeExpressionsStateTest` (1),
`CypherCallInTransactionsOnErrorIssue11595Test` (3, the same with
`engine/src/main` from origin/main) and `PageSnapshotWindowTest` (1,
timing-dependent, passed alone), and the server ITs that send DDL and
assert HTTP statuses (28 classes, among them
`Issue4350DuplicatedKeyHttpStatusIT`,
`Issue11314ConstraintViolationHttpIT`,
`Issue10334UniqueIndexSortedBuildOverHttpIT`, `HTTPDocumentIT`,
`RemoteDatabaseIT`, `SchemaMutationAuthorizationIT`) passed: 187 tests,
0 failures.

End to end, HTTP against a server built from main
(`ddl_refusal_status.py` repro), measured on `a7304ab2aa` and on the
first revision of this branch. The UNIQUE row of both tables predates
#11973: on current main it answers 409 (see above), and on this branch's
final head it answers the same 409 with the duplicate's own message.

Server with the main jars (a7304ab):

| stored data | statement | HTTP | exception: message |
|---|---|---|---|
| `INSERT INTO T SET q = 1` | `CREATE PROPERTY T.p INTEGER (MANDATORY
true)` | 500 | `CommandExecutionException: Cannot create property 'T.p':
record #1:0 violates it, property 'T.p' is mandatory, but was never set.
Fix or ` |
| `INSERT INTO T SET p = null` | `CREATE PROPERTY T.p INTEGER (NOTNULL
true)` | 500 | `CommandExecutionException: Cannot create property 'T.p':
record #1:0 violates it, property 'T.p' cannot be null. Fix or delete
the non-co` |
| `INSERT INTO T SET p = 5` | `CREATE PROPERTY T.p INTEGER (MIN 10)` |
400 | `ValidationException: The property 'T.p' value 5 is less than 10`
|
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET q = 1` | `ALTER
PROPERTY T.p MANDATORY true` | 500 | `CommandExecutionException: Cannot
set MANDATORY: record #1:0 violates it, property 'T.p' is mandatory, but
was never set. Fix or delete t` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET p = null` | `ALTER
PROPERTY T.p NOTNULL true` | 500 | `CommandExecutionException: Cannot
set NOTNULL: record #1:0 violates it, property 'T.p' cannot be null. Fix
or delete the non-conforming r` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET p = 5` | `ALTER
PROPERTY T.p MIN 10` | 400 | `ValidationException: The property 'T.p'
value 5 is less than 10` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET p = 1; INSERT INTO T
SET p = 1` | `CREATE INDEX ON T (p) UNIQUE` | 500 | `IndexException:
Error on creating index on type 'T', properties [p]: Error on creating
index 'T_0_165082318619388': Duplicated` |
| `CREATE DOCUMENT TYPE S; CREATE PROPERTY S.p STRING; CREATE INDEX ON S
(p) UNIQUE; INSERT INTO S SET p = 'a'; INSERT INTO T SET p = 'a'` |
`ALTER TYPE T SUPERTYPE +S` | 409 | `DuplicatedKeyException: Duplicated
key [a] found on index 'S[p]' already assigned to record #2:0` |
| `CREATE DOCUMENT TYPE S; CREATE PROPERTY S.p INTEGER; CREATE INDEX ON
S (p) NOTUNIQUE; INSERT INTO T SET p = 'abc'` | `ALTER TYPE T SUPERTYPE
+S` | 500 | `IndexException: Error on creating index
'T_0_165082538848105' -> For input string: "abc"` |

Same server, engine jar built from the first revision of this branch:

| stored data | statement | HTTP | exception: message |
|---|---|---|---|
| `INSERT INTO T SET q = 1` | `CREATE PROPERTY T.p INTEGER (MANDATORY
true)` | 400 | `ValidationException: Cannot create property 'T.p':
record #1:0 violates it, property 'T.p' is mandatory, but was never set.
Fix or ` |
| `INSERT INTO T SET p = null` | `CREATE PROPERTY T.p INTEGER (NOTNULL
true)` | 400 | `ValidationException: Cannot create property 'T.p':
record #1:0 violates it, property 'T.p' cannot be null. Fix or delete
the non-co` |
| `INSERT INTO T SET p = 5` | `CREATE PROPERTY T.p INTEGER (MIN 10)` |
400 | `ValidationException: Cannot create property 'T.p': record #1:0
violates it, The property 'T.p' value 5 is less than 10. Fix or dele` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET q = 1` | `ALTER
PROPERTY T.p MANDATORY true` | 400 | `ValidationException: Cannot set
MANDATORY: record #1:0 violates it, property 'T.p' is mandatory, but was
never set. Fix or delete t` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET p = null` | `ALTER
PROPERTY T.p NOTNULL true` | 400 | `ValidationException: Cannot set
NOTNULL: record #1:0 violates it, property 'T.p' cannot be null. Fix or
delete the non-conforming r` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET p = 5` | `ALTER
PROPERTY T.p MIN 10` | 400 | `ValidationException: Cannot set MIN 10:
record #1:0 violates it, The property 'T.p' value 5 is less than 10. Fix
or delete the non-` |
| `CREATE PROPERTY T.p INTEGER; INSERT INTO T SET p = 1; INSERT INTO T
SET p = 1` | `CREATE INDEX ON T (p) UNIQUE` | 409 |
`DuplicatedKeyException: Error on creating index on type 'T', properties
[p]: Duplicated key [1] found on index 'T_0_165086446245759' a` |
| `CREATE DOCUMENT TYPE S; CREATE PROPERTY S.p STRING; CREATE INDEX ON S
(p) UNIQUE; INSERT INTO S SET p = 'a'; INSERT INTO T SET p = 'a'` |
`ALTER TYPE T SUPERTYPE +S` | 409 | `DuplicatedKeyException: Duplicated
key [a] found on index 'S[p]' already assigned to record #2:0` |
| `CREATE DOCUMENT TYPE S; CREATE PROPERTY S.p INTEGER; CREATE INDEX ON
S (p) NOTUNIQUE; INSERT INTO T SET p = 'abc'` | `ALTER TYPE T SUPERTYPE
+S` | 500 | `IndexException: Error on creating index
'T_0_165086647115869' -> For input string: "abc"` |

The last row stays 500 here: `ALTER TYPE T SUPERTYPE +S` over a stored
value of another type fails inside the index build. That case is #12030,
whose PR (#12067) refuses it with a `ValidationException` before any
index is built.

Overlap note: separate PRs for #12031, #12032, #12035, #12036, #12038
and #12039 are being prepared in the same area (`LocalDocumentType`,
`LocalSchema`, `ExistingRecordsCheck`, the ALTER/CREATE TYPE
statements). Textual merge conflicts with them are possible; the changes
are meant to be independent. This PR and the one for #12030 both edit
`ExistingRecordsCheck`, so the second to merge needs a small rebase.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Schema changes rejected because of existing data now report validation
errors, including constraint violations and incompatible stored values.
* Attempts to change a partitioned primary key are reported as
validation errors.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
…t already deleted (#12267)

Fixes #12256.

## Cause

The SQL `DeleteStep` deletes every row it is handed. `SELECT
expand(out()) FROM V WHERE k = 0` names a neighbour once per edge, so
with two parallel edges it names the same vertex twice. The first row
deleted the vertex. The second row reached `GraphEngine`'s
missing-vertex diagnosis (#6586), which failed the whole statement with
404. Its message, "...reached through a reference to a record that is
gone (a stale edge entry...). run `CHECK DATABASE FIX`", sent the
operator to repair a database that `CHECK DATABASE` reports as clean.

## Change

`DeleteStep` keeps the RIDs its rows deleted (a `RidHashSet`, per
statement). A row naming a record an earlier row already deleted is
skipped: it is not deleted, counted or returned. The statement deletes
the set of records its rows name, as openCypher's `DETACH DELETE`
already does. Parallel lightweight edges share one RID and are distinct
edges, so they are not deduplicated: each row still deletes one twin.

## Tests

New `DeleteSubqueryDuplicateRowsIssue12256Test` has 5 cases on a vertex
with two parallel edges to one neighbour and one to another. Before the
fix, the first four failed on `engine/src/main` from origin/main with
the 404:

- `DELETE VERTEX FROM (SELECT expand(out()) ...)`: count 2, 1 vertex
left, no F edges, `CHECK DATABASE` clean.
- `DELETE FROM (SELECT expand(out()) ...)`: count 2.
- `DELETE VERTEX FROM (SELECT expand(in()) FROM V WHERE k = 1)`: count
1.
- `... RETURN BEFORE`: 2 rows.
- Two parallel lightweight edges deleted through `DELETE FROM (SELECT
expand(outE('L')) ...)`: count 2, none left. This passed before too, and
guards the dedup.

Targeted run `com/arcadedb/query/sql`, `com/arcadedb/graph`,
`com/arcadedb/query/opencypher` (`**/*Test`,
`-DexcludedGroups=slow,benchmark`): 15,246 tests, 1 failure and 3
errors, the same four that fail on origin/main without these changes:
`ParallelSafeExpressionsStateTest` ("InExpression.lastSeenIdentity") and
3 cases of `CypherCallInTransactionsOnErrorIssue11595Test` ("CALL { ...
} IN TRANSACTIONS can only be executed in an implicit transaction").

Single full engine run on a local merge of all seven fix branches
(#12254, #12253, #12247, #12249, #12248, #12256, #12255) on origin/main
c643bf5, not pushed, `-pl engine`, `-DexcludedGroups=slow,benchmark`:
27,999 tests, 4 failures, 3 errors, in four classes:

- `ParallelSafeExpressionsStateTest` and
`CypherCallInTransactionsOnErrorIssue11595Test` (3): fail the same way
on origin/main.
- `ReplicatedApplyPublicationTest` (2): fails on a pristine origin/main
checkout too (2 of 21 there, different cases, timing dependent).
- `SchemaLoadTest.fullLoadReplacesEveryComponentInstance` (1): failed
once inside the full run. It passes on its own on the same merged tree
(29 of 29), on origin/main, and on the #12247 and #12248 branches (29 of
29 each).

End to end, a server with the merged engine jar ran each issue's HTTP
repro, and each answered as the tables above expect. A graph integrity
check (edge records against both adjacency lists, counts, `CHECK
DATABASE`) was clean after each repro, and after a random 150-step
SQL/openCypher sequence.

## Review follow-up (f9b8b51)

- **Scope of the set**: it was a local of `syncPull`, so it lived for
one pull, not for the statement. It is now a field of `DeleteStep`,
allocated on the first record. The plan is built per execution
(`DeleteExecutionPlan` is not cached and the step has no `copy()`), so
the field lives exactly as long as the statement. New test
`duplicatesStraddlingAPullBoundaryAreDeletedOnce`: 250 parallel edges to
one neighbour, read through an ORDER BY so every row exists before the
first delete, deleted in 3 pulls of 100. On the previous head it fails
with `VertexNotFoundException: Vertex #1:1 does not exist` at the second
pull; with the fix it deletes 2 records. (Without the ORDER BY the first
delete takes the remaining parallel edges out of the expansion still
being read, so the later pulls never see them: that is why the first
version of this test passed on both.)
- **Memory**: one primitive entry (an `int` and a `long` in
`RidHashSet`) per deleted record, for the statement. I kept it
unconditional: the transaction already holds the same `RidHashSet` for
every record it deletes (`TransactionContext.deletedRecordsInTx`), next
to the page images of those records, so a `DELETE FROM Type` over
millions of records already pays this cost once and the step adds a
second copy of the smallest part of it. Restricting it to subquery
sources would need the planner to prove which sources can never name a
record twice, which I did not want to rest a correctness fix on.
- **Veto**: the record is noted before `deleteRecordReportingVeto`, so a
record a listener vetoed is not retried for a later row naming it, and
that row is not counted. The same listener would veto it again; this is
now stated in the Javadoc of `deletedByAnEarlierRow`.
- **The @Rid branch**: new tests
`ridProjectionNamingOneRecordTwiceDeletesItOnce` (`DELETE FROM (SELECT
@Rid FROM (SELECT expand(out()) ...))` deletes 2) and
`rowThatIsNotARecordIsStillRefused` (a projection with no @Rid is still
refused with the NOT_A_RECORD message and deletes nothing). A row whose
@Rid is not a record fails the statement at the first row naming that
identity, so no later row is skipped for it (comment at the check).
- Tests run: `DeleteSubqueryDuplicateRowsIssue12256Test` (8),
`DeleteExecutionStepTest`, `CheckSafeDeleteStepTest`,
`SQLDeleteVertexIssue11620Test`, `QueryTest`,
`ExplainStatementExecutionTest`, `TruncateClassStatementExecutionTest`,
`TimeSeriesColumnConstraintsTest`: all pass.


## Committer follow-up (c0973d2)

This supersedes the "Memory" point above. The transaction forgets its
deleted records at every commit, so under `DELETE ... BATCH n` the
step's set was the one structure that kept growing (about 1.6 GB at 100M
deleted records), on a plain scan that can never name a record twice.
`DeleteExecutionPlanner` now tells the step whether its source can name
a record twice: a scan of a type or of one bucket keeps nothing (the
select planner already puts a distinct step behind an index fetch of an
IN or an OR), while a subquery, a list of RIDs, a parameter or a
variable keeps the set for the whole statement. `DeleteStep.reset()`
drops the set. New tests: a duplicate straddling a `BATCH` commit, a RID
list and a parameter list naming a record twice, indexed IN/OR scans and
a bucket scan deleting each record once, and
`DeleteStepRepeatedRecordPlanningIssue12256Test` for the planner
decision.

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
… BY @Rid on MATCH rows answer 400 with their message, not 500 (#12447)

Fixes #12425.

## Cause

Four refusals of a caller's mistake reached the HTTP handler as
exceptions its classifier answers with 500:

| statement | thrown as | answered |
|---|---|---|
| `CREATE EDGE E FROM #5:0 TO #1:0` with a document RID as an endpoint |
`java.lang.ClassCastException` from the record cast
(`BaseRecord.asVertex`) | 500, raw Java class in the body |
| `CREATE EDGE E FROM (SELECT FROM Doc) TO (SELECT FROM V)` and the
reverse | `CommandExecutionException("Invalid vertex for edge creation:
...")` | 500 |
| `MATCH {rid: 'garbage', as: p} RETURN p` |
`CommandExecutionException("Cannot convert to RID: garbage")` | 500 |
| `MATCH {...} RETURN ... ORDER BY @rid` |
`CommandExecutionException("ORDER BY @Rid has no meaning ...")` | 500 |

The HTTP API reference lists 400 for a statement the server refuses to
run and reserves 500 for a failure of the server.
`CommandExecutionException` itself maps to 500 in
`AbstractServerHttpHandler`; its subclass `TypeMismatchException` and
`CommandParsingException` map to 400.

## Change

- `CreateEdgesStep.asVertex`: the three "not a vertex" exits throw
`TypeMismatchException` (a `CommandExecutionException` subclass, so
embedded callers that catch the parent still catch it). The
`ClassCastException` of the record cast is caught at that one conversion
and rethrown as `TypeMismatchException("Invalid vertex for edge
creation: Cannot cast the document #5:0 to a vertex")`, so no Java class
name reaches the client.
- `Rid.toRecordId`: the three "Cannot convert to RID" exits throw
`TypeMismatchException`.
- `MatchExecutionPlanner.checkOrderByRecordAttributes`: the refusal is a
`CommandSQLParsingException`, like the other planner-time refusals of a
statement's text. The message is unchanged.

Nothing is written by any of the four statements before or after.

## Behaviour change

The four statements answer HTTP 400 instead of 500, with the same
messages (the cast failure now carries the `Invalid vertex for edge
creation: ` prefix). The `ORDER BY @rid` refusal is now a
`CommandSQLParsingException` in embedded use;
`MatchPatternRegressionTest` asserted the old class and is updated to
the new one.

Not changed, and still 500 in the same statement family: `Invalid TO
vertex for edge` (a null endpoint), `Type 'X' is not an edge type`, and
the unidirectional-on-bidirectional refusal. Existing tests pin their
classes, and the issue does not list them.

## Tests

`Issue12425CallerMistakesInGraphStatementsAre400Test` (server module,
over HTTP):

| case | on origin/main engine sources | with the fix |
|---|---|---|
| document RID as an endpoint: 400, message, no Java class name, nothing
written | fails | passes |
| a query returning a document as either endpoint: 400, message, nothing
written | fails | passes |
| `MATCH {rid: 'garbage'}`: 400 with the message | fails | passes |
| `ORDER BY @rid` on MATCH rows: 400 with the message | fails | passes |
| a valid `CREATE EDGE` between two vertices still works | passes |
passes |

5 run, 0 skipped: 4 failures on origin/main engine sources, 0 with the
fix. Related engine classes (`MatchPatternRegressionTest`, the CREATE
EDGE, RID and `BasicGraphTest` classes): 215 run, 0 failed, 0 skipped.
`com/arcadedb/query/sql/**` and `com/arcadedb/graph/**` with
`-DexcludedGroups=slow,benchmark`: 6,641 run, 0 failures, 0 errors, 8
skipped.

## Bug prevention

- **Class:** a refusal of the caller's input raised as a type the HTTP
classifier answers with 500, or as a raw Java exception from an
unchecked cast.
- **How it happened:** the refusals were written as
`CommandExecutionException`, which is also what internal command
failures use; only a few subclasses are classified as client errors.
- **Why testing missed it:** the engine tests assert the exception type
and message, never the HTTP status.
- **Prevention check:** the test above asserts the status over HTTP.
- **Sibling sweep:** the other 500-for-caller-mistake sites in the same
statement family are listed above under "Not changed"; #12436 covers the
DDL statements.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved error reporting for invalid edge endpoints, malformed record
IDs, and unsupported `ORDER BY` attributes in `MATCH` queries.
* Invalid graph statements now return HTTP 400 responses, while valid
edge creation continues to succeed.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
…ode()`; make the orders the engine and its tests relied on explicit (#12482)

Fixes #12481 (the issue for the hash defect)

## What

`RID.hashCode()` was `bucketId * 31 + Long.hashCode(offset)` and
`PageId.hashCode()` was `31 * (31 * (31 + hash(database)) + fileId) +
pageNumber`. Both only add the parts of the key. The offsets of a bucket
are `pageId * 2048 + positionInPage` with a few dozen of the positions
of a page in use, so the RIDs of one bucket fall in a few percent of the
bins of a `HashMap` and most bins become trees; the pages of a few files
have a small fraction of that many distinct hashes.
`rid_hash_distribution.py` in the issue reproduces it on a running
server.

Both now take the high half of a Fibonacci multiplication of the whole
key (`RID`: the packed `(bucketId, offset)`; `PageId`: the packed
`(fileId, pageNumber)`, plus the database hash as before). Equality is
unchanged.

## The orders the old hash made

With the old hash the hash of a small offset is the offset (plus
`bucketId * 31`), so a `HashMap<RID, ...>` iterated in the order of its
bins: for the twelve RIDs `#1:0..#1:11` of a test fixture that is `#1:1
.. #1:11` and then `#1:0`, because `31 + 0` wraps to the last bin of a
16-bin table. It was neither insertion order nor RID order, and a few
places depended on it without saying so. Running the whole engine module
with only the two hashes changed gave these failures, all passing on
`main`:

| Test | What depended on the order | Change |
|---|---|---|
| `Discussion4044HybridSearchE2ETest.hybridQueryMatches4044UseCase` |
`vector.fuse` sorts the fused scores by score alone, so equal RRF scores
came out in the iteration order of a `HashMap<RID, Float>`. In this test
the first two chunks are first in one ranker and second in the other, so
their fused scores are exactly equal (0.032522473); the test passed on
`main` by that accident, not because the sparse side breaks the tie as
its comment said | production: ties by RID ascending
(`SQLFunctionVectorFuse`); the test's comment now says so |
| `BmwBlockSkipPruningTest` (2) | the test's `BruteForceScorer`
reference sorted by score alone; `BmwScorer` documents best score first,
ties by RID ascending | test helper: the same total order |
|
`ChunkedRecordStorageTest.holesSmallerThanTheGrowthStillSpareANeighbourTheMove`
| a shrink and a growth in one transaction are applied in map order, and
the test is only about "shrink first" (on `main` the filler's slot
happened to come first) | test: the shrink and the growth stay in one
transaction, and the test picks the filler to empty that the commit
applies before the growth (the commit walks a `HashMap` keyed by RID,
which the test reproduces), asserting that premise so a change of the
hash cannot flip the scenario silently |
|
`ChunkedRecordStorageTest.aChainThatLoopsPastItsFirstHopIsAlsoReportedAsCorruption`
| which records of the fixture end up with a chain of three chunks
follows the order the growth was applied in; the test assumed record 0 |
test: take a record that has one |
| `SharedPageViewTest.hashCodeIsTheValueObjectsHashReturned` | pinned
`PageId.hashCode()` to `Objects.hash(database, fileId, pageNumber)` |
test: asserts equal ids hash alike and the cached value is stable, not
the formula |

Each test change also passes on `main` (checked by applying the test
changes alone).

**User-visible:** `vector.fuse` now returns documents with equal fused
scores in RID ascending order, where before it was the iteration order
of a hash map. That is deterministic and documented in the code, but it
is not the order users saw before: that was the hash map's bin order,
mostly ascending by position and wrapping around as described above. The
same holds for the equal-scored results of a more-like-this search and
of the pending side of a sparse vector search inside a transaction.

**Persistence:** nothing stored derives from `RID.hashCode()` or
`PageId.hashCode()` that I found. The open-addressing tables that place
slots by `key.hashCode()` (`CompressedRID2RIDIndex`,
`CompressedRID2RIDsIndex`, `CompressedAny2RIDIndex`) are built only by
the OrientDB and JSONL importers as in-memory maps; their `(database,
Binary)` constructors and `getInternalBuffer()` have no caller in the
repository, so no buffer is written out and read back under another
hash. (They have the same clustering and benefit too.) Bloom filters
hash the key bytes with Murmur and a `HashIndex` hashes its own
definition.

New `RIDHashCodeTest`: the RIDs of one bucket, of 16 buckets and the
lightweight edges of one type must fall in many bins of a 65,536-bin
table and few at the treeify threshold, and lightweight edges with
different endpoints must hash differently. New `PageIdHashCodeTest` (on
a real database): the pages of 16 files do the same and the pages `(f,
p)` and `(f + 1, p - 31)` no longer collide. Both fail on `main` and
pass with the change.

## Not changed, and not proven

- **The other two places that sorted the contents of a `Map<RID, ...>`
by score alone** (`SparseTransactionOverlay.topK` and the
`searchMoreLikeThis` result in `LSMTreeFullTextIndex`) now break ties by
RID ascending too, like `vector.fuse`, `BmwScorer` and the other ranked
results of the full-text index; for the overlay that also makes the
transaction side pick the same record as the committed side at the top-k
boundary. Each has a test that fails without the tie-break.
- **Test evidence:** the whole engine module passed on this change
before the rebase onto the current `main` (29,102 tests, 0 failures, 22
skipped, base `7f636332b3`). After the rebase, a full local run of the
engine module stalled **twice**, both times in
`CypherMatchDuringConcurrentDetachDeleteTest` after about 1,040 test
classes. That test passes alone with and without this change, and the
whole `com.arcadedb.query.opencypher` package passes on both this branch
and on unmodified `5d6338bb2f` (9,260 tests on `main`). I did not
reproduce the stall in anything narrower than a full run, and I did not
run a full engine run on unmodified `5d6338bb2f`, so I cannot say
whether it is caused by this change, by state accumulated by earlier
packages, or by `main`. CI on this PR is the first full result on the
rebased code. The server and protocol modules were not run.
- **Performance** (details and numbers in the issue): full-text
benchmark, 750,000 documents, 16 buckets, 31-word OR, alternating images
with the running image checked in every arm. On `7f636332b3`, before
#12467, the hashes cut the `top50` container CPU from 95 to 104 s to 60
to 69 s and one client from 238 to 263 ms to 144 to 151 ms (eight
clients 15 to 16 against 22 to 26 q/s). On the current `main` the
plain-OR search no longer builds the per-bucket maps and the hashes make
no difference to `top50`; the filtered shape, which still uses the
general path, used about 15 % less CPU (58 s against 68 s on average)
and about 19 % less time with one client. The merged map of every RID
was never affected. The `PageId` change has no profile of its own.
- **Graph queries: mixed, not established.** On graphs of 300,000
vertices and 1.2 million edges, a triangle count (`MATCH
(a:V)-[:E]-(b:V)-[:E]-(c:V)-[:E]-(a) RETURN count(*)`, which should plan
`TriangleCountOp`; I could not read the plan, `EXPLAIN` returns nothing
over HTTP) and a two-hop count (`MATCH (a:V)-[:E]->(b:V)-[:E]->(c:V)
RETURN count(*)`) returned identical results with and without the new
hashes; three alternating rounds each, the running image checked in
every arm, pooled medians of nine timed runs. With sparse pages (about 1
KB per vertex, 51 records per page): triangles 1,341 ms against 1,065 ms
(slower), two-hop 3,699 ms against 3,345 ms (slower). With dense pages
(an id only, 1,339 records per page): triangles 1,079 ms against 1,425
ms (faster), two-hop 3,641 ms against 3,204 ms (slower). The ranges
overlap in every case. The two-hop count was slower in both graphs
(about 10 to 15 %), the triangle count went both ways, so I cannot
attribute either to the hash, and an explanation by cache locality is
not supported by the dense result.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved how record and page identifiers are distributed in hash-based
collections, helping avoid uneven clustering.
* Vector search results with equal scores now use a consistent record-ID
order, making tie outcomes predictable.
* Updated vector scoring comparisons to apply the same
score-and-record-ID ordering when selecting top results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca pushed a commit that referenced this pull request Nov 23, 2026
… substring and split (#13151)

## What does this PR do?

`RID(String)` and `RID.is(String)` read the canonical form
`#<digits>:<digits>` (plain ASCII digits, at most 9 for the bucket and
18 for the position) in place, with no `substring`, no `CodeUtils.split`
list and no boxed parts. Every other string takes the general path
exactly as before.

## Motivation

#13150: `vector.neighbors(..., {filter: <RID strings>})` parsed every
string twice (`RID.is`, then `database.newRID`), each through
`substring` + `CodeUtils.split`: about 375 bytes per RID, 51% of the
bytes a 5,000-RID filtered search allocates and 17-19% of its CPU
samples.

Allocation per search (50,000 x 1024 INT8 COSINE, 5,000 RID strings, k =
5,000, `ThreadMXBean` allocated bytes, 400 searches after 150 warm-up,
alternating A,B,A,B, ZGC 3g, 4 CPUs, 1-minute load 2-3):

| build | run 1 | run 2 | run 3 | A/A spread |
|---|---|---|---|---|
| main db12ad2 | 8996.2 KiB | 8996.3 KiB | 8996.3 KiB | 0.001% |
| this PR | 6621.4 KiB | 6621.6 KiB | 6621.4 KiB | 0.003% |

-2375 KiB per search (-26.4%, about 486 bytes per RID). Secondary: p50
8.68 / 8.68 / 8.92 ms -> 8.00 / 8.35 / 8.21 ms (about -6%, the main A/A
run-to-run spread is 3%). async-profiler `-e itimer`: `parseRidFilter`
18.7% -> 9.1% of the samples under `SQLFunctionVectorNeighbors.execute`
(5,154 -> 4,355 samples for the same 750 searches); `RID.is` 6.2% ->
0.8%, `RID.<init>` 6.0% -> 0.6%. The repro in the issue: 383 / 374 bytes
per RID string on main (exit 1), 2 bytes with this PR (exit 0).

## Related issues

Fixes #13150

## Additional Notes

Behaviour is unchanged for every string: the fast path only takes `#`,
1-9 ASCII digits, `:`, 1-18 ASCII digits, which `is` and the constructor
already accepted and converted to the same value. Signs, non-ASCII
digits, a trailing `:`, extra parts and all the malformed shapes fall
through to the old code, so the verdict and the exception class are the
ones main gives (`is` and the constructor disagree on some strings, e.g.
`#:12` is accepted by `is` and fails in the constructor with
`NumberFormatException`; callers such as `parseRidFilter` rely on that
split).

Tests, written before the change and passing on main:
- `RIDParseTest` (10): a token table (canonical, signs, non-ASCII
digits, `#1:2:`, `#1:2:3`, overflow, every malformed shape with its
exception class), a round trip through `toString`, and a fixed-seed
model test of 400,000 random strings against the previous
implementation. Red check: letting `plainDigits` accept `:` fails 5 of
10.
- `VectorRidFilterParseTest` (13): `parseRidFilter` pinned for strings
vs RIDs (same set, `DatabaseRID` bound to the database), absent option,
empty list, nulls, duplicates in different spellings, RIDs of another
bucket and of no record, one level of nesting, the parsing error naming
the token, the `NumberFormatException` for the
accepted-but-unconvertible shapes, and the same rows in the same order
for strings and RIDs through SQL (k = 10 and k = len).

Run: `com.arcadedb.index.vector.**`,
`com.arcadedb.function.sql.vector.**`, `CypherVector*`,
`CypherCallVectorNeighborsTest`, `RID*Test`, `DatabaseRID*Test`: 1,618
tests, 0 failures, 0 errors.

## Checklist

- [ ] I have run the build using `mvn clean package` command
- [x] My unit tests cover both failure and success scenarios


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Canonical record identifiers in `#<bucket>:<position>` format are now
recognized consistently by RID validation and parsing when their numeric
parts meet the supported limits. Other formats continue through the
existing general parsing behavior.
* This improves handling of standard record identifiers while preserving
support for other accepted inputs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
lvca added a commit that referenced this pull request Nov 23, 2026
…ut of a view's columns (#12231)

Fixes #12229.

### Problem

A Graph Analytical View keeps a property out of its columns when its
types declare it with different column types, but the exclusion did not
hold:

1. The collector removed the name on the conflict and the next type
declaring it added it again: `A.p INTEGER`, `B.p DOUBLE`, `C.p INTEGER`
gave an `INT` column for `p` (the same for edge properties: `R.w
INTEGER`, `S.w DOUBLE`, `T.w INTEGER` gave an `INT` edge column for
`w`).
2. When the conflict left no declared vertex property, the build fell
back to sampling records for schemaless properties, and the first
sampled value created a column for the conflicting name: `A.p INTEGER`,
`B.p DOUBLE` gave an `INT` column.

In both vertex cases the view served `p` for the `INTEGER` types from
the column and held nothing for the `DOUBLE` vertices (their values do
not round-trip through `INT`, so `fillProperties` skips them).

### Change

`CSRBuilder`:

- One collector, `declaredColumnTypes(typeNames, included, conflicting,
...)`, replaces `collectSchemaProperties` and
`collectEdgeSchemaProperties`, which were the same loop with a different
filter and log text. It records every name that conflicted in
`conflicting` and skips that name for every later type.
- The vertex path keeps that set for the build, and `sampleProperties`
skips the names in it.

### Tests

New `GavPropertyTypeConflictTest`:

| test | `engine/src/main` from `origin/main` | this branch |
|---|---|---|
| `aVertexPropertyConflictStaysAcrossALaterType` (A INTEGER, B DOUBLE, C
INTEGER) | fails: `{#7:0=4, #4:0=null, #4:1=null, #1:0=1}` served from
the view | passes, no vertex served `p` from a column |
| `aVertexPropertyConflictIsNotSampledBack` (A INTEGER, B DOUBLE) |
fails: `{#4:0=null, #4:1=null, #1:0=1}` | passes |
| `anEdgePropertyConflictStaysAcrossALaterType` (R INTEGER, S DOUBLE, T
INTEGER) | fails: the view has an edge column | passes |

`com/arcadedb/graph/olap/**/*Test` and `WeightedPathTest` (excluding
`slow`): 743 tests, all pass.

### Overlap with #12194

#12194 (open) changes `collectEdgeSchemaProperties` the same way for the
edge case (commit eab5491, from a review comment). Whichever of the
two merges second needs that method resolved to the shared
`declaredColumnTypes` of this PR.

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 23, 2026
…properties they would inherit (#12067)

Fixes #12030

`ALTER TYPE T SUPERTYPE +S` did not hold `T`'s stored records against
the constraints `T` inherits from `S`. It answered OK over records that
violate a MANDATORY, NOTNULL, MIN, MAX or REGEXP of `S`, and every later
write to them failed, including updates of other properties. Declaring
the same constraint on `T` directly is refused over the same records
(#8943, #9112).

### What changes

- `ExistingRecordsCheck.requireInheritedDeclarations`: one pass over the
type (polymorphic, so its sub types' records too), holding each record
to the properties it would newly inherit with the rules
`requireDeclaration` applies to a new property (existence flags,
declared type, MIN, MAX, REGEXP). It stops at the first violating
record, as the other checks of that class do, and refuses with a
`ValidationException` (HTTP 400) that names the record and its reason,
e.g. `Cannot make type 'T' a sub type of 'S': record #1:0 violates the
properties it would inherit, The property 'T.p' value 5 is less than 10.
Fix or delete the non-conforming records first`.
- `LocalDocumentType.checkCanAddSuperType` asks it last for a new
linkage, before the link is made, so a refusal changes nothing. Only
properties the type does not see yet are checked, a record whose own
type already sees the property is governed by that declaration, and a
property nothing stored can violate is not scanned for. "Sees" follows
the write path, which validates the polymorphic properties as a set:
equal properties (same name, declared type and element type) are one, so
a property the type declares itself shadows the super type's, while a
same-name property of another declared type does not (both are
validated, and a later write would fail on the inherited one). What a
record type sees is asked once per record type, not per record. Linkages
that already hold (schema load, re-attachment after `DROP TYPE`) are not
asked.
- Cost: a polymorphic read of the type under the schema write lock, the
cost `CREATE PROPERTY` and `ALTER PROPERTY` already accept through
`requireDeclaration`. It ends at the first violating record, and it is
skipped when the type already sees every property of the super type or
no inherited property can be violated by a stored value. A new type made
with its super type has no record, so the scan reads nothing.
- Side effect: a stored value of another type than the inherited
declaration (`'abc'` under an inherited INTEGER with an index on it) is
now refused here with a 400 naming the record, instead of failing the
index propagation with a 500 `IndexException: ... For input string:
"abc"` (one of the rows of #12037).

### Tests

`SuperTypeStoredRecordsTest` (new):

- MANDATORY, NOTNULL, MIN, MAX, REGEXP (parameterized): refused naming
one of the violating records, with the constraint kind, no link, and the
records can still be updated;
- a sub type's record is held to it and named; once fixed, the link is
made;
- the properties of the super type's own super types are held to it too;
- a stored value of another type is refused before the index
propagation;
- a property the type declares itself shadows the super type's (an
UPDATE after the link shows the shadowed declaration is not enforced), a
sub type that declares it shadows it for its own records only, and a
same-name property of another declared type does not shadow it;
- conforming records, and a super type with an index, link as before;
- a type made with its super type (`CREATE ... TYPE T EXTENDS S`) is
linked, and a type made again with a super type through the type builder
gets the same refusal.

### Results

Engine tests (Docker, maven:3.9-eclipse-temurin-21), on the first
version of this PR:

- failing-first: `SuperTypeStoredRecordsTest` 8 run, 7 fail (the
parameterized
`aSuperTypeWhoseConstraintTheStoredRecordsViolateIsRefused`, the sub
type test, `aStoredValueOfAnotherTypeIsRefused`).
- `-Dtest='com/arcadedb/schema/**/*Test,SuperTypeStoredRecordsTest'
-DexcludedGroups=slow`: 1814 tests, 0 failures, 0 errors, 0 skipped.

On the final version (review round): `SuperTypeStoredRecordsTest` 15
tests green, and 10 of the 12 tests of the previous round fail with the
scan call disabled (the two that pass are the positive controls,
conforming records and the shadowed property). Connected classes (schema
package, `SqlExistingRecordsDdlTest`, `PolymorphicTest`, `DropTypeTest`,
`TypeCreationTest`, the DDL and index schema tests, 2102 tests) are
green, and so are the server and postgresw tests that build super types.

End to end, HTTP against a server built from main (`s12030` repro).
These tables were measured on the first version of this PR: the ALTER
TYPE column then gave a count (`1 stored record of 'T' violates ...`);
the final message names the record (`record #1:0 violates ...`), which
the unit tests assert. The status codes and the follow-up UPDATE are
unchanged.

Server with the main jars (a7304ab):

| constraint on S.p | T record | CREATE PROPERTY T.p directly | ALTER
TYPE T SUPERTYPE +S | then UPDATE T SET other = 2 |
|---|---|---|---|---|
| MANDATORY true | `other = 1` | 500 CommandExecutionException: Cannot
create property 'T.p': record #1:0 violates it, property 'T.p' | 200 OK
| 400 ValidationException: The property 'T.p' is mandatory, but not
found on record: #1:0@T[othe |
| NOTNULL true | `p = null` | 500 CommandExecutionException: Cannot
create property 'T.p': record #1:0 violates it, property 'T.p' | 200 OK
| 400 ValidationException: The property 'T.p' cannot be null, record:
#1:0@T[p=null,other=2] |
| MIN 10 | `p = 5` | 400 ValidationException: The property 'T.p' value 5
is less than 10 | 200 OK | 400 ValidationException: The property 'T.p'
value 5 is less than 10 |
| MAX 10 | `p = 50` | 400 ValidationException: The property 'T.p' value
50 is greater than 10 | 200 OK | 400 ValidationException: The property
'T.p' value 50 is greater than 10 |
| REGEXP '[a-z]+' | `p = 'ABC'` | 400 ValidationException: The property
'T.p' does not match the regular expression '[a-z]+'. Fi | 200 OK | 400
ValidationException: The property 'T.p' does not match the regular
expression '[a-z]+'. Fi |

Same server, engine jar built from the first version of this branch:

| constraint on S.p | T record | CREATE PROPERTY T.p directly | ALTER
TYPE T SUPERTYPE +S | then UPDATE T SET other = 2 |
|---|---|---|---|---|
| MANDATORY true | `other = 1` | 500 CommandExecutionException: Cannot
create property 'T.p': record #1:0 violates it, property 'T.p' | 400
ValidationException: Cannot make type 'T' a sub type of 'S': 1 stored
record of 'T' violat | 200 OK |
| NOTNULL true | `p = null` | 500 CommandExecutionException: Cannot
create property 'T.p': record #1:0 violates it, property 'T.p' | 400
ValidationException: Cannot make type 'T' a sub type of 'S': 1 stored
record of 'T' violat | 200 OK |
| MIN 10 | `p = 5` | 400 ValidationException: The property 'T.p' value 5
is less than 10 | 400 ValidationException: Cannot make type 'T' a sub
type of 'S': 1 stored record of 'T' violat | 200 OK |
| MAX 10 | `p = 50` | 400 ValidationException: The property 'T.p' value
50 is greater than 10 | 400 ValidationException: Cannot make type 'T' a
sub type of 'S': 1 stored record of 'T' violat | 200 OK |
| REGEXP '[a-z]+' | `p = 'ABC'` | 400 ValidationException: The property
'T.p' does not match the regular expression '[a-z]+'. Fi | 400
ValidationException: Cannot make type 'T' a sub type of 'S': 1 stored
record of 'T' violat | 200 OK |

Overlap note: separate PRs for #12031, #12032, #12035, #12036, #12038
and #12039 are being prepared in the same area (`LocalDocumentType`,
`LocalSchema`, `ExistingRecordsCheck`, the ALTER/CREATE TYPE
statements). Textual merge conflicts with them are possible; the changes
are meant to be independent. This PR and the one for #12028 and #12029
both add a step at the end of `LocalDocumentType.checkCanAddSuperType`;
this PR and the one for #12037 both edit `ExistingRecordsCheck`. The
second to merge needs a small rebase. The 500 in the `CREATE PROPERTY
T.p directly` column above is #12037.

### Merge note: #12063

This PR conflicts textually with #12063 in `LocalDocumentType.java`,
around line 3496. Both add private methods directly after
`checkCanAddSuperType`. This PR adds
`checkStoredRecordsMeetInheritedProperties`; #12063 adds `checkNoCycle`,
`checkSameRecordKind` and `recordKindName`. To resolve it, keep both
blocks.

One ordering rule applies after the merge. The stored-record scan this
PR adds walks `superType.getPolymorphicProperties()`, so its call has to
stay after the `checkNoCycle` call that #12063 puts at the head of
`checkCanAddSuperType`. Run before it, the walk could follow a cycle
before the cycle check refuses it. In this PR the call is the last step
of the `newLinkage` block, so keeping it there is enough, and a comment
at the call site says so.

### Related

The same gap exists the other way round, when a shadowing declaration
goes away: `DROP PROPERTY` of the shadowing property and `DROP TYPE` of
an intermediate type are accepted over records that violate the
constraint they then inherit (#13177). Not part of this PR.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Adding a supertype now checks existing records against the constraints
they would inherit, including required values, nullability, data types,
ranges, and patterns.
* The check includes records in subtypes and inherited constraints from
ancestor supertypes. If any record violates an inherited constraint, the
change is rejected and the type’s existing supertype relationships
remain unchanged.
* After the records are corrected, the supertype can be added. Records
with properties that share a name but have different declarations are
also validated.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: lvca <l.garulli@arcadedata.com>
lvca added a commit that referenced this pull request Nov 24, 2026
…LIST or MAP as RIDs (#13319)

Fixes #12598

## What was wrong

A property declared as a bare `LIST` or `MAP` (no `OF <type>`) that
holds links was read back by the Java HTTP client (`RemoteDatabase`) as
Strings (`"#1:0"`), while the embedded API, a `LIST OF LINK` property
and an undeclared property (#12195) all give `RID`s. A non-finite number
in such a collection had the same gap (the #10905 hint).

Two halves, one on each side of the wire:

- `JsonSerializer.serializeResult` emitted the `@props` hint of an
element row only when the schema does not declare the property. A
declared bare `LIST`/`MAP` says no more about its items than no
declaration does, but got no hint. The openCypher `RETURN n` projection
branch had the same check.
- `RemoteImmutableDocument` read the hint only for an undeclared
property; for a declared one it took the element type from `ofType`
alone, which is null for a bare collection.

## Fix

- Serializer: a new `schemaSaysNothingOfTheItems` decides the hint for
both the element row and the projected element: undeclared, or a
declared `LIST`/`MAP` with no `ofType`. The declared property is looked
up only for a `LIST`/`MAP`, before walking the items, so rows of
declared scalars or typed collections pay nothing and keep their current
shape.
- Client: for a declared `LIST`/`MAP` with no `ofType`, the element type
comes from the hint; `convertNestedOfType` already turns `LINK` items
into RIDs and non-finite markers into numbers.

The gRPC client is not affected. Temporal items in a bare or undeclared
collection (and undeclared temporal scalars) still read back as Strings
over HTTP: that is the scope of #12599 and is left there.

## Tests

- `RecordSerializationTest.LinkElementRowHint`: a bare declared LIST/MAP
of links gets `LIST(LINK)`/`MAP(LINK)` hints (element row and
Cypher-projected element), a `LIST OF LINK`/`MAP OF LINK` gets none; a
bare declared LIST with NaN gets `LIST(DOUBLE)`, a `LIST OF DOUBLE`
none; a bare list of plain values gets no hint.
- `Issue12598RemoteBareCollectionReadBackIT` (server): RIDs through
`lookupByRID`, a SQL query and a Cypher `RETURN n`; NaN/Infinity in a
bare LIST read back as Doubles; rid-looking text stays text.

Both fail without the fix and pass with it. Also run:
`JsonSerializer*Test`, `JsonTemporalSerializationTest`,
`RecordPersistenceTest`, all network `com/arcadedb/remote/*Test`, all
server `com/arcadedb/remote/*IT`, `HttpPropsTypeHintIT`,
`RemoteProjectionRidColumnIT`: all green.
lvca added a commit that referenced this pull request Nov 24, 2026
… is a type error, as in Neo4j (#13339)

Fixes #12622

## What was wrong

In openCypher, `+` with a STRING on one side refused a Map and a Point
(#12397). Every other operand that was not a string fell through to
`leftValue.toString() + rightValue.toString()`. So a node, a
relationship, a path or a plain document came back as the internal
record string:

- `MATCH (a:Person {name:'Alice'}) RETURN 'x:' + a` returned
`x:#1:0[name=Alice]`
- `MATCH ()-[r:Knows]->() RETURN 'r:' + r` returned
`r:V(#1:0)->[E#4:0]->V(#1:1)`
- `MATCH p=(a)-->() RETURN 'p:' + p` returned `p:(#1:0)-[#4:0]->(#1:1)`

Neo4j refuses all three: `Type mismatch: expected Float, Integer, String
or List<T> but was Node` (also `Relationship` and `Path`).

## Fix

`ArithmeticExpression.apply()` handles `+` for the AST path,
`ExpressionEvaluator` and `ConstantFolder`. In its string-concatenation
branch, a new helper, `notConcatenableTypeName()`, returns the Neo4j
type name of an operand that cannot be concatenated:

- `Node` for a Vertex
- `Relationship` for an Edge
- `Path` for a path value (`CypherFunctionHelper.isPathValue`)
- `Point` / `Map` for a map, as before
- `Map` for any other document

The branch throws the same `TypeMismatchException` #12397 introduced,
for either operand order. Strings, numbers, booleans, temporal values
and RIDs still concatenate. A variable-length relationship binds a list,
and `+` still appends to it.

## Tests

- New `CypherStringConcatGraphEntityIssue12622Test` (11 cases): node,
relationship and path on either side of `+`, a node passed through
`WITH`, a `shortestPath` path, and a document passed as a parameter.
Controls cover strings, numbers, booleans, a date, a RID and list
append. 9 cases failed before the fix and all 11 pass now.
- `mvn -o -pl engine -am test
-Dtest=com/arcadedb/query/opencypher/*Test,com/arcadedb/query/opencypher/**/*Test,com/arcadedb/function/**/*Test,com/arcadedb/query/sql/**/*Arith*Test
-DexcludedGroups=benchmark,slow,vector`: 12173 tests, 0 failures.
- openCypher TCK (`-Dsurefire.includes=**/*Suite.java`): 3897 scenarios,
0 failures.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* String concatenation with nodes, relationships, paths, maps, or points
now returns a type mismatch error instead of converting the value to a
string.
* Error messages identify the incompatible operand’s type. Concatenation
with supported scalar values and properties continues to work as
expected.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
lvca pushed a commit that referenced this pull request Nov 24, 2026
…d whose commit is in flight (#13349)

## What does this PR do?

Fixes #13323.

A commit replays its index operations in its first phase
(`TransactionContext.commit1stPhase`, `indexChanges.commit()`), which
puts the new vectors where a search finds them, and publishes the record
pages in its second phase (`commit2ndPhase`, `publishCommittedPages`).
Since #10973 (9399cbc, #11125) `vector.neighbors` makes a row without
reading its record when the calling transaction has not written to the
index, so a vector of a commit in that window came back as a row with
every property null, and the first property read logged it as a stale
entry (`StaleVectorEntryReporter`).

Before 9399cbc the row was made from `db.lookupByRID(rid, true)`,
which throws `RecordNotFoundException` for a record whose page is not
published, and the row was skipped. The order of the two commit phases
is the same on both sides.

The change:
- `LSMVectorIndex` counts the commit replays that have not concluded
(`hasCommitReplayInFlight()`). The journal of a replay
(`VectorIndexReplayUndo`) is registered by the first operation of the
replay and ends the mark from `publishIndexReplay()`, which `reset()`
calls after the pages are published, or from `undoIndexReplay()` on a
rollback.
- `SQLFunctionVectorNeighbors.deferredRecordReads` reads the records of
an index with a replay in flight, as before #10973. A record that cannot
be read yet costs a candidate, as a committed delete does, and is no row
of the answer. The question is asked after the searches, so a record
whose commit concluded in between is found published. An index with no
commit in flight still makes its rows without reading the records.

## Motivation

#13323: a vector search overlapping an insert commit answered rows
without properties. Bisect of the repro in #13323 between a759246 and
388a818 (engine/src/main only) gives 9399cbc as the first commit
where the repro hits, with its parent b254b50 clean.

## Related issues

Fixes #13323. Related: #10973, #11202 (the stale-entry report).

## Additional Notes

Tests (`VectorNeighborsInFlightInsertTest`, 2 tests): the commit is held
between `commit1stPhase` and `commit2ndPhase` on one thread while
another runs `vector.neighbors`.
- On main 87f6c03 the first test fails: the answer holds `{r: #1:60,
eid: null}`.
- On the parent b254b50 the same test (without the two assertions
that call the new method) passes, on 9399cbc it fails the same way.
- With this change both tests pass.
- Ran in one JVM with this change: `com/arcadedb/index/vector/*Test`,
`com/arcadedb/function/sql/vector/*Test`, `**/*Vector*Test`,
`**/Transaction*Test`, `**/*Replay*Test`: 2221 tests, 0 failures. That
run used the first version of the new test (60 base vectors); the final
test (1100 base vectors, so a search never rebuilds the graph inside the
search) was run alone.
- The repro of #13323 (60 s, 1 GB heap, 3 CPUs): main 3 of 3 runs hit (4
of 579, 9 of 620, 1 of 522 answers), this change 0 of 3 (559, 206, 424
searches); 30 s runs: main 1 hit in 2, this change 0 in 2.

Not verified: the Raft follower path (the replay journal exists only for
a transaction in `COMMIT_1ST_PHASE`, so a follower applying replicated
pages is not covered [INFERENCE]); an update of a record in flight (only
inserts are tested); the failsafe ITs and the rest of the engine suite;
a counter that a transaction never concludes (a process death
mid-commit, [INFERENCE] the index would then read the records of its
rows until it is reopened, which is the behaviour before #10973).

## Checklist

- [ ] I have run the build using `mvn clean package` command (only
`./mvnw -pl engine test` with the patterns above)
- [x] My unit tests cover both failure and success scenarios


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved vector-neighbor searches during concurrent inserts and
updates. Records from commits still in progress are read normally when
needed, while missing or rolled-back records are excluded.
* Improved result visibility during replicated updates, preventing
searches from returning records before their properties are available.
* Vector-neighbor results now remain consistent across commit and
rollback activity, including bulk updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: robfrank <ro.franchini@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants