41f2d4c0f2
rust / build / test / clippy / fmt (push) Has been cancelled
New module crates/mxaccess-galaxy/src/sql_resolver.rs (~480 LoC) gated behind the existing galaxy-resolver Cargo feature. Adds SqlTagResolver + SqlUserResolver, both constructed via from_ado_string(&str) accepting the same connection-string shape the .NET reference uses by default (Server=localhost;Database=ZB;Integrated Security=True; Encrypt=False;TrustServerCertificate=True). Integrated Security=True resolves to Windows auth via tiberius's winauth feature. Each top-level call (resolve / browse / resolve_by_guid / resolve_by_name) opens a fresh Client<Compat<TcpStream>> and drops it on return — matches the .NET `await using` lifecycle at GalaxyRepositoryTagResolver.cs:93-95. tiberius's Client::query only accepts positional @P1..@PN placeholders (delegates to sp_executesql); the canonical RESOLVE_SQL / BROWSE_SQL / USER_BY_GUID_SQL / USER_BY_NAME_SQL constants are rewritten once-per-process via OnceLock<String> (@objectTagName → @P1, etc.). The unrewritten constants stay byte-identical with the .NET reference for ad-hoc diagnostic copy/paste. read_metadata mirrors ReadMetadata (cs:149-165) byte-by-byte: signed smallint → i16 widened to u16 for platform/engine/object IDs (matches the .NET checked((ushort)reader.GetInt16(N)) shape), int → i32 checked-cast to i16 for property_id, nullable nvarchar for primitive_name. read_user_profile mirrors ReadProfile (cs:76-85) including the roles_text blob → parse_role_blob round-trip. Deps added (gated): tiberius 0.12 (default-features = false; tds73 + rustls + winauth — no chrono / rust_decimal pulled), tokio-util's compat feature for the futures-rs ↔ tokio AsyncRead bridge, futures-util for TryStreamExt::try_next. Default-feature build still pulls only mxaccess-codec + async-trait + thiserror + uuid (slim foot-print preserved per the design doc's intent). New `live` feature on this crate (`live = ["galaxy-resolver"]`) for parity with the workspace pattern. 11 offline unit tests pin: SQL named→positional rewriting (no @named left, @P1/@P2/@P3 present), line-count preserved, ado-string acceptance (default Galaxy shape parses, garbage rejected), input validation (max_rows=0 rejected, empty LIKE rejected, empty user_name rejected, all checked before connect attempt). Two #[cfg(feature = "live")] #[ignore]'d tests round-trip against a real Galaxy DB (gated on MX_LIVE + MX_GALAXY_DB env vars per tools/Setup-LiveProbeEnv.ps1). Live verification on this host: live_resolve_test_child_object_test_int and live_browse_test_child_object both pass against the local AVEVA install — TestChildObject.TestInt resolves with mx_data_type=2 (Int32), is_array=false. Closes F14 in design/followups.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
45 lines
1.8 KiB
TOML
45 lines
1.8 KiB
TOML
[package]
|
|
name = "mxaccess-galaxy"
|
|
description = "Galaxy Repository SQL resolver: tag → metadata, user → identity. Resolves tag_name-form input only (see design/30-crate-topology.md)."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
rust-version.workspace = true
|
|
authors.workspace = true
|
|
|
|
[dependencies]
|
|
mxaccess-codec = { path = "../mxaccess-codec" }
|
|
async-trait = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
uuid = "1"
|
|
|
|
# F14 — tiberius-backed SQL resolver. Optional, gated by `galaxy-resolver`
|
|
# so the default footprint stays slim (no TDS / TLS / winauth pulled when
|
|
# consumers plug their own Resolver impl). tokio-util's `compat` feature
|
|
# bridges `tokio::net::TcpStream` to the futures-rs AsyncRead/Write that
|
|
# tiberius expects. `futures-util::TryStreamExt` is needed to drain the
|
|
# QueryStream rows.
|
|
tiberius = { version = "0.12", default-features = false, features = ["tds73", "rustls", "winauth"], optional = true }
|
|
tokio = { workspace = true, optional = true }
|
|
tokio-util = { version = "0.7", features = ["compat"], optional = true }
|
|
futures-util = { workspace = true, optional = true }
|
|
|
|
[dev-dependencies]
|
|
tokio = { workspace = true }
|
|
|
|
[features]
|
|
default = []
|
|
# `galaxy-resolver` (off by default in M0) pulls `tiberius`. Consumers using a
|
|
# custom `Resolver` impl leave it off and avoid pulling TDS / native-tls /
|
|
# winauth. Per design/30-crate-topology.md `mxaccess-galaxy` section.
|
|
galaxy-resolver = ["dep:tiberius", "dep:tokio", "dep:tokio-util", "dep:futures-util"]
|
|
# Enables live integration tests that hit a real SQL Server (typically the
|
|
# Galaxy DB on the local AVEVA install). Driven by `MX_LIVE` + `MX_GALAXY_DB`
|
|
# env vars, populated by `tools/Setup-LiveProbeEnv.ps1`.
|
|
live = ["galaxy-resolver"]
|
|
auth-windows = []
|
|
|
|
[lints]
|
|
workspace = true
|