diff --git a/Cargo.lock b/Cargo.lock index b62f682d9..78ea8286b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,6 +162,9 @@ name = "arbitrary" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "arc-swap" @@ -575,6 +578,16 @@ dependencies = [ "loom", ] +[[package]] +name = "asyncband" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94a214ba60d6231afd0e805e3c27c45a1626d9debaa5a5061c45a1ea1b2f1ed0" +dependencies = [ + "hashbrown 0.17.1", + "slab", +] + [[package]] name = "asynchronous-codec" version = "0.7.0" @@ -1246,6 +1259,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "base64-simd" version = "0.8.0" @@ -1798,7 +1817,7 @@ dependencies = [ "lance-graph-ogar", "lance-graph-planner", "libc", - "memmap2", + "memmap2 0.5.10", "ndarray 0.17.2", "notebook-query", "object_store", @@ -2212,12 +2231,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d200dcd5a37de108ec1329e0ba924e2badd2c0ef2343c338310135159ae454e2" [[package]] -name = "crc32c" -version = "0.6.8" +name = "crc-fast" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47" +checksum = "e75b2483e97a5a7da73ac68a05b629f9c53cff58d8ed1c77866079e18b00dba5" dependencies = [ - "rustc_version", + "digest 0.10.7", + "spin 0.10.1", ] [[package]] @@ -3276,8 +3296,8 @@ dependencies = [ "proc-macro2", "quote", "stringcase", - "strum 0.27.2", - "strum_macros 0.27.2", + "strum", + "strum_macros", "syn 2.0.117", "syn-match", "thiserror 2.0.18", @@ -3328,6 +3348,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "derive_more" version = "2.1.1" @@ -3800,6 +3831,12 @@ dependencies = [ "libm", ] +[[package]] +name = "frostem" +version = "1.20260821.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36a80a7406da302e04bfd2ca987907590d3a1f3c69958947c43890abd7426b2f" + [[package]] name = "fs2" version = "0.4.3" @@ -3837,9 +3874,9 @@ dependencies = [ [[package]] name = "fsst" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f1155128aba964cf6925c22a667ed763b52c8c653693c4b46f8a79d509a8c1" +checksum = "f727719438dfdb74f358a347c91ff81b6e7084a6421f34de3e473ce271f10caa" dependencies = [ "arrow-array", "rand 0.9.4", @@ -4238,14 +4275,23 @@ dependencies = [ [[package]] name = "goosefs-sdk" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae079b88ffe7772d12cfc5c40a5a324babb357893d95b5e3a22ae857f236c5f" +checksum = "e1ea4eee6dcbc31b25ab4fd577adc55b677d2bed3aa3016c44c58fbe1b2298a5" dependencies = [ + "arc-swap", "async-trait", "bytes", "dashmap 6.1.0", + "fastrand", + "futures", "hostname", + "io-uring", + "itoa", + "libc", + "lru", + "memmap2 0.9.11", + "moka", "prost", "prost-types", "rand 0.9.4", @@ -4258,6 +4304,7 @@ dependencies = [ "tonic-prost", "tracing", "uuid", + "xxhash-rust", ] [[package]] @@ -5382,7 +5429,7 @@ dependencies = [ "js-sys", "p256", "p384", - "pem", + "pem 3.0.6", "rand 0.8.6", "rsa", "serde", @@ -5446,9 +5493,9 @@ dependencies = [ [[package]] name = "lance" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d04bed056e254bc6e31264b031c8492507ca57939586f016924081dcf221a9" +checksum = "be781f40c7a75f9eae2188a2f71174acb7a360dca97163db40b041d0828dea48" dependencies = [ "arc-swap", "arrow", @@ -5464,7 +5511,6 @@ dependencies = [ "async-recursion", "async-trait", "async_cell", - "aws-credential-types", "byteorder", "bytes", "chrono", @@ -5479,7 +5525,6 @@ dependencies = [ "either", "fst", "futures", - "half", "humantime", "itertools 0.14.0", "lance-arrow", @@ -5521,9 +5566,9 @@ dependencies = [ [[package]] name = "lance-arrow" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e7b87c8183988c40a6bd30a6d8ec588b84e53f702b82f19859dc71ba6c02bc" +checksum = "fb97fd9875f3036d7c2561aa5b16eb87b80ccabaa4eeb5e6099b19cc662f1cd8" dependencies = [ "arrow-array", "arrow-buffer", @@ -5571,9 +5616,9 @@ dependencies = [ [[package]] name = "lance-bitpacking" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a4d84a3f36133c70bf89d306d813a29f8eb8555bba2b84995260867cfafdd5e" +checksum = "6f45658c5b2dc9aada41b66ee44b83af3fa888b7385ae414bae951b12a9f1cd3" dependencies = [ "arrayref", "crunchy", @@ -5583,21 +5628,20 @@ dependencies = [ [[package]] name = "lance-core" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238c8a58308e7718d6bd96b53494eb7953fa299778bc4911cc571c3576e9446d" +checksum = "27af3df3a7d08897efccd04461df31cedf0880c4b86a055ddce48e423d27f967" dependencies = [ "arrow-array", "arrow-buffer", "arrow-data", "arrow-schema", "async-trait", - "byteorder", + "blake3", "bytes", "datafusion-common", "datafusion-sql", "futures", - "itertools 0.14.0", "lance-arrow", "lance-derive", "libc", @@ -5608,13 +5652,13 @@ dependencies = [ "object_store", "pin-project", "prost", + "quick_cache", "rand 0.9.4", "roaring", "serde_json", "snafu 0.9.1", "tempfile", "tokio", - "tokio-stream", "tokio-util", "tracing", "twox-hash", @@ -5623,9 +5667,9 @@ dependencies = [ [[package]] name = "lance-datafusion" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f0ac4e1cf2f9b1b2fb5ee11bcd04af617bdd6f6cca13726a41c4212220193e" +checksum = "c377f837df5296e92f9fad724c83c1bef4e74d5af6e5a9312e9307e1dead8614" dependencies = [ "arrow", "arrow-array", @@ -5644,7 +5688,6 @@ dependencies = [ "jsonb", "lance-arrow", "lance-core", - "lance-datagen", "lance-geo", "log", "pin-project", @@ -5654,30 +5697,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "lance-datagen" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd65e7ea88ab28e5d3e91b58a56c02bfd44c47474caae5f8aed1322df1611476" -dependencies = [ - "arrow", - "arrow-array", - "arrow-cast", - "arrow-schema", - "chrono", - "futures", - "half", - "hex", - "rand 0.9.4", - "rand_distr", - "rand_xoshiro", -] - [[package]] name = "lance-derive" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf46656b359786f0b73f13936193583972b7af6e53ccb542da87830be18e94b2" +checksum = "13e5e95e0fd3d74f7938f4bee623041421b323b5c61f242c8622a1f48a202527" dependencies = [ "proc-macro2", "quote", @@ -5686,9 +5710,9 @@ dependencies = [ [[package]] name = "lance-encoding" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4725f14fe6cc1b2a5644786b4afa828d0c243064e208fa17378f839243d049c0" +checksum = "1625653c55c65f3426e281f6e29b54c603f38a40bd4cebd707bd4f3ea48be6c5" dependencies = [ "arrow-arith", "arrow-array", @@ -5713,8 +5737,6 @@ dependencies = [ "num-traits", "prost", "prost-build", - "rand 0.9.4", - "strum 0.26.3", "tokio", "tracing", "xxhash-rust", @@ -5723,13 +5745,14 @@ dependencies = [ [[package]] name = "lance-file" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c161b00eb5813f98f1d6d52e06f1b712f9eebb0a7f535a8dc1e1122ceca7307" +checksum = "b7e13c9266b478fc98f36ee19347c4658f7a6613fed77778b1a455fe1b88552e" dependencies = [ "arrow-arith", "arrow-array", "arrow-buffer", + "arrow-cast", "arrow-data", "arrow-schema", "arrow-select", @@ -5755,9 +5778,9 @@ dependencies = [ [[package]] name = "lance-geo" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97739c10f2c818ac4aa8a798a115e11c790c174d016c0836792aa3b8d0f981ab" +checksum = "2d5d35c3d7880f8c935e4579b1802c48d6ef27e2817013e8401596eac9e644cc" dependencies = [ "datafusion", "geo-traits", @@ -5788,10 +5811,12 @@ dependencies = [ "lance", "lance-graph-catalog", "lance-graph-contract", + "lance-graph-hydrate", "lance-linalg", "lance-namespace", "ndarray 0.17.2", "nom 7.1.3", + "object_store", "serde", "serde_json", "serde_yaml", @@ -5821,14 +5846,29 @@ dependencies = [ "serde_yaml", ] +[[package]] +name = "lance-graph-hydrate" +version = "0.1.0" +dependencies = [ + "futures", + "lance", + "libc", + "object_store", + "sha2 0.10.9", + "thiserror 1.0.69", + "tokio", + "zip", +] + [[package]] name = "lance-graph-ogar" version = "0.1.0" dependencies = [ "lance-graph-contract", "lance-graph-ontology", - "ogar-adapter-surrealql", "ogar-class-view", + "ogar-dismech", + "ogar-loco", "ogar-ontology", "ogar-vocab", ] @@ -5868,14 +5908,15 @@ dependencies = [ [[package]] name = "lance-index" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7980b0a6287fd46b9308a31e2cf284065d5693bfb43336297f0400172670ad" +checksum = "b0e0cb95f2c4f341c4dd04ac60f6a89ea26a6f75e09570225cbda4854c8b088e" dependencies = [ "arc-swap", "arrow", "arrow-arith", "arrow-array", + "arrow-ipc", "arrow-ord", "arrow-schema", "arrow-select", @@ -5884,7 +5925,6 @@ dependencies = [ "async-trait", "bitvec", "bytes", - "chrono", "crossbeam-queue", "datafusion", "datafusion-common", @@ -5904,7 +5944,6 @@ dependencies = [ "lance-bitpacking", "lance-core", "lance-datafusion", - "lance-datagen", "lance-encoding", "lance-file", "lance-geo", @@ -5934,14 +5973,13 @@ dependencies = [ "tempfile", "tokio", "tracing", - "uuid", ] [[package]] name = "lance-index-core" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a95f46ac3e4cdd710ca6929226cfb0dd343d5d2370ecb4b40e1c452043f7d27a" +checksum = "79ccd371977c1f7168da259d66ad37154f23146f093d46136bc7f79559f00f2c" dependencies = [ "arrow-array", "arrow-schema", @@ -5963,19 +6001,13 @@ dependencies = [ [[package]] name = "lance-io" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6deecd351ed6849184cc83000eabb87c8a5bfc519996f92451284498af7b42c" +checksum = "414d50997391b1ac83dc183c1612fdff88f58b959806078dc4c5e465154566de" dependencies = [ "arrow", - "arrow-arith", "arrow-array", - "arrow-buffer", - "arrow-cast", - "arrow-data", "arrow-schema", - "arrow-select", - "async-recursion", "async-trait", "aws-config", "aws-credential-types", @@ -5983,10 +6015,8 @@ dependencies = [ "bytes", "chrono", "futures", - "goosefs-sdk", "http 1.4.0", "io-uring", - "lance-arrow", "lance-core", "lance-namespace", "log", @@ -5998,36 +6028,39 @@ dependencies = [ "pin-project", "prost", "rand 0.9.4", + "reqsign-core", + "reqsign-file-read-tokio", + "reqsign-google", "serde", + "serde_json", "tempfile", "tokio", "tracing", "url", + "uuid", ] [[package]] name = "lance-linalg" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e5a9b99bd1f49bc2fe5afb81323141abc506c818f589de95dbab4f6143d9a88" +checksum = "6ff55b152ef23a56d7ba7e4d1b2c9cf0cc79aef6ee607c115597557ea4059f41" dependencies = [ "arrow-array", - "arrow-buffer", "arrow-schema", "cc", "half", "lance-arrow", "lance-core", "num-traits", - "rand 0.9.4", "rayon", ] [[package]] name = "lance-namespace" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8624fd33a894b5f2eb411cb56588d29138137ce100dee8e335843828e249b860" +checksum = "09991c13ab282b731e323619613914e08da9cc82b312f904e58c128b23f2f0e3" dependencies = [ "arrow", "async-trait", @@ -6039,9 +6072,9 @@ dependencies = [ [[package]] name = "lance-namespace-reqwest-client" -version = "0.8.6" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3f0a235e3ed5f8805205649ccc7d7d0f3df23ce1294242c9265ad488d7f19d" +checksum = "1d06b1fbb5d41f93bc652b61e2872af92e8a6c5f6b4ce8839a8ecfa05365d359" dependencies = [ "reqwest 0.12.28", "serde", @@ -6053,15 +6086,14 @@ dependencies = [ [[package]] name = "lance-select" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb5c718c141ea4f067203b11a54ccf57f8effbf963f345bc811f4837a660ad57" +checksum = "e8f676a2a1837cc85b77feb5326d3296827da964e40d67144f646563302a6ce9" dependencies = [ "arrow-array", "arrow-buffer", "arrow-schema", "byteorder", - "bytes", "itertools 0.14.0", "lance-core", "roaring", @@ -6070,9 +6102,9 @@ dependencies = [ [[package]] name = "lance-table" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc125611b4fe46f99f00b5262e71e17bd947a3bc3b81f3a4a604cc9ca290b3f" +checksum = "bd33054347395048b1d842dfb85a13f7801392c2da5f39425db62f00a481744b" dependencies = [ "arrow", "arrow-array", @@ -6080,6 +6112,7 @@ dependencies = [ "arrow-ipc", "arrow-schema", "async-trait", + "blake3", "byteorder", "bytes", "chrono", @@ -6109,12 +6142,12 @@ dependencies = [ [[package]] name = "lance-tokenizer" -version = "9.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73060a844ceda2405759b8f0f16a1c586b5b285dbdf7a3784350d048f991cfd3" +checksum = "3bfa6f0164c8b7056150f5682ce4d415a335b59b04c479873fda04b200117d27" dependencies = [ + "frostem", "icu_segmenter", - "rust-stemmers", "serde", "stop-words", "unicode-normalization", @@ -6135,7 +6168,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin", + "spin 0.9.8", ] [[package]] @@ -6304,9 +6337,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.29" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "loom" @@ -6321,6 +6354,15 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "lru" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff9840bcc50b71349309900da0ce7279aa336ae71d73250b07998932c7d97c25" +dependencies = [ + "hashbrown 0.17.1", +] + [[package]] name = "lru-slab" version = "0.1.2" @@ -6492,6 +6534,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + [[package]] name = "mime" version = "0.3.17" @@ -7007,9 +7058,9 @@ dependencies = [ [[package]] name = "object_store_opendal" -version = "0.57.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eb12a624a41fce745838d0ef3701ff6c47797c13cd18ad3612fd2a3134fdbd8" +checksum = "88f165780495c17aa3ce86846600504198c3fffd99073521552751c2430fa6ac" dependencies = [ "async-trait", "bytes", @@ -7023,17 +7074,32 @@ dependencies = [ ] [[package]] -name = "ogar-adapter-surrealql" +name = "ogar-class-view" version = "0.1.0" dependencies = [ + "lance-graph-contract", "ogar-vocab", ] [[package]] -name = "ogar-class-view" +name = "ogar-dismech" version = "0.1.0" +source = "git+https://github.com/AdaWorldAPI/OGAR?branch=main#03320b9fa9735d182b3c21dcf84836e49cc3e899" +dependencies = [ + "ogar-loco", + "ogar-obo", +] + +[[package]] +name = "ogar-loco" +version = "0.1.0" +source = "git+https://github.com/AdaWorldAPI/OGAR?branch=main#03320b9fa9735d182b3c21dcf84836e49cc3e899" + +[[package]] +name = "ogar-obo" +version = "0.1.0" +source = "git+https://github.com/AdaWorldAPI/OGAR?branch=main#03320b9fa9735d182b3c21dcf84836e49cc3e899" dependencies = [ - "lance-graph-contract", "ogar-vocab", ] @@ -7044,7 +7110,7 @@ version = "0.1.0" [[package]] name = "ogar-osm" version = "0.1.0" -source = "git+https://github.com/AdaWorldAPI/OGAR.git?branch=main#d9c7fc16472f3d5878dbc7bff7e442452033c64a" +source = "git+https://github.com/AdaWorldAPI/OGAR?branch=main#03320b9fa9735d182b3c21dcf84836e49cc3e899" dependencies = [ "ogar-vocab", ] @@ -7084,12 +7150,13 @@ dependencies = [ [[package]] name = "opendal" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c9c85ce253ff87225e7669979d877a20c98a06604ec9d6dd5f4473e08f1ae1" +checksum = "33dbff14cc9bb085224256d6a81289d2f3202e85b06f408d42534b42162a4231" dependencies = [ "ctor 1.0.12", "opendal-core", + "opendal-http-transport-reqwest", "opendal-layer-concurrent-limit", "opendal-layer-logging", "opendal-layer-retry", @@ -7107,24 +7174,22 @@ dependencies = [ [[package]] name = "opendal-core" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f8607c90e2c963a91467f50fb49fbc7fb3d573f88cea219ca59ccd3740b309" +checksum = "48dbcef97d3eb7591db2c18d5cae95c836bcce07359b98d98dd6f4e861eb77b7" dependencies = [ "anyhow", - "base64 0.22.1", + "asyncband", + "base64 0.23.1", "bytes", "futures", "http 1.4.0", - "http-body 1.0.1", "jiff", "log", "md-5 0.11.0", - "mea", "percent-encoding", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-core", - "reqwest 0.13.3", "serde", "serde_json", "tokio", @@ -7133,23 +7198,37 @@ dependencies = [ "web-time", ] +[[package]] +name = "opendal-http-transport-reqwest" +version = "0.58.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85663452ea32bbc17e8f79ab29788c846d116ec7de31451be9c787e462dcb36c" +dependencies = [ + "bytes", + "futures", + "http 1.4.0", + "http-body 1.0.1", + "opendal-core", + "reqwest 0.13.4", +] + [[package]] name = "opendal-layer-concurrent-limit" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6f81ba6960e3fae1882f253b114b21d7e444e1534f209c7737a79f6243eb6f" +checksum = "03f9e144b5228d741c3763ade8711d9b72e5fb6d998e779f2d7a09da0b5a3eba" dependencies = [ + "asyncband", "futures", "http 1.4.0", - "mea", "opendal-core", ] [[package]] name = "opendal-layer-logging" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ada45c6d81d1aa4c9305d0c7d4bc317c59c85866a0908a2d75a7a978aa5ee2" +checksum = "c2de17c61cd32e9d8d7d8efb91795e714dbccbafbc3c4e219e1542f4d6324161" dependencies = [ "log", "opendal-core", @@ -7157,9 +7236,9 @@ dependencies = [ [[package]] name = "opendal-layer-retry" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2a25a718afb81fad81cb9a0580a1cb989221fa2317f888c6a37f8dad408eb7" +checksum = "e94db301964a25366090484d61e6da16d5979cc8faf02c3e12210dc74fafed38" dependencies = [ "backon", "log", @@ -7168,9 +7247,9 @@ dependencies = [ [[package]] name = "opendal-layer-timeout" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91f731724c213af81e9d03517859c8fc47b4578e64ad61ae4f099f10fe36e3" +checksum = "08956ddda07465449bfd48825f4f0f25e0351278ac974eaa659895d9d74f2c80" dependencies = [ "opendal-core", "tokio", @@ -7178,17 +7257,17 @@ dependencies = [ [[package]] name = "opendal-service-azblob" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0030644366ef5d8cbe3a4a5822bf99a4aafddc1666e9d24b44d158d9062fc76a" +checksum = "6d278d2fb57661947d1c9fb44047e432b2782c48dc085b7abc99fe6e18c26cf8" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bytes", "http 1.4.0", "log", "opendal-core", "opendal-service-azure-common", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-azure-storage", "reqsign-core", "reqsign-file-read-tokio", @@ -7199,17 +7278,18 @@ dependencies = [ [[package]] name = "opendal-service-azdls" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dea4908d490143a9b0b7f7a790e139ff829b06a023f670455ed3d44f664b361" +checksum = "2d564484a8f7d091827e825cfc91ed45bd48e64d262451ee041fe843db81bd8a" dependencies = [ - "base64 0.22.1", + "asyncband", + "base64 0.23.1", "bytes", "http 1.4.0", "log", "opendal-core", "opendal-service-azure-common", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-azure-storage", "reqsign-core", "reqsign-file-read-tokio", @@ -7219,9 +7299,9 @@ dependencies = [ [[package]] name = "opendal-service-azure-common" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b489f13c42e69d69bdd72952b634356ec43a7881a20259b38b540fcecdf4051" +checksum = "cfcc1bfdac4f54d9018c462dd32ad9e2f68fdf584f825c811550c8ffc87894cd" dependencies = [ "http 1.4.0", "opendal-core", @@ -7229,15 +7309,15 @@ dependencies = [ [[package]] name = "opendal-service-cos" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8cafe9729213375c7331019b0cb756ad3e1aff7f45cd32c45eae91ebde8901" +checksum = "bb021c128ebde42e6f3e719d4cfed27e994017aa503a7a1e5818bdb61fd67dc9" dependencies = [ "bytes", "http 1.4.0", "log", "opendal-core", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-core", "reqsign-file-read-tokio", "reqsign-tencent-cos", @@ -7246,9 +7326,9 @@ dependencies = [ [[package]] name = "opendal-service-gcs" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48de101aac565ed06af4b47903c24eafd249075553ec1fb18256751c45148d47" +checksum = "da1f2a8c975fd22fea01f0409bcb8774f1ac02ad79863a3490098203121555d3" dependencies = [ "async-trait", "bytes", @@ -7256,7 +7336,7 @@ dependencies = [ "log", "opendal-core", "percent-encoding", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-core", "reqsign-file-read-tokio", "reqsign-google", @@ -7267,9 +7347,9 @@ dependencies = [ [[package]] name = "opendal-service-goosefs" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e43048bde419947ba826fbdc2f134d6c03f44ebf48bd33a03b72f9fc45fcb4" +checksum = "89fd71b80078f2983bd363e322fbebfa6a46d5fc56f17e4f23d76d5edb31226b" dependencies = [ "bytes", "goosefs-sdk", @@ -7281,9 +7361,9 @@ dependencies = [ [[package]] name = "opendal-service-hf" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4922661976a1d40794a2adfbdb888cc3c23097690f825a92f773af38908a848" +checksum = "c8a3c8ec0c2918fa23f258fa28822f222ec8c1e3a501ded665b78bc65a9d7734" dependencies = [ "bytes", "hf-xet", @@ -7291,22 +7371,21 @@ dependencies = [ "log", "opendal-core", "percent-encoding", - "reqwest 0.13.3", "serde", "serde_json", ] [[package]] name = "opendal-service-oss" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "328fa55e8888cbdfe00826bfea2a79042422b720e8369e9e021e46121dea5ace" +checksum = "8e3ce7a2ceb925e0f28f545b169eb57d04cec6116aae94b8584d2bdbe7d456c6" dependencies = [ "bytes", "http 1.4.0", "log", "opendal-core", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-aliyun-oss", "reqsign-core", "reqsign-file-read-tokio", @@ -7315,18 +7394,18 @@ dependencies = [ [[package]] name = "opendal-service-s3" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313d46c9f5ae70bca26b7c3e3fbb9b639292625f28af73aa016f47e788af9deb" +checksum = "c64335f9f24ccb62ac36f1d976342b48611a75ba61979813a4f78a4ebd94de42" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bytes", - "crc32c", + "crc-fast", "http 1.4.0", "log", "md-5 0.11.0", "opendal-core", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-aws-v4", "reqsign-core", "reqsign-file-read-tokio", @@ -7336,14 +7415,14 @@ dependencies = [ [[package]] name = "opendal-service-tos" -version = "0.57.0" +version = "0.58.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2f7a4c32e5202eb4ac72e76c4b5e30c86ab60762811172f4111103b9d673a1" +checksum = "70c3c507c3a565b2feb4c7b5f653436acd34ca59ffc842a7671b5498b13b76bf" dependencies = [ "bytes", "http 1.4.0", "opendal-core", - "quick-xml 0.39.3", + "quick-xml 0.41.0", "reqsign-core", "reqsign-file-read-tokio", "reqsign-volcengine-tos", @@ -7481,7 +7560,7 @@ checksum = "5d689d6e9f254bbd63893ce00a27147e41fe94bf3abca70f85b5345afb3cb728" dependencies = [ "byteorder", "flate2", - "memmap2", + "memmap2 0.5.10", "protobuf", "protobuf-codegen", "rayon", @@ -7749,6 +7828,16 @@ dependencies = [ "serde_core", ] +[[package]] +name = "pem" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d354a98a3d1251555de99e8fdd8afda05573c31b82f59063a7b0a29b5527f120" +dependencies = [ + "base64 0.23.1", + "serde_core", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -8617,7 +8706,7 @@ dependencies = [ "parking_lot", "quarto-util", "rand 0.9.4", - "reqwest 0.13.3", + "reqwest 0.13.4", "rsa", "samod", "serde", @@ -8834,7 +8923,7 @@ dependencies = [ "grass", "js-sys", "pollster", - "reqwest 0.13.3", + "reqwest 0.13.4", "serde", "serde_json", "tempfile", @@ -8971,14 +9060,26 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.40.1" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2474bd2e5029e7ccb6abb2ba48cf2383a333851dedf495901544281590c7da7f" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" dependencies = [ "memchr", "serde", ] +[[package]] +name = "quick_cache" +version = "0.6.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9c6658afe513a3b484e3abfdaa0d03ef3c0bbf017542c178dd55f94eb3051f9" +dependencies = [ + "ahash", + "equivalent", + "hashbrown 0.16.1", + "parking_lot", +] + [[package]] name = "quinn" version = "0.11.9" @@ -9157,15 +9258,6 @@ dependencies = [ "rand_core 0.9.5", ] -[[package]] -name = "rand_xoshiro" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" -dependencies = [ - "rand_core 0.9.5", -] - [[package]] name = "rangemap" version = "1.7.1" @@ -9313,9 +9405,9 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "reqsign-aliyun-oss" -version = "3.1.0" +version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372266b4733756738eeb199a98188037d27a0989980e2600ae7ce1faf00a867d" +checksum = "10909dbc9fcb78f913014d78a5c9d1d51c477f491b1006fd1baba4fd286181df" dependencies = [ "anyhow", "form_urlencoded", @@ -9329,19 +9421,18 @@ dependencies = [ ] [[package]] -name = "reqsign-aws-v4" -version = "3.0.1" +name = "reqsign-aws-core" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75624bd8a466e37ddc0a7b6c33ac859a85347c153a916e1dd9d0b68338f74a" +checksum = "bac4749b7dfa7bfaccd01eb03e9dc795ed37e3f20d6f0f38e2c67ee85ad6bc86" dependencies = [ - "anyhow", "bytes", "form_urlencoded", "hex", "http 1.4.0", "log", "percent-encoding", - "quick-xml 0.40.1", + "quick-xml 0.41.0", "reqsign-core", "rust-ini", "serde", @@ -9350,19 +9441,34 @@ dependencies = [ "sha1 0.11.0", ] +[[package]] +name = "reqsign-aws-v4" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff250f0fd0b913fbd565e405acc553da0f13bde30bfb5403178c9d0313cdc15f" +dependencies = [ + "bytes", + "http 1.4.0", + "log", + "quick-xml 0.41.0", + "reqsign-aws-core", + "reqsign-core", + "serde", +] + [[package]] name = "reqsign-azure-storage" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b96928e73ad984de1d99e382749d09e5dab7dd707b767974f7e40aa926b82f" +checksum = "c3f1fbc9add082f54e51e3bd9730f18d850a1f09d246baff5cd612c74ae4290e" dependencies = [ "anyhow", - "base64 0.22.1", + "base64 0.23.1", "bytes", "form_urlencoded", "http 1.4.0", "log", - "pem", + "pem 4.0.0", "percent-encoding", "reqsign-core", "rsa", @@ -9373,20 +9479,20 @@ dependencies = [ [[package]] name = "reqsign-core" -version = "3.0.1" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fa5cb48808693614d1701fcd3db0b30fa292e0f18e122ae068b6d32eaeed3f" +checksum = "ff052daffb0599681c50f85c59e7236438976efe991ab864edd9f3b235501a0f" dependencies = [ "anyhow", - "base64 0.22.1", + "base64 0.23.1", "bytes", - "form_urlencoded", "futures", "hex", "hmac 0.13.0", "http 1.4.0", "jiff", "log", + "mea", "percent-encoding", "rsa", "serde", @@ -9398,9 +9504,9 @@ dependencies = [ [[package]] name = "reqsign-file-read-tokio" -version = "3.0.1" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a4b6f3a3fd29ffcc99a90aec585a65217783badfd73acddf847b63ae683bda9" +checksum = "b3235df90a6bca681aa47dd86f2393d122a6d77042aa8a7c81e218cd45c5bfc0" dependencies = [ "anyhow", "reqsign-core", @@ -9409,10 +9515,11 @@ dependencies = [ [[package]] name = "reqsign-google" -version = "3.0.1" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb215d0876a18b6bd9cdd380b589e5292aaa638ca15266de794b1122d898b6b2" +checksum = "272a5813571885c1455ffe106f0c768577e6ce69313446d4476e8d41dcf6ac5a" dependencies = [ + "bytes", "form_urlencoded", "http 1.4.0", "log", @@ -9427,9 +9534,9 @@ dependencies = [ [[package]] name = "reqsign-tencent-cos" -version = "3.0.1" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84110aabba799fbcd48b3abb51fbbff4749f879252e5806b6f5d0cbe0fef6abb" +checksum = "ce37101efdda1e52f08d98a4fbb5e9fbcfff92dd74911b51ec7779e9d2279fef" dependencies = [ "anyhow", "http 1.4.0", @@ -9442,9 +9549,9 @@ dependencies = [ [[package]] name = "reqsign-volcengine-tos" -version = "3.0.1" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d083a363b3577f519ce8425bb50f902622a28a83f7c4a26a5c990b66ec75b3" +checksum = "7a7e7a3a0635e0aa9ef851577c63cba5b3c98fb584f6a6637c2fd5cc50702c99" dependencies = [ "anyhow", "http 1.4.0", @@ -9505,9 +9612,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0" +checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" dependencies = [ "base64 0.22.1", "bytes", @@ -9553,7 +9660,7 @@ dependencies = [ "anyhow", "async-trait", "http 1.4.0", - "reqwest 0.13.3", + "reqwest 0.13.4", "thiserror 2.0.18", "tower-service", ] @@ -9714,16 +9821,6 @@ dependencies = [ "ordered-multimap", ] -[[package]] -name = "rust-stemmers" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" -dependencies = [ - "serde", - "serde_derive", -] - [[package]] name = "rustc-hash" version = "2.1.2" @@ -10635,6 +10732,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spin" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "023a211cb3138dbc438680b32560ad89f699977624c9f8dbb95a47d5b4c07dd3" + [[package]] name = "spki" version = "0.7.3" @@ -10760,35 +10863,13 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros 0.26.4", -] - [[package]] name = "strum" version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" dependencies = [ - "strum_macros 0.27.2", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.117", + "strum_macros", ] [[package]] @@ -13197,7 +13278,7 @@ dependencies = [ "more-asserts", "rand 0.10.1", "redb", - "reqwest 0.13.3", + "reqwest 0.13.4", "reqwest-middleware", "serde", "serde_json", @@ -13310,7 +13391,7 @@ dependencies = [ "oneshot", "pin-project", "rand 0.10.1", - "reqwest 0.13.3", + "reqwest 0.13.4", "serde", "serde_json", "shellexpand", @@ -13500,6 +13581,23 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "zip" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap 2.14.0", + "memchr", + "thiserror 2.0.18", + "zopfli", +] + [[package]] name = "zlib-rs" version = "0.6.3" @@ -13525,6 +13623,18 @@ dependencies = [ "serde", ] +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + [[package]] name = "zstd" version = "0.13.3" @@ -13552,3 +13662,7 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "ogar-adapter-surrealql" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index ad2253674..c77e415fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -343,7 +343,10 @@ explicit_into_iter_loop = "warn" filter_map_next = "warn" flat_map_option = "warn" float_cmp_const = "warn" -from_iter_instead_of_collect = "warn" +# from_iter_instead_of_collect — REMOVED in Rust 1.98 ("lint has proved +# problematic"). Requesting it makes every clippy run emit a +# `renamed_and_removed_lints` warning, which notably ignores `-D warnings`, +# so it degraded the signal without ever failing the gate. get_unwrap = "warn" implicit_clone = "warn" implicit_hasher = "warn" diff --git a/crates/cockpit-server/Cargo.toml b/crates/cockpit-server/Cargo.toml index d61a0c97b..670549f85 100644 --- a/crates/cockpit-server/Cargo.toml +++ b/crates/cockpit-server/Cargo.toml @@ -96,7 +96,7 @@ arc-swap = "1.9" # `lance-graph` -> `lance` -> `arrow` — declaring them directly here changes # no resolved version, it just makes the capability this crate USES a thing # this crate ASKS FOR. Same move lance-graph PR #931 made for `object_store`. -lance = "=9.0.0" +lance = "=11.0.0" arrow = { version = "58", features = ["prettyprint"] } diff --git a/crates/cockpit-server/src/body_lod.rs b/crates/cockpit-server/src/body_lod.rs index 282058719..d23099d1e 100644 --- a/crates/cockpit-server/src/body_lod.rs +++ b/crates/cockpit-server/src/body_lod.rs @@ -15,7 +15,7 @@ use std::sync::LazyLock; use axum::Json; -use ndarray::hpc::splat3d::depth_cascade::{cascade_blocks, BlockBounds, DepthCascadeBudget}; +use ndarray::hpc::splat3d::depth_cascade::{BlockBounds, DepthCascadeBudget, cascade_blocks}; use ndarray::hpc::splat3d::project::Camera; use serde::{Deserialize, Serialize}; @@ -25,10 +25,15 @@ static BODY_BLOCKS: &[u8] = static BLOCKS: LazyLock> = LazyLock::new(|| { BODY_BLOCKS - .chunks_exact(16) + .as_chunks::<16>() + .0 + .iter() .map(|c| { let f = |k: usize| f32::from_le_bytes(c[k * 4..k * 4 + 4].try_into().unwrap()); - BlockBounds { center: [f(0), f(1), f(2)], radius: f(3).max(1e-4) } + BlockBounds { + center: [f(0), f(1), f(2)], + radius: f(3).max(1e-4), + } }) .collect() }); @@ -87,5 +92,9 @@ pub async fn body_lod_handler(Json(cam): Json) -> Json { tally[a] += 1; } } - Json(LodResponse { actions, n_concepts: BLOCKS.len(), tally }) + Json(LodResponse { + actions, + n_concepts: BLOCKS.len(), + tally, + }) } diff --git a/crates/cockpit-server/src/codebook.rs b/crates/cockpit-server/src/codebook.rs index a4fc576c4..5bab8f929 100644 --- a/crates/cockpit-server/src/codebook.rs +++ b/crates/cockpit-server/src/codebook.rs @@ -9,8 +9,8 @@ //! `lance_graph::thinking_engine::engine::CODEBOOK_SIZE` (currently 4096). //! If the upstream value changes, update this constant in lockstep. -use std::collections::hash_map::DefaultHasher; use std::collections::HashSet; +use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; /// Codebook width. Mirrors `thinking_engine::engine::CODEBOOK_SIZE`. @@ -37,10 +37,9 @@ pub fn default_distance_table() -> Vec { /// Cypher keywords excluded from identifier extraction. const CYPHER_KEYWORDS: &[&str] = &[ - "MATCH", "RETURN", "WHERE", "CREATE", "MERGE", "SET", "DELETE", "AS", - "AND", "OR", "NOT", "NULL", "TRUE", "FALSE", "OPTIONAL", "WITH", - "UNWIND", "ORDER", "BY", "ASC", "DESC", "LIMIT", "SKIP", "COUNT", - "COLLECT", "DISTINCT", + "MATCH", "RETURN", "WHERE", "CREATE", "MERGE", "SET", "DELETE", "AS", "AND", "OR", "NOT", + "NULL", "TRUE", "FALSE", "OPTIONAL", "WITH", "UNWIND", "ORDER", "BY", "ASC", "DESC", "LIMIT", + "SKIP", "COUNT", "COLLECT", "DISTINCT", ]; /// Maximum identifiers returned by [`extract_cypher_identifiers`] per call. diff --git a/crates/cockpit-server/src/dto_bridge.rs b/crates/cockpit-server/src/dto_bridge.rs index 104d7d514..6ad90f30b 100644 --- a/crates/cockpit-server/src/dto_bridge.rs +++ b/crates/cockpit-server/src/dto_bridge.rs @@ -410,7 +410,10 @@ mod tests { assert_eq!(style_selector_str(StyleSelector::Auto), "auto"); assert_eq!(style_selector_str(StyleSelector::Ordinal(7)), "explicit"); - assert_eq!(style_selector_str(StyleSelector::Named("focus")), "explicit"); + assert_eq!( + style_selector_str(StyleSelector::Named("focus")), + "explicit" + ); } #[test] @@ -431,6 +434,10 @@ mod tests { assert!(!j.contains("color_acc\":["), "color_acc array leaked: {j}"); assert!(j.contains("\"color_acc_active_dims\":3")); // Footprint sanity: small struct must serialize tiny. - assert!(j.len() < 256, "alpha composite frame too large: {} B", j.len()); + assert!( + j.len() < 256, + "alpha composite frame too large: {} B", + j.len() + ); } } diff --git a/crates/cockpit-server/src/graph_engine.rs b/crates/cockpit-server/src/graph_engine.rs index 187d0efb4..811fc6e8b 100644 --- a/crates/cockpit-server/src/graph_engine.rs +++ b/crates/cockpit-server/src/graph_engine.rs @@ -25,8 +25,8 @@ //! Wire JSON keeps the historical field names `truth_f` / `truth_c` so //! the cockpit React frontend keeps working unchanged. -use std::sync::{Arc, OnceLock}; use std::collections::HashMap; +use std::sync::{Arc, OnceLock}; use serde::Serialize; use tokio::sync::RwLock; @@ -107,9 +107,13 @@ pub struct GraphEdge { impl GraphEdge { /// Convenience: legacy `truth_f` accessor for in-process consumers. - pub fn truth_f(&self) -> f32 { self.truth.frequency } + pub fn truth_f(&self) -> f32 { + self.truth.frequency + } /// Convenience: legacy `truth_c` accessor for in-process consumers. - pub fn truth_c(&self) -> f32 { self.truth.confidence } + pub fn truth_c(&self) -> f32 { + self.truth.confidence + } } impl Serialize for GraphEdge { @@ -244,7 +248,11 @@ pub async fn hydrate_from_aiwar_json(path: &str) -> Result<(), String> { let mut state = graph.write().await; *state = snapshot; - tracing::info!("hydrated live graph: {} nodes, {} edges", node_count, edge_count); + tracing::info!( + "hydrated live graph: {} nodes, {} edges", + node_count, + edge_count + ); Ok(()) } @@ -270,7 +278,9 @@ pub async fn run_nars_deduction(min_confidence: f32, max_hops: usize) -> Vec = state.edges.iter() + let existing: std::collections::HashSet<(&str, &str)> = state + .edges + .iter() .map(|e| (e.source.as_str(), e.target.as_str())) .collect(); @@ -280,11 +290,17 @@ pub async fn run_nars_deduction(min_confidence: f32, max_hops: usize) -> Vec= 2 { for (a, a_edges) in &adj { for &(b, _ab_label, ab_truth) in a_edges { - if ab_truth.confidence < min_confidence { continue; } + if ab_truth.confidence < min_confidence { + continue; + } if let Some(b_edges) = adj.get(b) { for &(c_node, bc_label, bc_truth) in b_edges { - if bc_truth.confidence < min_confidence { continue; } - if *a == c_node || existing.contains(&(a, c_node)) { continue; } + if bc_truth.confidence < min_confidence { + continue; + } + if *a == c_node || existing.contains(&(a, c_node)) { + continue; + } // NARS deduction via canonical planner TruthValue::deduction. let inferred = nars_deduction(&ab_truth, &bc_truth); @@ -322,9 +338,15 @@ pub async fn graph_snapshot_handler() -> axum::Json { pub async fn nars_infer_handler( axum::Json(params): axum::Json, ) -> axum::Json { - let min_conf = params.get("min_confidence").and_then(|v| v.as_f64()).unwrap_or(0.4) as f32; + let min_conf = params + .get("min_confidence") + .and_then(|v| v.as_f64()) + .unwrap_or(0.4) as f32; let max_hops = params.get("max_hops").and_then(|v| v.as_u64()).unwrap_or(2) as usize; - let node_id = params.get("node_id").and_then(|v| v.as_str()).map(|s| s.to_string()); + let node_id = params + .get("node_id") + .and_then(|v| v.as_str()) + .map(|s| s.to_string()); let mut inferences = run_nars_deduction(min_conf, max_hops).await; @@ -364,7 +386,15 @@ mod nars_planner_bridge_tests { let bc = NarsTruth::new(0.7, 0.6); let result = nars_deduction(&ab, &bc); // Canonical NARS: f = f1*f2 = 0.63, c = f1*f2*c1*c2 = 0.3024 - assert!((result.frequency - 0.63).abs() < 0.01, "f={}", result.frequency); - assert!((result.confidence - 0.3024).abs() < 0.01, "c={}", result.confidence); + assert!( + (result.frequency - 0.63).abs() < 0.01, + "f={}", + result.frequency + ); + assert!( + (result.confidence - 0.3024).abs() < 0.01, + "c={}", + result.confidence + ); } } diff --git a/crates/cockpit-server/src/main.rs b/crates/cockpit-server/src/main.rs index 3a50e1f21..37b3cac10 100644 --- a/crates/cockpit-server/src/main.rs +++ b/crates/cockpit-server/src/main.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use std::time::Duration; use axum::extract::State; -use axum::http::{header, StatusCode}; +use axum::http::{StatusCode, header}; use axum::response::sse::{Event, Sse}; use axum::response::{Html, IntoResponse, Response}; use axum::routing::{get, post}; @@ -27,20 +27,15 @@ use serde::{Deserialize, Serialize}; use tokio::sync::broadcast; use tower_http::cors::CorsLayer; -mod openai; mod body_lod; -mod graph_engine; mod clinical; -mod pgx; -mod osint_gotham; -mod scene_player; -mod shader_stream; -mod style_state; -mod dto_bridge; mod codebook; +mod dto_bridge; +mod graph_engine; mod mock_driver; +mod openai; mod osint_classview; -mod osm_tiles; +mod osint_gotham; mod osm; mod osm_artifact_manager; mod osm_chains_books_lance; @@ -49,6 +44,11 @@ mod osm_lance; mod osm_lifecycle; mod osm_region_catalogue; mod osm_slab_hydrate; +mod osm_tiles; +mod pgx; +mod scene_player; +mod shader_stream; +mod style_state; // ── Embed the Vite build at compile time ───────────────────────────────────── // The cockpit/ directory is built by `cd cockpit && npm run build` which @@ -56,14 +56,16 @@ mod osm_slab_hydrate; // If dist/ doesn't exist at compile time, we fall back to the inline HTML shell. #[cfg(feature = "embed-cockpit")] -use include_dir::{include_dir, Dir}; +use include_dir::{Dir, include_dir}; #[cfg(feature = "embed-cockpit")] static COCKPIT_DIST: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../../cockpit/dist"); /// Committed fallback OSINT SoA (used only if the harvest graph isn't on disk). -static OSINT_SOA_FALLBACK: &[u8] = - include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/osint_scene.soa")); +static OSINT_SOA_FALLBACK: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/assets/osint_scene.soa" +)); /// OSINT SoA wire buffer, **baked at startup from the on-disk enriched harvest** /// (`osint_gotham::osint_soa_bytes`) so the served 3D scene reflects the CURRENT @@ -75,7 +77,10 @@ static OSINT_SOA: std::sync::LazyLock> = std::sync::LazyLock::new(|| { let candidates = [ // Anchored on the crate dir (baked at build) so it resolves regardless // of the runtime cwd Railway launches from. - concat!(env!("CARGO_MANIFEST_DIR"), "/../../cockpit/public/aiwar_graph.json"), + concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../cockpit/public/aiwar_graph.json" + ), "cockpit/public/aiwar_graph.json", "/home/user/aiwar-neo4j-harvest/data/aiwar_graph.json", "../aiwar-neo4j-harvest/data/aiwar_graph.json", @@ -302,8 +307,14 @@ async fn main() { let scene_state_for_routes = state.scene_state.clone(); let main_routes: Router> = Router::new() // Shader stream — DTO pipeline SSE (Φ StreamDto → Ψ ResonanceDto → B BusDto → Γ ThoughtStruct) - .route("/v1/shader/stream", get(shader_stream::shader_stream_handler).with_state(scene_state_for_routes.clone())) - .route("/v1/shader/status", get(shader_stream::shader_status_handler).with_state(scene_state_for_routes)) + .route( + "/v1/shader/stream", + get(shader_stream::shader_stream_handler).with_state(scene_state_for_routes.clone()), + ) + .route( + "/v1/shader/status", + get(shader_stream::shader_status_handler).with_state(scene_state_for_routes), + ) // Shader style selection — POST { "style": "Focused" } sets the // process-global StyleSelector that shader_stream reads when // building each ShaderDispatch (overrides default Auto). @@ -329,11 +340,17 @@ async fn main() { .route("/api/analyst/analyze/:bucket", get(analyst_analyze_handler)) .route("/api/analyst/full", get(analyst_full_handler)) // Live graph engine — neo4j-emulating renderer with AGI thinking - .route("/api/graph/snapshot", get(graph_engine::graph_snapshot_handler)) + .route( + "/api/graph/snapshot", + get(graph_engine::graph_snapshot_handler), + ) .route("/api/graph/infer", post(graph_engine::nars_infer_handler)) .route("/api/graph/health", get(graph_engine::graph_health_handler)) // Clinical NARS reasoning for the /fma-body organ panel (real TruthValue::deduction) - .route("/api/clinical/reason", post(clinical::clinical_reason_handler)) + .route( + "/api/clinical/reason", + post(clinical::clinical_reason_handler), + ) // CPIC pharmacogenomics for the /cpic cockpit (cpic::reason over the baked CPIC tables) .route("/api/cpic/reason", post(pgx::cpic_reason_handler)) .route("/api/cpic/catalog", get(pgx::cpic_catalog_handler)) @@ -347,7 +364,10 @@ async fn main() { // The canonical OSINT card (classid 0x0700) projected through a FieldMask — // the Redmine-style ViewFilter, server-side (`?mask=`, omitted = FULL). .route("/api/osint/card", get(osint_classview::osint_card_handler)) - .route("/api/osint/card.html", get(osint_classview::osint_card_html_handler)) + .route( + "/api/osint/card.html", + get(osint_classview::osint_card_html_handler), + ) // The generic, OSINT-agnostic sibling: any well-formed 16-byte node // key renders through the SAME ClassView fieldmask core as the OSINT // route above (`resolve_card` + `render_card_response` in @@ -373,10 +393,22 @@ async fn main() { // serving path /api/osm/health reports on. .route("/api/osm/status", get(osm_status_handler)) .route("/api/osm/locate", get(osm_tiles::osm_locate_handler)) - .route("/api/osm/tile/:z/:x/:y", get(osm_tiles::osm_tile_meta_handler)) - .route("/api/osm/features/:z/:x/:y", get(osm_features::osm_features_handler)) - .route("/api/osm/feature/:idx", get(osm_features::osm_feature_handler)) - .route("/api/osm/geometry/:idx", get(osm_features::osm_geometry_handler)) + .route( + "/api/osm/tile/:z/:x/:y", + get(osm_tiles::osm_tile_meta_handler), + ) + .route( + "/api/osm/features/:z/:x/:y", + get(osm_features::osm_features_handler), + ) + .route( + "/api/osm/feature/:idx", + get(osm_features::osm_feature_handler), + ) + .route( + "/api/osm/geometry/:idx", + get(osm_features::osm_geometry_handler), + ) // The basemap itself, drawn from the bake. Registered AFTER the :idx // form; axum matches the literal `tile` segment ahead of the param, so // `/geometry/tile/12/2200/1341` cannot be swallowed as an index. @@ -403,7 +435,10 @@ async fn main() { .route("/api/garmin-drape/:location", get(garmin_drape_handler)) // The DRP1 contour-line overlay (topo lines) for a garmin terrain scene, // resolved through the manifest's `garmin_contours` map; 404 = no contours. - .route("/api/garmin-contours/:location", get(garmin_contour_handler)) + .route( + "/api/garmin-contours/:location", + get(garmin_contour_handler), + ) // Health .route("/health", get(health_handler)); @@ -426,7 +461,9 @@ async fn main() { tracing::info!(" /demo → infrastructure demo (24 seed nodes)"); tracing::info!(" /debug → neural debugger (18,763 functions)"); tracing::info!(" /api/debug/osint → live OSINT pipeline audit (AriGraph + NARS + xAI)"); - tracing::info!(" /mri → AGI Brain MRI (pre-rendered, 500ms refresh, LazyLock double-buffer)"); + tracing::info!( + " /mri → AGI Brain MRI (pre-rendered, 500ms refresh, LazyLock double-buffer)" + ); tracing::info!(" /mcp/* → MCP endpoints (lance-graph)"); tracing::info!(" /v1/* → OpenAI-compatible API (gpt2, openchat_3.5, stable-diffusion)"); @@ -445,13 +482,17 @@ async fn main() { }); if let Some(path) = aiwar_path { match graph_engine::hydrate_from_aiwar_json(&path).await { - Ok(()) => tracing::info!(" /api/graph/* → live graph engine (lance-graph, NARS-enabled): {path}"), + Ok(()) => tracing::info!( + " /api/graph/* → live graph engine (lance-graph, NARS-enabled): {path}" + ), Err(e) => tracing::warn!(" /api/graph/* → fallback mode (hydration failed: {e})"), } // OSINT domain (classid 0x0700): same harvest as a CANON family-basin // graph (round→anchor basins), displayed through the OGAR ClassView. match osint_gotham::hydrate_osint_gotham(&path).await { - Ok(()) => tracing::info!(" /api/graph/osint → OSINT/Gotham family-basin view (classid 0x0700, OGAR ClassView)"), + Ok(()) => tracing::info!( + " /api/graph/osint → OSINT/Gotham family-basin view (classid 0x0700, OGAR ClassView)" + ), Err(e) => tracing::warn!(" /api/graph/osint → fallback (OSINT hydration failed: {e})"), } } else { @@ -517,10 +558,8 @@ fn garmin_scene_slugs(manifest_json: &str) -> Vec { serde_json::from_str::(manifest_json) .ok() .and_then(|v| { - v.get("garmin_scenes").and_then(|m| { - m.as_object() - .map(|o| o.keys().cloned().collect::>()) - }) + v.get("garmin_scenes") + .and_then(|m| m.as_object().map(|o| o.keys().cloned().collect::>())) }) .unwrap_or_default() } @@ -529,14 +568,20 @@ fn garmin_scene_slugs(manifest_json: &str) -> Vec { /// The gz bytes are served raw (application/gzip, no Content-Encoding): /// BodyHelix inflates client-side via DecompressionStream, same contract as /// the same-origin body/berlin/iceland wires. -async fn garmin_scene_handler(axum::extract::Path(location): axum::extract::Path) -> Response { +async fn garmin_scene_handler( + axum::extract::Path(location): axum::extract::Path, +) -> Response { #[cfg(feature = "embed-cockpit")] { let Some(man) = COCKPIT_DIST .get_file("body.manifest.json") .and_then(|f| std::str::from_utf8(f.contents()).ok()) else { - return (StatusCode::INTERNAL_SERVER_ERROR, "manifest missing from embedded dist").into_response(); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + "manifest missing from embedded dist", + ) + .into_response(); }; if let Some(fname) = resolve_garmin_scene(man, &location) { if let Some(file) = COCKPIT_DIST.get_file(&fname) { @@ -579,14 +624,20 @@ async fn garmin_scene_handler(axum::extract::Path(location): axum::extract::Path /// (the roads / trails / rivers that drape onto its terrain). A scene with no /// registered drape returns 404 quietly; the client treats that as "no overlay" /// and renders the bare terrain (graceful — the drape is purely additive). -async fn garmin_drape_handler(axum::extract::Path(location): axum::extract::Path) -> Response { +async fn garmin_drape_handler( + axum::extract::Path(location): axum::extract::Path, +) -> Response { #[cfg(feature = "embed-cockpit")] { let Some(man) = COCKPIT_DIST .get_file("body.manifest.json") .and_then(|f| std::str::from_utf8(f.contents()).ok()) else { - return (StatusCode::INTERNAL_SERVER_ERROR, "manifest missing from embedded dist").into_response(); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + "manifest missing from embedded dist", + ) + .into_response(); }; if let Some(fname) = resolve_garmin_drape(man, &location) { if let Some(file) = COCKPIT_DIST.get_file(&fname) { @@ -603,7 +654,11 @@ async fn garmin_drape_handler(axum::extract::Path(location): axum::extract::Path #[cfg(not(feature = "embed-cockpit"))] { let _ = location; - (StatusCode::SERVICE_UNAVAILABLE, "garmin drape needs the embed-cockpit build").into_response() + ( + StatusCode::SERVICE_UNAVAILABLE, + "garmin drape needs the embed-cockpit build", + ) + .into_response() } } @@ -611,14 +666,20 @@ async fn garmin_drape_handler(axum::extract::Path(location): axum::extract::Path /// `location` (the topo lines that drape onto its terrain). A scene with no /// registered contours returns 404 quietly; the client treats that as "no /// overlay" and renders without contours (graceful — contours are additive). -async fn garmin_contour_handler(axum::extract::Path(location): axum::extract::Path) -> Response { +async fn garmin_contour_handler( + axum::extract::Path(location): axum::extract::Path, +) -> Response { #[cfg(feature = "embed-cockpit")] { let Some(man) = COCKPIT_DIST .get_file("body.manifest.json") .and_then(|f| std::str::from_utf8(f.contents()).ok()) else { - return (StatusCode::INTERNAL_SERVER_ERROR, "manifest missing from embedded dist").into_response(); + return ( + StatusCode::INTERNAL_SERVER_ERROR, + "manifest missing from embedded dist", + ) + .into_response(); }; if let Some(fname) = resolve_garmin_contours(man, &location) { if let Some(file) = COCKPIT_DIST.get_file(&fname) { @@ -635,7 +696,11 @@ async fn garmin_contour_handler(axum::extract::Path(location): axum::extract::Pa #[cfg(not(feature = "embed-cockpit"))] { let _ = location; - (StatusCode::SERVICE_UNAVAILABLE, "garmin contours need the embed-cockpit build").into_response() + ( + StatusCode::SERVICE_UNAVAILABLE, + "garmin contours need the embed-cockpit build", + ) + .into_response() } } @@ -682,16 +747,27 @@ async fn static_handler(uri: axum::http::Uri) -> Response { } fn mime_from_path(path: &str) -> &'static str { - if path.ends_with(".html") { "text/html; charset=utf-8" } - else if path.ends_with(".css") { "text/css; charset=utf-8" } - else if path.ends_with(".js") { "application/javascript; charset=utf-8" } - else if path.ends_with(".json") { "application/json" } - else if path.ends_with(".svg") { "image/svg+xml" } - else if path.ends_with(".png") { "image/png" } - else if path.ends_with(".ico") { "image/x-icon" } - else if path.ends_with(".woff2") { "font/woff2" } - else if path.ends_with(".woff") { "font/woff" } - else { "application/octet-stream" } + if path.ends_with(".html") { + "text/html; charset=utf-8" + } else if path.ends_with(".css") { + "text/css; charset=utf-8" + } else if path.ends_with(".js") { + "application/javascript; charset=utf-8" + } else if path.ends_with(".json") { + "application/json" + } else if path.ends_with(".svg") { + "image/svg+xml" + } else if path.ends_with(".png") { + "image/png" + } else if path.ends_with(".ico") { + "image/x-icon" + } else if path.ends_with(".woff2") { + "font/woff2" + } else if path.ends_with(".woff") { + "font/woff" + } else { + "application/octet-stream" + } } /// Minimal fallback shell when the Vite build isn't embedded. @@ -820,15 +896,15 @@ async fn mcp_message_handler( jsonrpc: "2.0".into(), id: req.id, result: None, - error: Some(McpError { code: -32000, message: msg }), + error: Some(McpError { + code: -32000, + message: msg, + }), }), } } -async fn handle_tool_call( - state: &AppState, - req: &McpRequest, -) -> Result { +async fn handle_tool_call(state: &AppState, req: &McpRequest) -> Result { let params = req.params.as_ref().ok_or("Missing params")?; let tool_name = params.name.as_deref().ok_or("Missing tool name")?; let args = params.arguments.as_ref().cloned().unwrap_or_default(); @@ -856,12 +932,11 @@ async fn handle_tool_call( // async worker (keeps the request executor free and never blocks a // Tokio worker for the whole DataFusion query). let code_owned = code.to_string(); - let result = tokio::task::spawn_blocking(move || { - notebook_query::execute(&code_owned, language) - }) - .await - .map_err(|e| format!("query task panicked: {e}"))? - .map_err(|e| format!("lance-graph: {e}"))?; + let result = + tokio::task::spawn_blocking(move || notebook_query::execute(&code_owned, language)) + .await + .map_err(|e| format!("query task panicked: {e}"))? + .map_err(|e| format!("lance-graph: {e}"))?; let cell = serde_json::json!({ "id": format!("cell-{}", std::time::SystemTime::now() @@ -939,10 +1014,8 @@ async fn style_handler( /// Also runs demo analyses: same query through all 12 thinking styles. async fn strategy_check_handler() -> Json { // Run in a blocking thread since strategy checks may be CPU-intensive - let result = tokio::task::spawn_blocking(|| { - notebook_query::diagnostics::run_strategy_checks() - }) - .await; + let result = + tokio::task::spawn_blocking(|| notebook_query::diagnostics::run_strategy_checks()).await; match result { Ok(matrix) => Json(serde_json::to_value(matrix).unwrap_or_default()), @@ -965,12 +1038,12 @@ async fn osint_audit_handler() -> Json { // In production these come from the live graph state. // For now, report pipeline registry stats + env status. notebook_query::osint_audit::run_osint_audit( - 0, // graph_triplet_count — wire to live graph - 0, // graph_active_count - 0, // graph_entity_count - 0, // graph_spatial_edges - 0, // graph_contradictions - 0, // episodic_count + 0, // graph_triplet_count — wire to live graph + 0, // graph_active_count + 0, // graph_entity_count + 0, // graph_spatial_edges + 0, // graph_contradictions + 0, // episodic_count 100, // episodic_capacity ) }) @@ -1025,7 +1098,11 @@ impl Default for MriFrame { "timestamp_ms": 0, }); let html = render_mri_html(&empty_json); - Self { html, json: empty_json, rendered_at_ms: 0 } + Self { + html, + json: empty_json, + rendered_at_ms: 0, + } } } @@ -1169,7 +1246,9 @@ pub fn spawn_mri_prerender() { let entity_stats = std::collections::HashMap::new(); let thinking_activations = Vec::new(); let mri = notebook_query::mri::run_brain_mri( - &edges, &entity_stats, &thinking_activations, + &edges, + &entity_stats, + &thinking_activations, notebook_query::mri::ScanMode::Full, ); serde_json::to_value(mri).unwrap_or_default() @@ -1240,8 +1319,9 @@ async fn mri_scan_mode_handler( // ── Meta-Orchestrator — Thinking About Thinking ───────────────────────────── /// Global orchestrator instance. Persists across requests. -static ORCHESTRATOR: std::sync::OnceLock> = - std::sync::OnceLock::new(); +static ORCHESTRATOR: std::sync::OnceLock< + std::sync::Mutex, +> = std::sync::OnceLock::new(); fn get_orchestrator() -> &'static std::sync::Mutex { ORCHESTRATOR.get_or_init(|| { @@ -1293,12 +1373,14 @@ async fn analyst_buckets_handler() -> Json { // We surface 0 here rather than running every analysis just to count. let buckets: Vec = notebook_query::analyst::AnalysisBucket::all() .iter() - .map(|b| serde_json::json!({ - "id": serde_json::to_value(b).unwrap_or_default(), - "label": b.label(), - "description": b.description(), - "query_count": 0, - })) + .map(|b| { + serde_json::json!({ + "id": serde_json::to_value(b).unwrap_or_default(), + "label": b.label(), + "description": b.description(), + "query_count": 0, + }) + }) .collect(); Json(serde_json::json!({ "buckets": buckets })) } @@ -1321,9 +1403,8 @@ async fn analyst_analyze_handler( } }; - let result = tokio::task::spawn_blocking(move || { - notebook_query::analyst::analyze(bucket) - }).await; + let result = + tokio::task::spawn_blocking(move || notebook_query::analyst::analyze(bucket)).await; match result { Ok(analysis) => Json(serde_json::to_value(analysis).unwrap_or_default()), @@ -1333,9 +1414,7 @@ async fn analyst_analyze_handler( /// Run all 6 analysis buckets. async fn analyst_full_handler() -> Json { - let result = tokio::task::spawn_blocking(|| { - notebook_query::analyst::full_analysis() - }).await; + let result = tokio::task::spawn_blocking(|| notebook_query::analyst::full_analysis()).await; match result { Ok(analyses) => Json(serde_json::to_value(analyses).unwrap_or_default()), @@ -1383,9 +1462,12 @@ async fn data_status_handler() -> Json { let cypher_dir = std::path::Path::new("/home/user/aiwar-neo4j-harvest/cypher"); let enrichment_status = if cypher_dir.exists() { let count = std::fs::read_dir(cypher_dir) - .map(|entries| entries.filter_map(|e| e.ok()).filter(|e| { - e.path().extension().map_or(false, |ext| ext == "cypher") - }).count()) + .map(|entries| { + entries + .filter_map(|e| e.ok()) + .filter(|e| e.path().extension().map_or(false, |ext| ext == "cypher")) + .count() + }) .unwrap_or(0); serde_json::json!({ "name": "Enrichment Cypher", @@ -1427,7 +1509,9 @@ async fn data_status_handler() -> Json { "/home/user/aiwar-neo4j-harvest/data/aiwarcloud-table.csv", "../aiwar-neo4j-harvest/data/aiwarcloud-table.csv", ]; - let csv_status = csv_candidates.iter().find(|p| std::path::Path::new(p).exists()); + let csv_status = csv_candidates + .iter() + .find(|p| std::path::Path::new(p).exists()); sources.push(match csv_status { Some(path) => serde_json::json!({ "name": "Aiwar CSV", diff --git a/crates/cockpit-server/src/openai.rs b/crates/cockpit-server/src/openai.rs index f4940889e..1d8da4018 100644 --- a/crates/cockpit-server/src/openai.rs +++ b/crates/cockpit-server/src/openai.rs @@ -235,11 +235,36 @@ impl OpenAiState { pub fn new() -> Self { Self { models: vec![ - ModelObject { id: "gpt2".into(), object: "model", created: 0, owned_by: "adaworldapi".into() }, - ModelObject { id: "openchat_3.5".into(), object: "model", created: 0, owned_by: "openchat".into() }, - ModelObject { id: "stable-diffusion-v1-5".into(), object: "model", created: 0, owned_by: "stabilityai".into() }, - ModelObject { id: "text-embedding-jina-v4".into(), object: "model", created: 0, owned_by: "jinaai".into() }, - ModelObject { id: "text-embedding-bert-base".into(), object: "model", created: 0, owned_by: "google".into() }, + ModelObject { + id: "gpt2".into(), + object: "model", + created: 0, + owned_by: "adaworldapi".into(), + }, + ModelObject { + id: "openchat_3.5".into(), + object: "model", + created: 0, + owned_by: "openchat".into(), + }, + ModelObject { + id: "stable-diffusion-v1-5".into(), + object: "model", + created: 0, + owned_by: "stabilityai".into(), + }, + ModelObject { + id: "text-embedding-jina-v4".into(), + object: "model", + created: 0, + owned_by: "jinaai".into(), + }, + ModelObject { + id: "text-embedding-bert-base".into(), + object: "model", + created: 0, + owned_by: "google".into(), + }, ], request_counter: 0, } @@ -269,18 +294,20 @@ pub fn openai_router(state: SharedOpenAiState) -> Router { // ── Handlers ──────────────────────────────────────────────────────────────── -async fn list_models( - State(state): State, -) -> Json { +async fn list_models(State(state): State) -> Json { let st = state.lock().await; Json(ModelListResponse { object: "list", - data: st.models.iter().map(|m| ModelObject { - id: m.id.clone(), - object: "model", - created: m.created, - owned_by: m.owned_by.clone(), - }).collect(), + data: st + .models + .iter() + .map(|m| ModelObject { + id: m.id.clone(), + object: "model", + created: m.created, + owned_by: m.owned_by.clone(), + }) + .collect(), }) } @@ -290,20 +317,28 @@ async fn get_model( ) -> impl IntoResponse { let st = state.lock().await; match st.models.iter().find(|m| m.id == model_id) { - Some(m) => (StatusCode::OK, Json(serde_json::json!({ - "id": m.id, - "object": "model", - "created": m.created, - "owned_by": m.owned_by, - }))).into_response(), - None => (StatusCode::NOT_FOUND, Json(serde_json::json!({ - "error": { - "message": format!("The model '{}' does not exist", model_id), - "type": "invalid_request_error", - "param": "model", - "code": "model_not_found" - } - }))).into_response(), + Some(m) => ( + StatusCode::OK, + Json(serde_json::json!({ + "id": m.id, + "object": "model", + "created": m.created, + "owned_by": m.owned_by, + })), + ) + .into_response(), + None => ( + StatusCode::NOT_FOUND, + Json(serde_json::json!({ + "error": { + "message": format!("The model '{}' does not exist", model_id), + "type": "invalid_request_error", + "param": "model", + "code": "model_not_found" + } + })), + ) + .into_response(), } } @@ -323,11 +358,18 @@ async fn create_completion( model: model.clone(), choices: vec![CompletionChoice { index: 0, - text: format!("[completion from {} — load weights to enable inference]", model), + text: format!( + "[completion from {} — load weights to enable inference]", + model + ), logprobs: None, finish_reason: Some("stop".into()), }], - usage: UsageObj { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 }, + usage: UsageObj { + prompt_tokens: 0, + completion_tokens: 0, + total_tokens: 0, + }, }) } @@ -340,7 +382,9 @@ async fn create_chat_completion( let model = req.model.unwrap_or_else(|| "openchat_3.5".into()); // Build content from messages for scaffold - let user_msg = req.messages.iter() + let user_msg = req + .messages + .iter() .filter(|m| m.role == "user") .filter_map(|m| m.content.as_deref()) .last() @@ -363,7 +407,11 @@ async fn create_chat_completion( }, finish_reason: Some("stop".into()), }], - usage: UsageObj { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 }, + usage: UsageObj { + prompt_tokens: 0, + completion_tokens: 0, + total_tokens: 0, + }, system_fingerprint: None, }) } @@ -384,7 +432,11 @@ async fn create_embedding( index: 0, embedding: vec![0.0; dim], }], - usage: UsageObj { prompt_tokens: 1, completion_tokens: 0, total_tokens: 1 }, + usage: UsageObj { + prompt_tokens: 1, + completion_tokens: 0, + total_tokens: 1, + }, }) } @@ -396,10 +448,12 @@ async fn create_image( Json(ImageGenResp { created: 0, - data: (0..n).map(|_| ImageObj { - b64_json: Some("[scaffold — load SD weights to enable generation]".into()), - url: None, - revised_prompt: Some(req.prompt.clone()), - }).collect(), + data: (0..n) + .map(|_| ImageObj { + b64_json: Some("[scaffold — load SD weights to enable generation]".into()), + url: None, + revised_prompt: Some(req.prompt.clone()), + }) + .collect(), }) } diff --git a/crates/cockpit-server/src/osint_classview.rs b/crates/cockpit-server/src/osint_classview.rs index ce804c191..1c4e27e1b 100644 --- a/crates/cockpit-server/src/osint_classview.rs +++ b/crates/cockpit-server/src/osint_classview.rs @@ -46,7 +46,7 @@ use std::sync::LazyLock; use askama::Template; use axum::http::StatusCode; use axum::response::Html; -use axum::{extract::Query, Json}; +use axum::{Json, extract::Query}; use lance_graph_contract::class_view::{ClassId, ClassView, FieldMask, RenderRow, ValueRow}; use lance_graph_contract::ontology::{DisplayTemplate, FieldRef}; use serde::Deserialize; @@ -69,13 +69,13 @@ static OSINT_SYSTEM_FIELDS: LazyLock<[FieldRef; 12]> = LazyLock::new(|| { FieldRef::new("aiwar:need/militaryUse", "militaryUse"), // 2 NEED FieldRef::new("aiwar:need/civicUse", "civicUse"), // 3 NEED // TWIG hi:lo - FieldRef::new("aiwar:need/mlTask", "MLTask"), // 4 NEED (the task) + FieldRef::new("aiwar:need/mlTask", "MLTask"), // 4 NEED (the task) FieldRef::new("aiwar:offer/mlType", "MLType"), // 5 OFFER (the technique) // LEAF hi:lo - FieldRef::new("aiwar:intent/purpose", "purpose:vair"), // 6 INTENT (explicit) + FieldRef::new("aiwar:intent/purpose", "purpose:vair"), // 6 INTENT (explicit) FieldRef::new("aiwar:offer/capacity", "capacity:airo"), // 7 OFFER // family hi:lo - FieldRef::new("aiwar:offer/output", "output:airo"), // 8 OFFER + FieldRef::new("aiwar:offer/output", "output:airo"), // 8 OFFER FieldRef::new("aiwar:causality/impact", "impact:vair"), // 9 CAUSALITY (implicit) // identity hi:lo FieldRef::new("aiwar:relation/stakeholder", "stakeholder"), // 10 RELATION (edge) diff --git a/crates/cockpit-server/src/osint_gotham.rs b/crates/cockpit-server/src/osint_gotham.rs index 0e3df9ec5..18f2c485f 100644 --- a/crates/cockpit-server/src/osint_gotham.rs +++ b/crates/cockpit-server/src/osint_gotham.rs @@ -44,8 +44,8 @@ use std::sync::{Arc, OnceLock}; use serde_json::Value; use tokio::sync::RwLock; -use aiwar_ingest::encounter_round::{load_encounter_rounds, EncounterRound}; use aiwar_ingest::AiWarGraph; +use aiwar_ingest::encounter_round::{EncounterRound, load_encounter_rounds}; use lance_graph_contract::canonical_node::{EdgeBlock, NodeGuid, NodeRow}; use lance_graph_contract::class_view::{ClassView, FieldMask}; use lance_graph_contract::exploration::NarsTruth; @@ -619,15 +619,22 @@ fn plan_basins(graph: &AiWarGraph, rounds: &[EncounterRound]) -> BasinPlan { for e in &graph.edges { *degree.entry(e.source.clone()).or_insert(0) += 1; *degree.entry(e.target.clone()).or_insert(0) += 1; - adj.entry(e.source.clone()).or_default().push(e.target.clone()); - adj.entry(e.target.clone()).or_default().push(e.source.clone()); + adj.entry(e.source.clone()) + .or_default() + .push(e.target.clone()); + adj.entry(e.target.clone()) + .or_default() + .push(e.source.clone()); } let deg = |id: &str| degree.get(id).copied().unwrap_or(0); // 4. per-theme anchors = top-15 by (degree desc, id asc) → low nibble 1..=15. let mut theme_nodes: HashMap> = HashMap::new(); for n in &graph.nodes { - let t = node_theme.get(&n.id).cloned().unwrap_or_else(|| "core".into()); + let t = node_theme + .get(&n.id) + .cloned() + .unwrap_or_else(|| "core".into()); theme_nodes.entry(t).or_default().push(n.id.clone()); } let mut anchor_nibble: HashMap = HashMap::new(); // node → its anchor nibble @@ -646,7 +653,10 @@ fn plan_basins(graph: &AiWarGraph, rounds: &[EncounterRound]) -> BasinPlan { // 5. non-anchor members take the anchor (same theme) they are most tied to. let mut node_basin: HashMap = HashMap::new(); for n in &graph.nodes { - let theme = node_theme.get(&n.id).cloned().unwrap_or_else(|| "core".into()); + let theme = node_theme + .get(&n.id) + .cloned() + .unwrap_or_else(|| "core".into()); let ti = *theme_index.get(&theme).unwrap_or(&0); let nib = if let Some(nib) = anchor_nibble.get(&n.id) { *nib @@ -696,7 +706,9 @@ pub fn osint_node_rows(graph: &AiWarGraph, plan: &BasinPlan) -> Vec { // node id → its outgoing target ids (for the adapter mask). let mut out: HashMap<&str, Vec<&str>> = HashMap::new(); for e in &graph.edges { - out.entry(e.source.as_str()).or_default().push(e.target.as_str()); + out.entry(e.source.as_str()) + .or_default() + .push(e.target.as_str()); } graph @@ -780,7 +792,9 @@ pub fn build_osint_gotham(graph: &AiWarGraph, rounds: &[EncounterRound]) -> Grap // basin byte → entity ids in it (for hub member counts). let mut basin_members: HashMap = HashMap::new(); for r in &rows { - *basin_members.entry((r.key.family_v2() & 0xFF) as u8).or_insert(0) += 1; + *basin_members + .entry((r.key.family_v2() & 0xFF) as u8) + .or_insert(0) += 1; } let mut nodes: Vec = Vec::with_capacity(rows.len() + basin_members.len()); @@ -795,7 +809,10 @@ pub fn build_osint_gotham(graph: &AiWarGraph, rounds: &[EncounterRound]) -> Grap .map(|(k, v)| (*v, k.clone())) .collect(); for &b in &basins { - let theme = theme_name.get(&(b >> 4)).cloned().unwrap_or_else(|| "core".into()); + let theme = theme_name + .get(&(b >> 4)) + .cloned() + .unwrap_or_else(|| "core".into()); let anchor = plan.anchor_of_basin.get(&b).cloned(); let label = match &anchor { Some(a) => format!("{theme} · {a}"), @@ -1092,8 +1109,7 @@ pub fn osint_soa_bytes(graph: &AiWarGraph, rounds: &[EncounterRound]) -> Vec .collect(); let mut edges: Vec = Vec::new(); for e in &graph.edges { - if let (Some(&s), Some(&t)) = - (idx_of.get(e.source.as_str()), idx_of.get(e.target.as_str())) + if let (Some(&s), Some(&t)) = (idx_of.get(e.source.as_str()), idx_of.get(e.target.as_str())) { push_edge(&mut edges, s, t, rel_code(&e.rel_type)); } @@ -1145,7 +1161,11 @@ pub fn osint_soa_bytes(graph: &AiWarGraph, rounds: &[EncounterRound]) -> Vec buf.extend_from_slice(&b[..l]); }; for n in &graph.nodes { - let nm = if n.label.is_empty() { n.id.as_str() } else { n.label.as_str() }; + let nm = if n.label.is_empty() { + n.id.as_str() + } else { + n.label.as_str() + }; push_label(&mut labels, nm); } @@ -1160,8 +1180,7 @@ pub fn osint_soa_bytes(graph: &AiWarGraph, rounds: &[EncounterRound]) -> Vec tenants.extend_from_slice(&r.value[1..=FACET_STAKEHOLDER]); } - let mut out = - Vec::with_capacity(12 + nodes.len() + edges.len() + labels.len() + tenants.len()); + let mut out = Vec::with_capacity(12 + nodes.len() + edges.len() + labels.len() + tenants.len()); out.extend_from_slice(&OSINT_SOA_MAGIC); out.extend_from_slice(&(node_count as u32).to_le_bytes()); out.extend_from_slice(&(edge_count as u32).to_le_bytes()); @@ -1242,7 +1261,10 @@ mod tests { #[test] fn theme_stem_normalizes_version_markers() { - assert_eq!(theme_stem("aiwar_enrichment_epstein_v31_patch.cypher"), "epstein"); + assert_eq!( + theme_stem("aiwar_enrichment_epstein_v31_patch.cypher"), + "epstein" + ); assert_eq!( theme_stem("aiwar_enrichment_thiel_infrastructure.cypher"), "thiel_infrastructure" @@ -1319,7 +1341,10 @@ mod tests { assert_ne!(lv[FACET_MLTASK], 0, "MLTask coded"); assert_ne!(lv[FACET_PURPOSE], 0, "purpose coded"); assert_ne!(lv[FACET_CAPACITY], 0, "capacity coded"); - assert_eq!(lv[FACET_AIRO_ROLE], 0, "a System carries no AIRO actor role"); + assert_eq!( + lv[FACET_AIRO_ROLE], 0, + "a System carries no AIRO actor role" + ); let boom = g.nodes.iter().position(|n| n.id == "Boomerang").unwrap(); let bv = &rows[boom].value; @@ -1328,7 +1353,10 @@ mod tests { bv[FACET_AIRO_ROLE], 0b011, "deployer AND subject — the boomerang" ); - assert_eq!(bv[FACET_MILITARY], 0, "a stakeholder carries no system facet"); + assert_eq!( + bv[FACET_MILITARY], 0, + "a stakeholder carries no system facet" + ); // The V3 byte this fixture actually populates. Asserted POSITIVELY, // because the zero-tail check below was widened from `FACET_CAPACITY + 1` @@ -1380,10 +1408,14 @@ mod tests { let rows = osint_node_rows(&g, &plan); // Every adapter byte resolves to a real basin (an interface to a basin). - let known: std::collections::HashSet = - plan.node_basin.values().copied().collect(); + let known: std::collections::HashSet = plan.node_basin.values().copied().collect(); for row in &rows { - for &b in row.edges.in_family.iter().chain(row.edges.out_family.iter()) { + for &b in row + .edges + .in_family + .iter() + .chain(row.edges.out_family.iter()) + { if b != 0 { assert!(known.contains(&b), "adapter {b:02x} must be a real basin"); } @@ -1408,7 +1440,9 @@ mod tests { // zero rows until OGAR's codebook defines 0x07XX classes (graceful). assert_eq!(class_view.field_count(osint_class_id()), 0); assert_eq!( - class_view.render_rows(osint_class_id(), FieldMask::FULL).len(), + class_view + .render_rows(osint_class_id(), FieldMask::FULL) + .len(), 0 ); } @@ -1430,11 +1464,12 @@ mod tests { assert!(snap.nodes.iter().any(|n| n.label == "Peter Thiel")); // every member node carries the OGAR ClassView display-wiring marker. - assert!(snap - .nodes - .iter() - .filter(|n| n.node_type != "Basin") - .all(|n| n.properties.contains_key("display_class_fields"))); + assert!( + snap.nodes + .iter() + .filter(|n| n.node_type != "Basin") + .all(|n| n.properties.contains_key("display_class_fields")) + ); } #[test] @@ -1454,7 +1489,11 @@ mod tests { [p[0].to_bits(), p[1].to_bits(), p[2].to_bits()] }) .collect(); - assert_eq!(pts.len(), rows.len(), "distinct addresses → distinct points"); + assert_eq!( + pts.len(), + rows.len(), + "distinct addresses → distinct points" + ); // distinct basins occupy distinct regions of space. assert_ne!(basin_center(1), basin_center(2)); @@ -1724,7 +1763,11 @@ mod tests { gnode("Intelligence", "SchemaValue", &[]), gnode("Policing", "SchemaValue", &[]), gnode("CrowdControl", "SchemaValue", &[]), - gnode("Israel", "Stakeholder", &[("airo:type", "AIDeployer, AISubject")]), + gnode( + "Israel", + "Stakeholder", + &[("airo:type", "AIDeployer, AISubject")], + ), gnode("AIDeployer", "SchemaValue", &[]), gnode("AISubject", "SchemaValue", &[]), ], @@ -1734,7 +1777,10 @@ mod tests { // System → its militaryUse value, and BOTH civicUse values (compound split). assert!(fe.contains(&(0, 1, REL_FACET_MILITARY)), "militaryUse edge"); assert!(fe.contains(&(0, 2, REL_FACET_CIVIC)), "civicUse Policing"); - assert!(fe.contains(&(0, 3, REL_FACET_CIVIC)), "civicUse CrowdControl"); + assert!( + fe.contains(&(0, 3, REL_FACET_CIVIC)), + "civicUse CrowdControl" + ); // Stakeholder → BOTH airo roles (the boomerang, as two edges). assert!(fe.contains(&(4, 5, REL_FACET_AIRO)), "airo AIDeployer"); assert!(fe.contains(&(4, 6, REL_FACET_AIRO)), "airo AISubject"); diff --git a/crates/cockpit-server/src/osm_chains_books_lance.rs b/crates/cockpit-server/src/osm_chains_books_lance.rs index 22f5dcc70..6ee5d8cf2 100644 --- a/crates/cockpit-server/src/osm_chains_books_lance.rs +++ b/crates/cockpit-server/src/osm_chains_books_lance.rs @@ -210,7 +210,10 @@ pub async fn take_by_ordinal_sparse( index: &OrdinalIndex, ordinals: &[u32], ) -> Result>, lance::Error> { - let row_indices: Vec = ordinals.iter().filter_map(|o| index.row_index(*o)).collect(); + let row_indices: Vec = ordinals + .iter() + .filter_map(|o| index.row_index(*o)) + .collect(); take_by_row_index(dataset, &row_indices).await } @@ -257,8 +260,10 @@ pub async fn ensure_chains_lance_local(chains_path: &Path) -> Option<(PathBuf, O } }; - let entries: Vec<(u32, Vec)> = - chains.iter().map(|(ordinal, raw)| (ordinal, raw.to_vec())).collect(); + let entries: Vec<(u32, Vec)> = chains + .iter() + .map(|(ordinal, raw)| (ordinal, raw.to_vec())) + .collect(); let dest = book_dataset_path(chains_path, "chains"); match write_ordinal_blob_dataset(&dest, &entries).await { Ok(written_ordinals) => { @@ -408,7 +413,8 @@ static CHAINS_DATASET: tokio::sync::OnceCell> = tokio::sync::Onc static CHAINS_INDEX: std::sync::OnceLock> = std::sync::OnceLock::new(); static IDENTITIES_DATASET: tokio::sync::OnceCell> = tokio::sync::OnceCell::const_new(); -static TAG_KEYS_DATASET: tokio::sync::OnceCell> = tokio::sync::OnceCell::const_new(); +static TAG_KEYS_DATASET: tokio::sync::OnceCell> = + tokio::sync::OnceCell::const_new(); static TAG_VALUES_DATASET: tokio::sync::OnceCell> = tokio::sync::OnceCell::const_new(); @@ -472,7 +478,10 @@ pub fn publish_chains_conversion(result: Option<(PathBuf, OrdinalIndex)>) -> Opt } } -async fn open_cached(cell: &'static tokio::sync::OnceCell>, path: &Path) -> Option<&'static Dataset> { +async fn open_cached( + cell: &'static tokio::sync::OnceCell>, + path: &Path, +) -> Option<&'static Dataset> { cell.get_or_init(|| async { let path_str = path.to_str()?; Dataset::open(path_str).await.ok() @@ -488,11 +497,15 @@ async fn open_cached(cell: &'static tokio::sync::OnceCell>, path /// contract as the rest of this module. pub async fn gather_chains(chains_dataset_path: &Path, ordinals: &[u32]) -> Option { if ordinals.is_empty() { - return Some(RequestChains { raw: HashMap::new() }); + return Some(RequestChains { + raw: HashMap::new(), + }); } let index = CHAINS_INDEX.get()?.as_ref()?; let dataset = open_cached(&CHAINS_DATASET, chains_dataset_path).await?; - let raw = take_by_ordinal_sparse(dataset, index, ordinals).await.ok()?; + let raw = take_by_ordinal_sparse(dataset, index, ordinals) + .await + .ok()?; Some(RequestChains { raw }) } @@ -502,7 +515,9 @@ async fn gather_lookup( ordinals: &[u32], ) -> Option { if ordinals.is_empty() { - return Some(Lookup { map: HashMap::new() }); + return Some(Lookup { + map: HashMap::new(), + }); } let dataset = open_cached(cell, path).await?; // Dense addressing: row index == ordinal directly (see the module doc). @@ -616,7 +631,11 @@ mod tests { "an unstored ordinal is silently absent from the result, mirroring \ Chains::get's existing Ok(None) contract — never a panic or an error" ); - assert_eq!(got.len(), 2, "exactly the two real ordinals came back, nothing extra"); + assert_eq!( + got.len(), + 2, + "exactly the two real ordinals came back, nothing extra" + ); } /// Anti-vacuity for the round trip: bytes come back byte-for-byte, @@ -630,7 +649,7 @@ mod tests { /// via the raw-record path (never re-encoding). #[tokio::test] async fn ensure_chains_lance_local_round_trips_a_real_chains_sidecar() { - use osm_soa_bake::chains::{decode_chain, Chains}; + use osm_soa_bake::chains::{Chains, decode_chain}; use osm_soa_bake::tms::TileXy; fn c(x: u32, y: u32) -> TileXy { @@ -640,7 +659,11 @@ mod tests { // A gapped, non-contiguous ordinal space — the sparse case this // module exists for (see the "sparse_ordinals" test above). - let mut chains = vec![(3u32, ring.clone()), (500, vec![c(1, 1)]), (501, ring.clone())]; + let mut chains = vec![ + (3u32, ring.clone()), + (500, vec![c(1, 1)]), + (501, ring.clone()), + ]; let mut buf = Vec::new(); osm_soa_bake::chains::write_chains(&mut buf, 0xABCD_1234, &mut chains).expect("write"); @@ -657,7 +680,9 @@ mod tests { // dataset now serves must decode to exactly what Chains::get() // returns for that same ordinal from the original bytes. let original = Chains::from_bytes(buf).expect("parse original"); - let dataset = Dataset::open(dataset_path.to_str().unwrap()).await.expect("open"); + let dataset = Dataset::open(dataset_path.to_str().unwrap()) + .await + .expect("open"); for ordinal in [3u32, 500, 501] { let row = index.row_index(ordinal).expect("ordinal was written"); @@ -707,8 +732,9 @@ mod tests { let books_path = dir.path().join("region.books"); std::fs::write(&books_path, &buf).expect("write fixture"); - let [id_path, keys_path, values_path, labels_path] = - ensure_books_lance_local(&books_path).await.expect("conversion should succeed"); + let [id_path, keys_path, values_path, labels_path] = ensure_books_lance_local(&books_path) + .await + .expect("conversion should succeed"); assert_eq!(id_path, dir.path().join("region.identities.lance")); assert_eq!(keys_path, dir.path().join("region.tag_keys.lance")); assert_eq!(values_path, dir.path().join("region.tag_values.lance")); @@ -716,14 +742,18 @@ mod tests { // Dense addressing: ordinal 1 of tag_values ("residential") sits at // row 1 directly — no index translation, per the module doc. - let values_ds = Dataset::open(values_path.to_str().unwrap()).await.expect("open"); + let values_ds = Dataset::open(values_path.to_str().unwrap()) + .await + .expect("open"); let got = take_by_row_index(&values_ds, &[0, 1]).await.expect("take"); assert_eq!(got.get(&0), Some(&b"primary".to_vec())); assert_eq!(got.get(&1), Some(&b"residential".to_vec())); // UTF-8 multibyte content (the German ß) survives verbatim — labels // carry street names, not ASCII-only tag vocabulary. - let labels_ds = Dataset::open(labels_path.to_str().unwrap()).await.expect("open"); + let labels_ds = Dataset::open(labels_path.to_str().unwrap()) + .await + .expect("open"); let got = take_by_row_index(&labels_ds, &[0]).await.expect("take"); assert_eq!(got.get(&0), Some(&"Hauptstraße".as_bytes().to_vec())); } @@ -802,8 +832,9 @@ mod tests { let chains_path = dir.path().join("gather.chains"); std::fs::write(&chains_path, &buf).expect("write fixture"); - let (dataset_path, index) = - ensure_chains_lance_local(&chains_path).await.expect("conversion"); + let (dataset_path, index) = ensure_chains_lance_local(&chains_path) + .await + .expect("conversion"); set_chains_index(index); // Ask for 3 and 500 (present), 4 (a real gap), and NOT 501 (present @@ -837,8 +868,7 @@ mod tests { use osm_soa_bake::codebook::{Books, Header}; use osm_soa_bake::tms::AnchorRounding; - let identities = - IdentityCodebook::try_new(vec!["node/1".into(), "way/2".into()]).unwrap(); + let identities = IdentityCodebook::try_new(vec!["node/1".into(), "way/2".into()]).unwrap(); let tag_keys = IdentityCodebook::try_new(vec!["highway".into()]).unwrap(); let tag_values = IdentityCodebook::try_new(vec!["primary".into(), "residential".into()]).unwrap(); @@ -862,8 +892,9 @@ mod tests { let books_path = dir.path().join("gather.books"); std::fs::write(&books_path, &buf).expect("write fixture"); - let [id_path, keys_path, values_path, _labels_path] = - ensure_books_lance_local(&books_path).await.expect("conversion"); + let [id_path, keys_path, values_path, _labels_path] = ensure_books_lance_local(&books_path) + .await + .expect("conversion"); let gathered = gather_books(&id_path, &keys_path, &values_path, &[1], &[0], &[1]) .await diff --git a/crates/cockpit-server/src/osm_features.rs b/crates/cockpit-server/src/osm_features.rs index 34cbcd6f0..4570b58ea 100644 --- a/crates/cockpit-server/src/osm_features.rs +++ b/crates/cockpit-server/src/osm_features.rs @@ -18,10 +18,10 @@ //! straight to `tile_range`, which applies the flip internally — so the //! request path never round-trips through a key at all. +use axum::Json; use axum::extract::Path; use axum::http::StatusCode; use axum::response::{IntoResponse, Response}; -use axum::Json; use lance_graph_contract::canonical_node::NodeRow; use osm_soa_bake::identity::read_identity; use osm_soa_bake::slab::RowSlab; @@ -499,7 +499,10 @@ fn sidecar_path(ext: &str) -> Option { // deploy without an OSM bake runs this way by design, and the // endpoints already answer 503. It is logged so "unset" and // "present but unreadable" are never confused for each other. - tracing::debug!(ext, "osm sidecar: OSM_SLAB_PATH unset — no OSM bake configured"); + tracing::debug!( + ext, + "osm sidecar: OSM_SLAB_PATH unset — no OSM bake configured" + ); None } } @@ -677,7 +680,9 @@ pub async fn osm_health_handler() -> Json { // "header-valid", not "resident in memory". let books_loaded = books_header_valid_for_slab(sidecar("books")); let chains_loaded = chains_header_valid_for_slab(sidecar("chains")); - let rows = open_slab().and_then(|b| RowSlab::new(b).ok()).map(|s| s.len()); + let rows = open_slab() + .and_then(|b| RowSlab::new(b).ok()) + .map(|s| s.len()); let styling = styling_verdict( slab_env.is_some(), @@ -1076,24 +1081,56 @@ where // to the fallback is everything. if matches!( landuse, - Some("grass" | "meadow" | "farmland" | "farmyard" | "orchard" | "vineyard" - | "allotments" | "village_green" | "greenfield" | "flowerbed") - ) || matches!(natural, Some("grassland" | "heath" | "scrub" | "moor" | "fell")) - { + Some( + "grass" + | "meadow" + | "farmland" + | "farmyard" + | "orchard" + | "vineyard" + | "allotments" + | "village_green" + | "greenfield" + | "flowerbed" + ) + ) || matches!( + natural, + Some("grassland" | "heath" | "scrub" | "moor" | "fell") + ) { return ShapeClass::Meadow; } if matches!( leisure, - Some("park" | "garden" | "pitch" | "playground" | "recreation_ground" - | "golf_course" | "dog_park" | "common") - ) || matches!(landuse, Some("cemetery" | "grave_yard" | "recreation_ground")) - { + Some( + "park" + | "garden" + | "pitch" + | "playground" + | "recreation_ground" + | "golf_course" + | "dog_park" + | "common" + ) + ) || matches!( + landuse, + Some("cemetery" | "grave_yard" | "recreation_ground") + ) { return ShapeClass::Park; } if matches!( landuse, - Some("residential" | "industrial" | "commercial" | "retail" | "construction" - | "garages" | "railway" | "quarry" | "brownfield" | "military") + Some( + "residential" + | "industrial" + | "commercial" + | "retail" + | "construction" + | "garages" + | "railway" + | "quarry" + | "brownfield" + | "military" + ) ) { return ShapeClass::Built; } @@ -1114,7 +1151,11 @@ where /// Tags bind to their member by ORDINAL, not by slot adjacency — the same /// filter [`query_feature`] documents, and for the same reason: without it a /// continuation row's tags are attributed to the wrong element. -fn row_tags<'a>(row: &NodeRow, books: &'a BooksHandle<'_>, ordinal: u32) -> Vec<(&'a str, &'a str)> { +fn row_tags<'a>( + row: &NodeRow, + books: &'a BooksHandle<'_>, + ordinal: u32, +) -> Vec<(&'a str, &'a str)> { let mut out = Vec::new(); for (_slot, facet) in osm_soa_bake::cluster::facets(row) { if let osm_soa_bake::cluster::Facet::Tag { member, key, value } = facet { @@ -1803,8 +1844,14 @@ mod tests { // The two that actually fire on a broken deploy must be findable by an // operator grepping for trouble, and must name their distinct fix. assert!(refused.contains("DEGRADED") && absent.contains("DEGRADED")); - assert!(refused.contains("re-bake"), "a refused codebook needs a re-bake"); - assert!(absent.contains("Ship"), "an absent codebook needs the file shipped"); + assert!( + refused.contains("re-bake"), + "a refused codebook needs a re-bake" + ); + assert!( + absent.contains("Ship"), + "an absent codebook needs the file shipped" + ); // A working deploy must NOT shout — otherwise the signal is worthless. assert!(!ok.contains("DEGRADED") && !unconfigured.contains("DEGRADED")); } @@ -1823,7 +1870,10 @@ mod tests { fn sidecars_resolve_from_the_slab_stem_not_the_lance_dir() { use std::path::PathBuf; let slab = PathBuf::from("/vol/osm/berlin.soa"); - assert_eq!(slab.with_extension("books"), PathBuf::from("/vol/osm/berlin.books")); + assert_eq!( + slab.with_extension("books"), + PathBuf::from("/vol/osm/berlin.books") + ); assert_eq!( slab.with_extension("chains"), PathBuf::from("/vol/osm/berlin.chains") @@ -1874,8 +1924,12 @@ mod tests { ); // Missing files: false, cheaply, no digest comparison needed. - assert!(!books_header_valid_for_slab(Some(dir.path().join("nope.books")))); - assert!(!chains_header_valid_for_slab(Some(dir.path().join("nope.chains")))); + assert!(!books_header_valid_for_slab(Some( + dir.path().join("nope.books") + ))); + assert!(!chains_header_valid_for_slab(Some( + dir.path().join("nope.chains") + ))); assert!(!books_header_valid_for_slab(None)); assert!(!chains_header_valid_for_slab(None)); @@ -2155,7 +2209,10 @@ mod tests { #[test] fn specific_land_kinds_beat_the_generic_green_fallback() { assert_eq!(class_for_tags([("landuse", "meadow")]), ShapeClass::Meadow); - assert_eq!(class_for_tags([("landuse", "farmland")]), ShapeClass::Meadow); + assert_eq!( + class_for_tags([("landuse", "farmland")]), + ShapeClass::Meadow + ); assert_eq!(class_for_tags([("natural", "heath")]), ShapeClass::Meadow); assert_eq!(class_for_tags([("leisure", "park")]), ShapeClass::Park); assert_eq!(class_for_tags([("landuse", "cemetery")]), ShapeClass::Park); @@ -2174,14 +2231,19 @@ mod tests { assert_eq!(class_for_tags([("building", "yes")]), ShapeClass::Building); // …and the fallback still catches a green-ish tag none of them name, // so widening the specific set can never demote one to `Other`. - assert_eq!(class_for_tags([("landuse", "some_new_tag")]), ShapeClass::Green); + assert_eq!( + class_for_tags([("landuse", "some_new_tag")]), + ShapeClass::Green + ); assert_eq!(class_for_tags([("leisure", "marina")]), ShapeClass::Green); } /// Decode `OSM1` bytes back into shapes — an independent reader for the /// round-trip test below, written from the format DOC, not from the /// encoder's code, so a shared misunderstanding can't self-certify. - fn decode_tile_bin(buf: &[u8]) -> Option<(u32, u32, u32, u32, Vec<(u32, u8, bool, Vec<(f32, f32)>)>)> { + fn decode_tile_bin( + buf: &[u8], + ) -> Option<(u32, u32, u32, u32, Vec<(u32, u8, bool, Vec<(f32, f32)>)>)> { let rd_u32 = |at: usize| u32::from_le_bytes(buf[at..at + 4].try_into().unwrap()); if buf.len() < 20 || rd_u32(0) != 0x314D_534F { return None; @@ -2220,12 +2282,27 @@ mod tests { let z = 14u32; // A tile that really contains the cells below (Berlin-ish). let cells = [ - osm_soa_bake::tms::TileXy { x: 0x8988_0000, y_xyz: 0x5470_0000 }, - osm_soa_bake::tms::TileXy { x: 0x8988_4000, y_xyz: 0x5470_4000 }, - osm_soa_bake::tms::TileXy { x: 0x8988_8000, y_xyz: 0x5470_0000 }, - osm_soa_bake::tms::TileXy { x: 0x8988_0000, y_xyz: 0x5470_0000 }, + osm_soa_bake::tms::TileXy { + x: 0x8988_0000, + y_xyz: 0x5470_0000, + }, + osm_soa_bake::tms::TileXy { + x: 0x8988_4000, + y_xyz: 0x5470_4000, + }, + osm_soa_bake::tms::TileXy { + x: 0x8988_8000, + y_xyz: 0x5470_0000, + }, + osm_soa_bake::tms::TileXy { + x: 0x8988_0000, + y_xyz: 0x5470_0000, + }, ]; - let (tx, ty) = (cells[0].x >> (32 - z as usize as u32), cells[0].y_xyz >> (32 - z)); + let (tx, ty) = ( + cells[0].x >> (32 - z as usize as u32), + cells[0].y_xyz >> (32 - z), + ); let raw = TileShapesRaw { z, x: tx, @@ -2254,8 +2331,9 @@ mod tests { let n = f64::exp2(z as f64); let wx = (lon + 180.0) / 360.0 * n * 256.0 - (tx * 256) as f64; let r = lat.to_radians(); - let wy = (1.0 - (r.tan() + 1.0 / r.cos()).ln() / std::f64::consts::PI) / 2.0 * n * 256.0 - - (ty * 256) as f64; + let wy = + (1.0 - (r.tan() + 1.0 / r.cos()).ln() / std::f64::consts::PI) / 2.0 * n * 256.0 + - (ty * 256) as f64; assert!( (pts[i].0 as f64 - wx).abs() < 0.01 && (pts[i].1 as f64 - wy).abs() < 0.01, "point {i}: bin ({}, {}) vs lonlat projection ({wx:.4}, {wy:.4})", @@ -2331,8 +2409,14 @@ mod tests { let berlin_range = slab.tile_range(z, bx, by); let reyk_range = slab.tile_range(z, rx, ry); - assert!(!berlin_range.is_empty(), "Berlin tile must contain the Berlin rows, got {berlin_range:?}"); - assert!(!reyk_range.is_empty(), "Reykjavik tile must contain the Reykjavik rows, got {reyk_range:?}"); + assert!( + !berlin_range.is_empty(), + "Berlin tile must contain the Berlin rows, got {berlin_range:?}" + ); + assert!( + !reyk_range.is_empty(), + "Reykjavik tile must contain the Reykjavik rows, got {reyk_range:?}" + ); assert!( berlin_range.end <= reyk_range.start || reyk_range.end <= berlin_range.start, "neighboring tiles must return disjoint row ranges, got {berlin_range:?} vs {reyk_range:?}" @@ -2352,7 +2436,10 @@ mod tests { let (x, y) = crate::osm_tiles::lonlat_to_tile(lon, lat, z); let out = query_tile(&bytes, z, x, y).expect("query succeeds over a valid slab"); - assert_eq!(out.total, 1, "exactly the one fixture row must fall in its own tile"); + assert_eq!( + out.total, 1, + "exactly the one fixture row must fall in its own tile" + ); assert_eq!(out.returned, 1); let got = &out.features[0]; assert!( @@ -2641,7 +2728,10 @@ mod tests { .collect(); pts.extend_from_slice(&outliers); - let mut mortons: Vec = pts.iter().map(|&(a, b)| point_to_tms_morton(a, b)).collect(); + let mut mortons: Vec = pts + .iter() + .map(|&(a, b)| point_to_tms_morton(a, b)) + .collect(); mortons.sort_unstable(); let bytes = synthetic_slab(&mortons); let slab = RowSlab::new(&bytes).expect("row-aligned synthetic buffer"); @@ -2715,9 +2805,8 @@ mod tests { let (cx, cy, step) = (13.40_f64, 52.50_f64, 0.002_f64); let mut mortons: Vec = (0..40) .flat_map(|i| { - (0..40).map(move |j| { - point_to_tms_morton(cx + i as f64 * step, cy + j as f64 * step) - }) + (0..40) + .map(move |j| point_to_tms_morton(cx + i as f64 * step, cy + j as f64 * step)) }) .collect(); mortons.sort_unstable(); @@ -2741,7 +2830,10 @@ mod tests { prev = n; } // Anti-vacuity: monotonicity is trivially true of a constant sequence. - assert!(grew, "fixture never split a cell, so monotonicity proves nothing"); + assert!( + grew, + "fixture never split a cell, so monotonicity proves nothing" + ); assert_eq!( prev, mortons.len(), @@ -2758,9 +2850,8 @@ mod tests { let (cx, cy, step) = (13.40_f64, 52.50_f64, 0.0005_f64); let mut mortons: Vec = (0..60) .flat_map(|i| { - (0..60).map(move |j| { - point_to_tms_morton(cx + i as f64 * step, cy + j as f64 * step) - }) + (0..60) + .map(move |j| point_to_tms_morton(cx + i as f64 * step, cy + j as f64 * step)) }) .collect(); mortons.sort_unstable(); @@ -2774,7 +2865,10 @@ mod tests { let zz = choose_cell_zoom(z, range.clone(), morton, budget); let here = occupied_cells(range.clone(), morton, zz * 2); - assert!(here <= budget, "chosen depth z={zz} yields {here} cells, over budget"); + assert!( + here <= budget, + "chosen depth z={zz} yields {here} cells, over budget" + ); assert!( zz < HHTL_ZOOM_MAX, @@ -2863,14 +2957,12 @@ mod tests { let extent = |sel: &[usize]| -> (f64, f64) { let pts: Vec<(f64, f64)> = sel.iter().map(|&i| morton_to_lonlat(morton(i))).collect(); - let all: Vec<(f64, f64)> = range - .clone() - .map(|i| morton_to_lonlat(morton(i))) - .collect(); + let all: Vec<(f64, f64)> = + range.clone().map(|i| morton_to_lonlat(morton(i))).collect(); let span = |v: &[(f64, f64)], f: fn(&(f64, f64)) -> f64| { - let (lo, hi) = v.iter().fold((f64::MAX, f64::MIN), |a, p| { - (a.0.min(f(p)), a.1.max(f(p))) - }); + let (lo, hi) = v + .iter() + .fold((f64::MAX, f64::MIN), |a, p| (a.0.min(f(p)), a.1.max(f(p)))); hi - lo }; ( diff --git a/crates/cockpit-server/src/osm_lance.rs b/crates/cockpit-server/src/osm_lance.rs index e9ef943e8..48d8963cb 100644 --- a/crates/cockpit-server/src/osm_lance.rs +++ b/crates/cockpit-server/src/osm_lance.rs @@ -1199,7 +1199,12 @@ mod tests { /// where it is claimed to be, rather than matching any repeated filler. fn distinct_slab(rows: usize) -> Vec { let mut bytes = vec![0u8; rows * NODE_ROW_STRIDE]; - for (i, chunk) in bytes.chunks_exact_mut(NODE_ROW_STRIDE).enumerate() { + for (i, chunk) in bytes + .as_chunks_mut::() + .0 + .iter_mut() + .enumerate() + { for (j, b) in chunk.iter_mut().enumerate() { *b = ((i * 31 + j * 7) % 251) as u8; } diff --git a/crates/cockpit-server/src/osm_slab_hydrate.rs b/crates/cockpit-server/src/osm_slab_hydrate.rs index 77a732b28..97a1f1e66 100644 --- a/crates/cockpit-server/src/osm_slab_hydrate.rs +++ b/crates/cockpit-server/src/osm_slab_hydrate.rs @@ -252,7 +252,9 @@ pub async fn ensure_slab_local() -> Option { let catalogue = fetch_catalogue(&store, &bucket).await; let catalogue = if catalogue.is_empty() { vec![crate::osm_region_catalogue::RegionEntry { - name: override_region.clone().unwrap_or_else(|| DEFAULT_REGION.to_string()), + name: override_region + .clone() + .unwrap_or_else(|| DEFAULT_REGION.to_string()), hydrate: true, }] } else { @@ -382,7 +384,11 @@ async fn hydrate_one_region( let want = match sums.iter().find(|(k, _)| k == name).map(|(_, h)| h.clone()) { Some(h) => h, None => { - tracing::error!(region, artifact = name, "osm slab: no checksum pinned; refusing"); + tracing::error!( + region, + artifact = name, + "osm slab: no checksum pinned; refusing" + ); return None; } }; @@ -393,14 +399,19 @@ async fn hydrate_one_region( match resolve_cache_hit(&dest, &want) { CacheDecision::TrustedViaMarker => { tracing::info!( - region, artifact = name, + region, + artifact = name, "osm slab: cache hit, trusted via unchanged marker (mtime+len \ match the last real verification; skipped re-hash)" ); continue; } CacheDecision::Verified => { - tracing::info!(region, artifact = name, "osm slab: cache hit, checksum verified"); + tracing::info!( + region, + artifact = name, + "osm slab: cache hit, checksum verified" + ); continue; } CacheDecision::Mismatch(got) => tracing::warn!( @@ -1019,7 +1030,11 @@ not-a-hash junk.txt /// name EVERY absent piece, not stop at the first. #[test] fn missing_inputs_names_every_absent_variable() { - assert_eq!(missing_inputs(None, None).len(), 2, "both absent: both named"); + assert_eq!( + missing_inputs(None, None).len(), + 2, + "both absent: both named" + ); assert_eq!( missing_inputs(Some("my-bucket"), None), vec!["OSM_SLAB_CACHE_DIR (or RAILWAY_VOL)"] @@ -1057,7 +1072,10 @@ not-a-hash junk.txt "baden-wuerttemberg.chains" ] ); - assert!(artifacts("bw")[0].ends_with(".soa"), "slab stays at index 0"); + assert!( + artifacts("bw")[0].ends_with(".soa"), + "slab stays at index 0" + ); assert_eq!(default_prefix("berlin"), "q2/bakes/berlin-v1"); assert_eq!( default_prefix("baden-wuerttemberg"), @@ -1071,12 +1089,7 @@ not-a-hash junk.txt /// Geofabrik region name takes are all accepted. #[test] fn region_validation_rejects_traversal_and_accepts_real_names() { - for good in [ - "berlin", - "baden-wuerttemberg", - "nordrhein-westfalen", - "bw2", - ] { + for good in ["berlin", "baden-wuerttemberg", "nordrhein-westfalen", "bw2"] { assert!(is_valid_region(good), "{good} is a legitimate region name"); } for bad in [ diff --git a/crates/cockpit-server/src/osm_tiles.rs b/crates/cockpit-server/src/osm_tiles.rs index ca8f6b288..bc74e8c73 100644 --- a/crates/cockpit-server/src/osm_tiles.rs +++ b/crates/cockpit-server/src/osm_tiles.rs @@ -19,8 +19,8 @@ //! return the tile **address + source URL + HHTL key**; a client fetches the //! raster from the source. Pure math, fully unit-tested. -use axum::extract::{Path, Query}; use axum::Json; +use axum::extract::{Path, Query}; use serde::Deserialize; /// The canonical OSM raster-tile source (standard slippy-map template). This is @@ -268,7 +268,13 @@ mod tests { #[test] fn morton_roundtrips() { - for &(x, y) in &[(0u32, 0u32), (1, 0), (0, 1), (12345, 67890), (0xFFFFFF, 0xFFFFFF)] { + for &(x, y) in &[ + (0u32, 0u32), + (1, 0), + (0, 1), + (12345, 67890), + (0xFFFFFF, 0xFFFFFF), + ] { assert_eq!(morton_deinterleave(morton_interleave(x, y)), (x, y)); } } @@ -356,7 +362,11 @@ mod tests { for (name, lon, lat) in [ ("Berlin", 13.404954, 52.520008), ("Reykjavik", -21.940022, 64.146575), - ("Sydney (southern — exercises the TMS Y-flip)", 151.2093, -33.8688), + ( + "Sydney (southern — exercises the TMS Y-flip)", + 151.2093, + -33.8688, + ), ] { let (_code, want) = osm_soa_bake::tms::point_to_tiers(lon, lat); let (x, y) = lonlat_to_tile(lon, lat, HHTL_DEPTH); diff --git a/crates/cockpit-server/src/pgx.rs b/crates/cockpit-server/src/pgx.rs index b91d50331..7a00dfe4c 100644 --- a/crates/cockpit-server/src/pgx.rs +++ b/crates/cockpit-server/src/pgx.rs @@ -15,7 +15,7 @@ use std::sync::LazyLock; -use cpic::{reason, Catalog, Kb, Outcome}; +use cpic::{Catalog, Kb, Outcome, reason}; /// The CPIC knowledge base, parsed once from the tables baked into the binary /// (`include_str!` of `cpic/data/*.json`). No runtime files; safe on a fresh container. diff --git a/crates/cockpit-server/src/scene_player.rs b/crates/cockpit-server/src/scene_player.rs index 4fa5f6ade..d47e2466d 100644 --- a/crates/cockpit-server/src/scene_player.rs +++ b/crates/cockpit-server/src/scene_player.rs @@ -75,7 +75,11 @@ pub fn discover_acts(dir: &str) -> Vec { let name = p.file_stem()?.to_string_lossy().into_owned(); let cypher_text = std::fs::read_to_string(&p).ok()?; let confidence = confidence_from_name(&name); - Some(SceneAct { name, cypher_text, confidence }) + Some(SceneAct { + name, + cypher_text, + confidence, + }) } else { None } @@ -311,8 +315,10 @@ fn collect_from_property_value(pv: &PropertyValue, out: &mut Vec) { } PropertyValue::Parameter(name) => out.push(name.clone()), PropertyValue::Property(p) => collect_from_property_ref(p, out), - PropertyValue::Integer(_) | PropertyValue::Float(_) - | PropertyValue::Boolean(_) | PropertyValue::Null => {} + PropertyValue::Integer(_) + | PropertyValue::Float(_) + | PropertyValue::Boolean(_) + | PropertyValue::Null => {} } } @@ -388,13 +394,47 @@ fn is_valid_identifier(s: &str) -> bool { fn is_cypher_keyword(s: &str) -> bool { matches!( s.to_ascii_uppercase().as_str(), - "MATCH" | "WHERE" | "RETURN" | "WITH" | "AND" | "OR" | "NOT" - | "AS" | "ORDER" | "BY" | "LIMIT" | "SKIP" | "UNWIND" | "MERGE" - | "CREATE" | "DELETE" | "DETACH" | "SET" | "REMOVE" | "OPTIONAL" - | "DISTINCT" | "TRUE" | "FALSE" | "NULL" | "IS" | "IN" - | "STARTS" | "ENDS" | "CONTAINS" | "EXISTS" | "ASC" | "DESC" - | "CASE" | "WHEN" | "THEN" | "ELSE" | "END" | "CALL" | "YIELD" - | "LIKE" | "ILIKE" + "MATCH" + | "WHERE" + | "RETURN" + | "WITH" + | "AND" + | "OR" + | "NOT" + | "AS" + | "ORDER" + | "BY" + | "LIMIT" + | "SKIP" + | "UNWIND" + | "MERGE" + | "CREATE" + | "DELETE" + | "DETACH" + | "SET" + | "REMOVE" + | "OPTIONAL" + | "DISTINCT" + | "TRUE" + | "FALSE" + | "NULL" + | "IS" + | "IN" + | "STARTS" + | "ENDS" + | "CONTAINS" + | "EXISTS" + | "ASC" + | "DESC" + | "CASE" + | "WHEN" + | "THEN" + | "ELSE" + | "END" + | "CALL" + | "YIELD" + | "LIKE" + | "ILIKE" ) } @@ -448,8 +488,14 @@ mod tests { #[test] fn stable_hash_is_case_insensitive() { - assert_eq!(stable_codebook_index("Person"), stable_codebook_index("person")); - assert_eq!(stable_codebook_index("KNOWS"), stable_codebook_index("knows")); + assert_eq!( + stable_codebook_index("Person"), + stable_codebook_index("person") + ); + assert_eq!( + stable_codebook_index("KNOWS"), + stable_codebook_index("knows") + ); } #[test] @@ -458,7 +504,10 @@ mod tests { let stream = cypher_to_stream(cypher, 12345); assert_eq!(stream.source, "AriGraph"); assert_eq!(stream.timestamp, 12345); - assert!(!stream.codebook_indices.is_empty(), "expected indices for Person/KNOWS/City/age/name"); + assert!( + !stream.codebook_indices.is_empty(), + "expected indices for Person/KNOWS/City/age/name" + ); // All indices in range. for idx in &stream.codebook_indices { assert!((*idx as u32) < CODEBOOK_SIZE); @@ -477,8 +526,16 @@ mod tests { let stream = cypher_to_stream(bad, 99); assert_eq!(stream.source, "AriGraph"); assert!(!stream.codebook_indices.is_empty()); - assert!(stream.codebook_indices.contains(&stable_codebook_index("Person"))); - assert!(stream.codebook_indices.contains(&stable_codebook_index("City"))); + assert!( + stream + .codebook_indices + .contains(&stable_codebook_index("Person")) + ); + assert!( + stream + .codebook_indices + .contains(&stable_codebook_index("City")) + ); } #[test] @@ -487,7 +544,11 @@ mod tests { let cypher = "MATCH (a:Foo)-[:R]->(b:Foo)-[:R]->(c:Foo) RETURN a, b, c"; let stream = cypher_to_stream(cypher, 1); let foo_idx = stable_codebook_index("Foo"); - let count = stream.codebook_indices.iter().filter(|i| **i == foo_idx).count(); + let count = stream + .codebook_indices + .iter() + .filter(|i| **i == foo_idx) + .count(); assert_eq!(count, 1, "Foo should appear exactly once after dedup"); } diff --git a/crates/cockpit-server/src/shader_stream.rs b/crates/cockpit-server/src/shader_stream.rs index e7ade7d1c..afd9da5f0 100644 --- a/crates/cockpit-server/src/shader_stream.rs +++ b/crates/cockpit-server/src/shader_stream.rs @@ -61,7 +61,9 @@ use lance_graph_contract::cognitive_shader::{ }; use lance_graph_contract::cycle_accumulator::{AccumulatorAction, CycleAccumulator}; -use crate::dto_bridge::{WireShaderBus, WireShaderCrystal, WireShaderDispatch, WireShaderResonance}; +use crate::dto_bridge::{ + WireShaderBus, WireShaderCrystal, WireShaderDispatch, WireShaderResonance, +}; use crate::mock_driver::MockShaderDriver; // ── Accumulator defaults (per Phase 3 plan) ────────────────────────────────── @@ -180,7 +182,11 @@ fn now_ms() -> u64 { // ── SSE event builder ───────────────────────────────────────────────────────── fn shader_event(kind: &'static str, payload: serde_json::Value) -> Event { - let ev = ShaderEvent { kind, ts: now_ms(), payload }; + let ev = ShaderEvent { + kind, + ts: now_ms(), + payload, + }; let json = serde_json::to_string(&ev).unwrap_or_default(); Event::default().data(json).event(kind) } diff --git a/crates/cockpit-server/src/style_state.rs b/crates/cockpit-server/src/style_state.rs index c1b0ef338..43e50f3c1 100644 --- a/crates/cockpit-server/src/style_state.rs +++ b/crates/cockpit-server/src/style_state.rs @@ -25,8 +25,7 @@ use std::sync::{LazyLock, Mutex}; use lance_graph_contract::cognitive_shader::{ShaderDispatch, StyleSelector}; use lance_graph_contract::thinking::ThinkingStyle; -static SELECTED: LazyLock> = - LazyLock::new(|| Mutex::new(StyleSelector::Auto)); +static SELECTED: LazyLock> = LazyLock::new(|| Mutex::new(StyleSelector::Auto)); /// Read the currently-selected `StyleSelector` (defaults to `Auto`). pub fn current_style() -> StyleSelector { diff --git a/crates/quarto-parse-errors/src/error_generation.rs b/crates/quarto-parse-errors/src/error_generation.rs index 33018df00..fe692b19a 100644 --- a/crates/quarto-parse-errors/src/error_generation.rs +++ b/crates/quarto-parse-errors/src/error_generation.rs @@ -608,7 +608,7 @@ pub fn prune_diagnostics_by_error_nodes( // For each ERROR node, keep only the earliest diagnostic (tiebreak with score) let mut kept_indices = Vec::new(); - for (_range_idx, diag_indices) in diagnostics_by_range.iter() { + for diag_indices in diagnostics_by_range.values() { if diag_indices.is_empty() { continue; } diff --git a/crates/quarto-sass/src/brand_layer.rs b/crates/quarto-sass/src/brand_layer.rs index a79e20755..a1ed3685d 100644 --- a/crates/quarto-sass/src/brand_layer.rs +++ b/crates/quarto-sass/src/brand_layer.rs @@ -175,7 +175,7 @@ fn bootstrap_defaults_layer(brand: &Brand) -> Result, SassErro // Bootstrap colors from palette (only when defaults.bootstrap is // set, matching Q1's guard). if let Some(palette) = brand.color.as_ref().and_then(|c| c.palette.as_ref()) { - for (key, _) in palette.iter() { + for key in palette.keys() { if !BOOTSTRAP_COLOR_NAMES.contains(&key.as_str()) { continue; } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 34e3064f7..f50942488 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -8,6 +8,6 @@ # actually fixing the underlying overflow. Pinning is the durable fix # until the upstream regression is resolved; bump the date when nightly # stabilizes again. -channel = "nightly-2026-04-28" +channel = "1.98.1" components = ["rust-src","rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"]