Skip to content

fix(namespace): omitted namespace resolves to the connection namespace, never a hardcoded USER (fixes #96) - #101

Open
PYDuquesnoy wants to merge 1 commit into
intersystems-community:masterfrom
PYDuquesnoy:fix/namespace-resolution
Open

fix(namespace): omitted namespace resolves to the connection namespace, never a hardcoded USER (fixes #96)#101
PYDuquesnoy wants to merge 1 commit into
intersystems-community:masterfrom
PYDuquesnoy:fix/namespace-resolution

Conversation

@PYDuquesnoy

Copy link
Copy Markdown
Collaborator

Fixes #96 — with the server configured for IRIS_NAMESPACE=<ns>, any call omitting the per-call namespace ran in USER: silently, with plausible results from the wrong database. The serde default default_namespace() → "USER" sat on ~25 param structs across six files and outranked both the connection config and the 072 pool member's namespace.

What

  • namespace params become Option<String>; the six default_namespace fns are deleted — the type change let the compiler enumerate every use site, which is how all ~25 structs were found.
  • One shared resolve_namespace(param, connection_ns) (in tools/mod.rs; observability.rs now reuses it instead of its private copy): explicit non-empty param wins → else the namespace of the connection the call actually uses — for server-routed calls that's the pool member's configured namespace.
  • Responses that echo namespace now echo the resolved value; tool descriptions updated.
  • Tests pin the new contract (omitted ⇒ None + resolution to connection ns; explicit ⇒ Some).

Verification

cargo test --workspace: 3866 passed / 0 failed. Live stdio probe with IRIS_NAMESPACE=APP against IRIS 2026.1:

call (no namespace arg) v1.0.0 this PR
iris_execute WRITE $NAMESPACE USER APP
iris_query SELECT 1 ran in USER "namespace":"APP" echoed

(From the intersystems-ib interop fork team — the same fix shipped there as intersystems-ib/iris-interop-dev#16 after 3/3 graded agent sessions reproduced the silent wrong-namespace behavior. Companion to #100; from the same audit as #92/#97#99.)

🤖 Generated with Claude Code

…e, never a hardcoded USER (fixes intersystems-community#96)

Omitting the optional per-call namespace ran the call in USER regardless
of the server's configured IRIS_NAMESPACE — silently, with plausible
results from the wrong database. Root cause: a serde default
`default_namespace() -> "USER"` duplicated across six files on ~25 param
structs, applied before any connection logic could weigh in; the pool
member's namespace (072) was overridden the same way.

- namespace params become Option<String>; the six default_namespace fns
  are deleted. The type change let the compiler enumerate every use site.
- one shared resolve_namespace(param, connection_ns) in tools/mod.rs
  (observability.rs reuses it): explicit non-empty param wins, else the
  namespace of the connection THE CALL ACTUALLY USES — for server-routed
  calls that is the pool member's configured namespace, not the default
  connection's.
- responses that echo namespace now echo the resolved value; tool
  descriptions updated ("defaults to the connection namespace").
- tests pin the new contract: omitted => None + resolves to the
  connection namespace, explicit => Some(...).

Verified: cargo test --workspace 3866 passed / 0 failed; live stdio probe
with IRIS_NAMESPACE=APP: iris_execute WRITE $NAMESPACE with no namespace
arg -> "APP" (v1.0.0: "USER"), iris_query echoes namespace:"APP".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant