Repository navigation
fix: keep typed literal values through the index (reindex affected ledgers) - #1988
Conversation
SPARQL UPDATE coerced only integer, decimal, double, boolean and vector
literals; every other datatype was committed as a string carrying its
datatype. The index stored such a string under the datatype's inline
o_type and decoded the string-dictionary id as the value, so xsd:date read
back as 1970-01-01 and xsd:long as i64::MIN + n. The same string shape made
SPARQL-written values miss typed query constants and deletes sent through
JSON-LD.
- SPARQL UPDATE templates coerce through core's coerce_string_value, as
JSON-LD does. A lexical form that is not a value of its datatype is
rejected with a 400.
- Both commit decoders read a well-formed string under a typed XSD
datatype as the typed value, so ledgers holding such commits are
repaired by a reindex.
- OTypeRegistry::resolve and the novelty overlay give a string under a
non-string datatype a string-keyed customer o_type, so ill-typed Turtle
literals ("1990-00-00"^^xsd:date) keep their lexical form instead of
being misread; this applied to Turtle insert and bulk import as well.
Docs: a troubleshooting page for affected ledgers and a datatypes section
on literals that are not values of their datatype.
7ea1012 to
b2dbc4a
Compare
aaj3f
left a comment
There was a problem hiding this comment.
@bplatz routing SPARQL UPDATE through coerce_string_value is exactly the right bottleneck, and the legacy-commit test proves the repair path rather than just the new writes. Two things I'd want in before merging: this has a semantic conflict with #1966, which is now on main (merged together, #1966's out-of-range decode panics again, read path included, even though the textual merge is clean), and geo:wktLiteral points SPARQL wrote before this change can no longer be deleted. Claude-assisted review below:
✅ Approving to unblock you — with 2 things that need to be addressed before this merges.
Routing SPARQL UPDATE through coerce_string_value, and keying the index guard on one predicate (OType::is_string_keyed) that the registry and the overlay both use, is the right altitude for this: the SPARQL list can't drift from JSON-LD again, and the two index writers can't drift from each other. The legacy-commit test proves the repair path, not just the new writes. Two things need to land first:
fluree-db-core/src/o_type_registry.rs:115-118, composition with #1966 (now onmain). Not a mistake on this branch's own base (the hunks don't overlap, as the body says) but a semantic conflict: since #1966,resolve_by_dtreturnsOType::RESERVEDpast the payload width, and this arm hands that dt toOType::customer_datatype, which #1966 made a hard assert.dt_past_payload_width_resolves_to_reservedanddecode_value_from_kind_dt_past_payload_width_is_nullpass onmainand panic once this PR is merged in, and the second one is the read path.|| by_dt == OType::RESERVEDfixes both, withit_typed_literal_indexandit_custom_datatype_limitstill green. This branch's CI ran before #1966 landed and nothing requires a re-run, so please rebase and let CI run before merging.fluree-db-core/src/commit/codec/raw_reader.rs:470, SPARQL-writtengeo:wktLiteralpoints. SPARQL now commits a wkt point as aGeoPoint, butretype_string_literalonly retypes XSD, so points SPARQL committed before this change stay strings: a SPARQLDELETE DATAnaming one commits and removes nothing, before and afterreindex(reproduced). A wkt arm in the retype fixes it.
Also worth doing in this PR:
- Upgrade note (
docs/troubleshooting/typed-values-wrong-after-indexing.md:61): every pre-upgrade index has to be rebuilt, and until then SPARQL deletes of already-indexed SPARQL values don't take; and pre-fix deletes that did nothing take effect on upgrade (reproduced: the value disappears on reload). Embedders have nofluree reindex, so a line for them there and an upgrade note in the PR title or body would help. On the solo side we'll bumpEXPECTED_INDEX_FORMAT_VERSIONwhen we repin. DELETE DATAwith an ill-typed literal (docs/concepts/datatypes.md:349): now a 400, which leaves Turtle's ill-typed literals removable only through a bound variable. Question inline.- The skip at
fluree-db-api/tests/it_typed_literal_index.rs:273-278goes with whichever of this and #1990 merges second (with both merged, the test passes without it). I'd land this one first. - #1974 (the mirror image the body lists as not fixed here): I agree it's separable. It lives in the incremental resolver, which builds its
OTypeRegistryfrom the base root's datatypes (incremental_resolve.rs:255-257), a path this PR doesn't touch, and the issue's own reading doesn't explain why it depends on timing, so a fix folded in here would be a guess before there's a deterministic repro.
Adherence to repo commitments:
- Patterns/abstractions: ✔ SPARQL UPDATE uses core's
coerce_string_value, the same bottleneck as JSON-LD and TriG, instead of its own partial list, and the string-keyed guard is oneOTypepredicate shared by both index writers.⚠️ retype_string_literalgates on the XSD namespace while the coercion it mirrors also rewritesgeo:wktLiteral. - Performance (speed first, memory second): ✔ No performance-degradation risk. For any object that isn't a string,
retype_string_literalis one discriminant check; a string under a non-XSD datatype costs oneu16compare, and one under an XSD string type a five-way&strmatch, with no allocation. The parse and its allocations run only for a string under a non-string XSD datatype, which means pre-fix SPARQL commits and ill-typed Turtle literals. The overlay's extrafind_dt_idscan and the registry's extra check sit on that same rare shape. - Deployment targets:
⚠️ The decode path is shared by every host, and the evidence (these tests, and the 4.2.1 check in the body) is CLI and in-process. The Lambda host can't runfluree reindex, so it needs the upgrade note above, and fluree/solo needs anEXPECTED_INDEX_FORMAT_VERSIONbump when it repins. - Testing: ✔ Six integration tests in
grp_indexplus unit tests; I ran them by name, and disabling the retype turnedcommits_holding_string_typed_literals_read_as_typed_valuesred.⚠️ Nothing covers a non-XSD datatype on the legacy path (the wkt gap), and the branch predates #1966, so the combination was never run. - Conventions: ✔ Self-describing title, a thorough commit body, and a troubleshooting page for affected ledgers.
Verified locally at b2dbc4ab7: grp_index it_typed_literal_index (6 passed), the four new core unit tests and the transact coercion tests; the retype mutation (red, then restored); a throwaway merge with origin/main (two #1966 tests red where they pass on main alone, green with the one-line fix, and 17 grp_index tests green); throwaway probes for the wkt delete and for the pre-fix no-op delete.
Approving now so you can merge without waiting on another pass from me — just be sure the rebase with the #1966 fix (and a CI run on it) and the wkt retype are in before you do.
| // and its datatype; decoding the string id as that datatype's | ||
| // value would read a dictionary position as a date or number. | ||
| let by_dt = self.resolve_by_dt(dt); | ||
| if by_dt.is_string_keyed() { |
There was a problem hiding this comment.
🔴 Must address before merge: once this is merged with today's main (#1966), this arm panics for a datatype id past the OType payload width, and two of #1966's tests go red.
This isn't a mistake on this branch's own base. The body's trial-merge note is right that the hunks don't overlap; the conflict is semantic. #1966 landed at 23:34Z, after this branch's CI finished at 17:02Z. It made resolve_by_dt return OType::RESERVED for a dt above OType::MAX_PAYLOAD (its "decode an out of range datatype as unknown rather than panicking" commit) and turned the debug_assert! in OType::customer_datatype into an assert!. RESERVED decodes as DecodeKind::Sentinel, so is_string_keyed() is false here, and the else hands a dt of 0x4000 or more to OType::customer_datatype (line 118), which now panics in release builds too.
o_type_registry::tests::dt_past_payload_width_resolves_to_reserved passes on origin/main (e4793617f) and on main with #1990 and #1995 merged, and fails as soon as this PR is merged in (panic at o_type.rs:267, "customer payload exceeds 14-bit range"). read::binary_index_store::tests::decode_value_from_kind_dt_past_payload_width_is_null does the same. The second test is the read path: o_type_from_kind and decode_value_from_kind both go through this resolve, so a damaged or future-format LEX_ID row goes back to aborting the process (fluree/solo builds with panic = "abort") instead of decoding as unknown, which is the case #1966 closed. db's ruleset doesn't require passing checks, and GitHub shows this PR as mergeable, so merging it as-is lands a red main.
Keeping RESERVED fixes it. With this line on a merge of main, both tests pass, and so do it_typed_literal_index and it_custom_datatype_limit in grp_index (17 passed). Could you rebase onto main and let CI run again before merging?
| if by_dt.is_string_keyed() { | |
| if by_dt.is_string_keyed() || by_dt == OType::RESERVED { |
The other customer_datatype call this PR adds, the overlay's store.find_dt_id(dt_sid).map(OType::customer_datatype) in binary_scan.rs, doesn't have this problem. It takes a position in the index root's datatype list, which #1966 bounds on every write path, and the existing otype_from_dt_sid already feeds find_dt_id to customer_datatype the same way. This arm is different because its dt comes straight off a decoded row.
There was a problem hiding this comment.
Fixed in c9f91b6 with your guard (|| by_dt == OType::RESERVED). I merged main in rather than rebasing. On the merge before the fix, dt_past_payload_width_resolves_to_reserved panicked with customer payload exceeds 14-bit range; with it, that test and decode_value_from_kind_dt_past_payload_width_is_null pass, as do it_typed_literal_index and it_custom_datatype_limit (all 112 grp_index tests). CI is running on the merged head.
| let RawObject::Str(lexical) = raw else { | ||
| return raw; | ||
| }; | ||
| if dt_ns_code != namespaces::XSD || xsd_names::is_string_like_name(dt_name) { |
There was a problem hiding this comment.
🔴 Must address before merge: geo:wktLiteral points that SPARQL committed before this change can no longer be deleted through SPARQL, and a reindex doesn't repair them.
coerce_typed_flake_value now sends every datatype through coerce_string_value, which turns "POINT(2.35 48.85)"^^geo:wktLiteral into a FlakeValue::GeoPoint (fluree-db-core/src/coerce.rs:551-562). The old SPARQL match had no wkt arm, so SPARQL used to commit a point as a String carrying the datatype. retype_string_literal only looks at the XSD namespace (this line), so those older commits stay String for good, in novelty and after any rebuild, while a SPARQL DELETE DATA naming the same literal now lowers to a GeoPoint, and the two never cancel.
I checked it with a throwaway test next to commits_holding_string_typed_literals_read_as_typed_values: commit the pre-fix shape (a String under geo:wktLiteral), reload from disk, and send DELETE DATA { <a> <loc> "POINT(2.35 48.85)"^^geo:wktLiteral }. The delete template is GeoPoint(48.85, 2.35), the commit succeeds, and the row is still there, both in novelty and after reindex. On main both sides were the same string, so the same delete removed it. That's #1987's part 2 again (a delete that reports success and removes nothing) for a datatype that used to delete fine, and a SPARQL re-insert of the point now writes a second, distinct term next to the old string.
A wkt arm here that mirrors coerce_string_value fixes it without borrowing anything, since RawObject::GeoPoint already exists. Illustratively, ahead of the XSD check:
if dt_ns_code == namespaces::OGC_GEO && dt_name == geo_names::WKT_LITERAL {
return match crate::geo::try_extract_point(lexical) {
Some((lat, lng)) if crate::GeoPointBits::new(lat, lng).is_some() => RawObject::GeoPoint { lat, lng },
_ => raw,
};
}A wkt point in the legacy-commit test would pin it. (I looked at rdf:JSON too: validate_value_dt_pair already refuses a String under it at stage time, so current releases can't have committed that shape.)
There was a problem hiding this comment.
Fixed in ed3c4d6. retype_string_literal now reads a POINT string under geo:wktLiteral as RawObject::GeoPoint, using try_extract_point + GeoPointBits::new as you sketched rather than coerce_string_value, which would allocate a String for every non-POINT geometry on decode. Other WKT stays a string, and the spatial hook already skipped POINT strings, so nothing drops out of the sidecar.
commits_holding_string_wkt_points_retract_through_sparql commits the pre-fix string, reloads from disk, and retracts it with SPARQL DELETE DATA, checked in novelty and after reindex. wkt_point_string_reads_as_geo_point covers the codec, including POLYGON, an out-of-range point and POINT EMPTY staying strings. Both fail with the new branch disabled.
| -d '{"ledger": "mydb:main"}' | ||
| ``` | ||
|
|
||
| An index that already misreads the values keeps misreading them until it is |
There was a problem hiding this comment.
🟠 Should address: every index built before the upgrade has to be rebuilt, embedders have no fluree reindex, and two effects of the upgrade aren't on this page yet.
The repair is decode-side, so an index built before the upgrade keeps its string-keyed rows until a full rebuild, and that window is more than cosmetic. By the code (I didn't replay a 4.2.1 index for this one), a SPARQL DELETE DATA of a SPARQL-written value that's already in the index used to lower to the same string and cancel its (XSD_DATE, string id) row; it now lowers to the typed value, whose key doesn't match, so it reports success and the value stays until the rebuild applies it. In the other direction, a pre-fix SPARQL delete that silently did nothing against a JSON-LD- or Turtle-written value is retyped on read as well, so after the upgrade it takes effect. I committed that shape against a JSON-LD date: the date is still there in the process that wrote it, and gone once the ledger is reloaded from its commits and after reindex. That second one is arguably what the user asked for, but it means values that were visible before the upgrade disappear with no new write, which is worth a sentence here.
For hosts: fluree reindex covers the CLI and the server, but an application that embeds fluree-db-api has no CLI. fluree/solo's Lambdas are the case I care about, and the only lever there is bumping EXPECTED_INDEX_FORMAT_VERSION, which invalidates and re-indexes every ledger at cold start. db's CURRENT_INDEX_VERSION (fluree-db-indexer/src/lib.rs:119) isn't bumped here and nothing reads it, so embedders get no machine signal either.
Could we add a line here for embedded deployments (call Fluree::reindex for each ledger after upgrading), plus an upgrade note in the PR title or body, since the release notes are generated from PR titles? On the solo side, we'll bump EXPECTED_INDEX_FORMAT_VERSION in the repin that picks this up.
There was a problem hiding this comment.
Done in ed3c4d6. The page now gives the Fluree::reindex call for embedded hosts and has a "What changes on upgrade" section with both effects: deletes of already-indexed values don't take until the reindex, and pre-fix deletes that did nothing take effect once the ledger is reloaded or reindexed. The title now ends "(reindex affected ledgers)" so it reaches the release notes, and the body has an Upgrade notes section.
Not done: CURRENT_INDEX_VERSION stays as is. Nothing reads it, so bumping it wouldn't give embedders a signal. Making it one would be its own change.
|
|
||
| A literal such as `"2024-02-30"^^xsd:date` or `"300"^^xsd:byte` names a | ||
| built-in datatype but is not one of its values. JSON-LD transactions and | ||
| SPARQL UPDATE reject it, naming the datatype in the error. Turtle |
There was a problem hiding this comment.
🟡 Optional: DELETE DATA now rejects ill-typed literals too, so a literal that Turtle kept can't be deleted by naming it anymore.
literal_to_template builds the delete templates as well as the insert ones, so DELETE DATA { ex:a ex:date "1990-00-00"^^xsd:date } is now a 400. This section says Turtle and bulk import keep such literals "as RDF allows", and on main, naming one in DELETE DATA lowered to the same string-with-datatype flake Turtle stored and removed it. DELETE WHERE already errored on it (the query-side coerce_value), so after this the only way left to remove one is through a bound variable, e.g. DELETE { ?s ex:date ?o } WHERE { ?s ex:date ?o FILTER(STR(?o) = "1990-00-00") }.
This is more of a question than a suggestion, and it's from reading the code rather than a run: rejecting on insert is clearly right, but I wonder if the delete side should lower an ill-typed literal to the string form Turtle stored, so the cleanup path stays open. If you'd rather keep it strict, a sentence here pointing at the variable-binding delete would do. Minor and non-blocking, but if you agree, I'd rather see it settled in this PR than lost in the backlog.
There was a problem hiding this comment.
Keeping it strict, and not documenting it in datatypes.md either. DELETE WHERE and query constants already reject these literals, so a lenient DELETE DATA would be a third behavior for one edge case. Deleting through a bound variable works, and it's now covered by tests instead of the docs: ill_typed_literals_keep_their_lexical_form removes one that way over an index and after a rebuild, and sparql_update_rejects_ill_typed_literal checks DELETE DATA as well as INSERT DATA. I also dropped the section's closing sentence, which only described the fix.
| // Separate gap, not this issue's: once indexed, a JSON-LD constant | ||
| // typed with a non-default numeric subtype matches nothing, even for | ||
| // JSON-LD-written data. | ||
| if lane == "indexed" && matches!(literal.2, "long" | "float") { |
There was a problem hiding this comment.
🟡 Merge-order note: this skip comes out with whichever of this PR and #1990 lands second.
With #1990 in, the indexed JSON-LD xsd:long/xsd:float constants match: on a merge of both with main, this test passes with these three lines and the comment above them removed. I'd land this PR first, since it's the P1 and what's left on it is small, and have #1990 drop the skip when it rebases; I've left the same note there.
There was a problem hiding this comment.
Agreed: this lands first, and #1990 drops the skip when it rebases. The skip stays here for now.
| expected_rows(), | ||
| "novelty loaded from commits" | ||
| ); | ||
| assert_eq!( |
There was a problem hiding this comment.
👍 This is the assertion that makes the legacy-commit test real.
The rows render the same whether the object is a string or a date, so the objects_of check above passes either way. I turned retype_string_literal into a no-op locally, and this is exactly where it went red (left: []). Writing it against a file ledger reloaded from its commits, rather than in-memory state, is what lets it see the decode path at all.
…ed-literal-coercion
Since #1966, resolve_by_dt returns OType::RESERVED for a datatype id past the o_type payload width, and OType::customer_datatype asserts on such an id. The LEX_ID arm passed every non-string-keyed result, RESERVED included, to customer_datatype, so a damaged or future-format row panicked on read instead of decoding as unknown.
SPARQL UPDATE now commits a geo:wktLiteral POINT as a geo point, as JSON-LD and Turtle do, but before this change it committed the point as a string. retype_string_literal retyped only XSD datatypes, so those older points stayed strings, and a SPARQL DELETE DATA naming one committed without removing it, in novelty and after a reindex. Both commit decoders now read a POINT string under geo:wktLiteral as a geo point; other WKT stays a string. Tests: a legacy string point is retracted through SPARQL; SPARQL DELETE DATA rejects an ill-typed literal as INSERT DATA does; a Turtle ill-typed literal is removed through a bound variable over an index and after a rebuild. Docs: the troubleshooting page covers reindexing from an embedded fluree-db-api, what changes on upgrade before the reindex, and SPARQL-written wkt points. The datatypes section drops a sentence that only described the fix.
|
@aaj3f thanks. Both blockers are fixed (c9f91b6, ed3c4d6), with |
#1988 skipped these constants on its indexed lane because a JSON-LD constant typed with a numeric subtype matched nothing once indexed. The typed-constant fix on this branch closes that gap, so the checks run on every lane.
Brings in 57bf7a9 (#2120, #2009). Two conflicts: - fluree-db-api/src/commit_transfer.rs: #2009 routes a push's graphs to the ids the ledger's graph registry gives them. The push's retraction check reads its slots through that routing as it is; only the routing struct's doc comment conflicted, and main's is kept. - fluree-db-transact/src/parse/jsonld.rs: #2009 reworks JSON-LD graph scoping, and carries the delete templates' `ill_typed_as_stored` that this branch reverts (call 2, aa1b3e6). Main's file is kept and the revert applied to it again: a delete template refuses an ill-typed literal, as #1988 had it.
With fluree#1988, SPARQL UPDATE lowers `"1"^^xsd:int`, `xsd:long` and `xsd:dateTime` literals as JSON-LD does, so a DELETE DATA intent names the stored term exactly and the retraction resolver deletes it, over novelty and over an index. Before fluree#1988 the intent named a string, and the delete removed nothing.
…pace `parse_xsd_double` and `parse_xsd_float` accept exactly the XSD 1.1 lexical forms: numerals, `INF`, `+INF`, `-INF` and `NaN`. A numeral too large in magnitude for the datatype maps to `INF` or `-INF`, as XSD 1.1 specifies. Rust's spellings (`inf`, `Infinity`, `nan`) are not lexical forms of either datatype. Every place that turns a double or float literal into a value uses it: JSON-LD coercion, SPARQL query literals and casts, SPARQL UPDATE, Turtle, and string-backed aggregate inputs. JSON-LD and SPARQL UPDATE refuse the other spellings as ill-typed literals, the rule other built-in datatypes follow (fluree#1988), and Turtle keeps them as ill-typed literals. SPARQL UPDATE words the refusal as JSON-LD does (`Parse error: ...`). R2RML renders non-finite float cells with the XSD spellings. Cypher's `toFloat` is not an XSD cast. It gets its own function and reads strings as Cypher does, `Infinity`, `-Infinity` and `NaN` included.
This reverts 987a937, "fix(transact): a DELETE can name a stored ill-typed literal", as pushed for review round 1. DELETE DATA and DELETE templates refuse an ill-typed literal ("abc"^^xsd:integer) again, as fluree#1988 left them, so a DELETE template agrees with DELETE WHERE, with a WHERE constant and with a query constant. fluree#1987's test is back as it was. The reverted message overstated what it changed. It said DELETE WHERE templates could name such a literal, but the WHERE half of a DELETE WHERE still lowered strictly and refused it, so a DELETE WHERE naming one failed before that commit and after it. Only DELETE DATA and a DELETE template over an empty WHERE had become lenient. A stored ill-typed literal is removed through a bound variable (FILTER(STR(?o) = "abc")), or replaced by an upsert or a graph sync.
Fixes #1987
Summary
SPARQL UPDATE committed most typed literals as strings, and the index decoded those strings' dictionary ids as the declared type:
"2026-09-08"^^xsd:dateread back as1970-01-01and"20705"^^xsd:longas-9223372036854775804once indexed. Values now commit as their typed value on every surface, and ledgers that already hold the string form are repaired by a reindex.Upgrade notes
fluree reindex <ledger>,POST /v1/fluree/reindex, orFluree::reindexin an application that embedsfluree-db-api. Incremental builds do not rewrite an index that already misreads the values.DELETE DATAsent through one surface for a value written through the other used to commit without removing it. It now names the same value, so after a reload or reindex that value is gone with no new write.docs/troubleshooting/typed-values-wrong-after-indexing.mdcovers all three.Root cause
Two defects compounded:
coerce_typed_flake_valueinlower_sparql_update.rscoerced onlyxsd:integer,xsd:decimal,xsd:double,xsd:booleanandf:embeddingVector. Every other datatype fell back toFlakeValue::Stringwith the datatype attached. JSON-LD and Turtle parse the same literals into typed values, so the same RDF term was two different flakes: a date constant missed SPARQL-written dates, and aDELETE DATAsent through the other surface committed without removing anything (the issue's part 2).LEX_ID+ dict id, andOTypeRegistry::resolvemappedLEX_IDthrough the datatype toXSD_DATE/XSD_LONG/ …, whose readers decodeo_keyas the value.value_to_otype_okeyin the overlay made the same pairing, so the misread also happened before any index build whenever an index already existed.The second defect was also reachable without SPARQL: Turtle keeps a literal that is not a value of its datatype (
"1990-00-00"^^xsd:date,"abc"^^xsd:integer) as a string, and those were misread the same way, both through transactions and bulk import.Changes
fluree-db-transact): template literals coerce throughfluree_db_core::coerce::coerce_string_value, the same function JSON-LD uses. A lexical form that is not a value of its datatype is now a lowering error (400) instead of a string that corrupts on index. The WHERE side already coerced vialower_triple_patternand is unchanged.fluree-db-core,retype_string_literal): both decoders (decode_raw_opfor the indexer,decode_opfor novelty) read a well-formed string under a typed XSD datatype as the typed value, and ageo:wktLiteralPOINT string as a geo point (SPARQL committed those as strings too;coerce_string_valuenow makes them points). This is what makes existing ledgers recoverable: after upgrading, novelty loaded from commits is typed, andfluree reindexrebuilds a correct index. Ill-typed lexicals and non-POINT WKT stay strings.OType::is_string_keyed().OTypeRegistry::resolvegives aLEX_IDunder a non-string-keyed datatypeOType::customer_datatype(dt)(dict-backed;resolve_datatype_sidmaps the payload back throughdt_sids, which includes the reserved slots), andvalue_to_otype_okeykeys an overlay string the same way viafind_dt_id. Ill-typed literals now read back with their text and datatype. A dt past the payload width still resolves toOType::RESERVED, as Increase custom datatype limit and make it explicit #1966 made it.troubleshooting/typed-values-wrong-after-indexing.md(affected data, symptoms, reindex including embedded hosts, what changes on upgrade) and a paragraph inconcepts/datatypes.mdon literals that are not values of their datatype.Behavior changes
DELETE DATA, as for query constants: a Turtle-stored ill-typed literal is removed through a bound variable."1990-00-00"^^xsd:datefrom Turtle is a distinct term from any valid date, stored under a customer o_type. Before, it was misread as a date.Tests
fluree-db-api/tests/it_typed_literal_index.rs(ingrp_index):sparql_typed_literals_read_back_on_every_lanebound_typed_literal_matches_values_from_both_surfacestyped_literal_deletes_across_surfacesDELETE DATA, SPARQL insert → JSON-LD deleteill_typed_literals_keep_their_lexical_formsparql_update_rejects_ill_typed_literalINSERT DATAandDELETE DATAcommits_holding_string_typed_literals_read_as_typed_valuescommits_holding_string_wkt_points_retract_through_sparqlDELETE DATAin novelty and after reindexEach fix was reverted on its own to confirm its test fails: the SPARQL coercion fails the reject, delete and bound-constant tests; the decode retag fails the legacy-commit test; the wkt retag fails the legacy-wkt test and its codec unit test; the registry guard fails the ill-typed test at
full rebuild; the overlay guard fails it atnovelty over an index. Unit tests cover the registry mapping,is_string_keyed, and the codec retag. On the merge withmain, #1966'sdt_past_payload_width_resolves_to_reservedpanicked until the registry guard keptRESERVED; it anddecode_value_from_kind_dt_past_payload_width_is_nullnow pass.Runs:
fluree-db-core,fluree-db-binary-index,fluree-db-indexer,fluree-db-transactlib tests;fluree-db-apigrp_indexand the geo tests ingrp_query; clippy on the touched crates.Also checked by hand against a ledger written and indexed by 4.2.1: the fixed binary misreads it until
fluree reindex, then every value is correct, the legacy date matches a bound constant, andDELETE DATAretracts it.Notes for review
LEX_IDarm keepsOType::RESERVEDfor a dt past the payload width instead of passing it tocustomer_datatype, which Increase custom datatype limit and make it explicit #1966 made a hard assert. The overlay'scustomer_datatypecall takes afind_dt_idposition, which Increase custom datatype limit and make it explicit #1966 bounds on every write path.xsd:intvalue written while an index build is running is indexed as a custom datatype: it reads back as a dictionary string, or fails to decode #1974 is the mirror image of this bug: a number under a datatype new to an incremental build gets a string-keyed customer o_type, because the incremental resolver's registry is built from the base root's datatypes. Not fixed here.xsd:long/xsd:floatconstants on the indexed lane. Onmainand 4.2.1, an indexed JSON-LD constant typed with a non-default numeric subtype matches nothing, even for JSON-LD-written data; SPARQL constants andxsd:integerwork. That is Numeric subtype leniency holds on novelty but not once indexed — the same constant-object query answers differently across an index publish #1737, fixed in fix(query): typed numeric constants match exactly, bare numbers match any numeric datatype #1990; whichever of the two PRs merges second should drop the skip.