Skip to content

B2: IRIS-native backends for STDCRYPTO / STDCOMPRESS / STDHTTP#1

Closed
rafael5 wants to merge 2 commits into
masterfrom
iris-native-backends
Closed

B2: IRIS-native backends for STDCRYPTO / STDCOMPRESS / STDHTTP#1
rafael5 wants to merge 2 commits into
masterfrom
iris-native-backends

Conversation

@rafael5

@rafael5 rafael5 commented May 31, 2026

Copy link
Copy Markdown
Contributor

Add IRIS arms to the three optional modules behind a runtime engine-detect
seam, so each module's public API and *TST.m suites work identically on
YottaDB and IRIS. One .m per module — the IRIS arm is an else-branch in the
existing dispatch helper, never a second source file (architecture invariant).

Engine seam:

  • STDOS: new $$engine^STDOS() → "iris"/"ydb" via $ZVERSION["IRIS" (safe on
    both engines; never touches the YDB-only $ZYRELEASE).

Backends (YDB $&pkg.fn path unchanged; IRIS branch added ahead of it):

  • STDCRYPTO → $SYSTEM.Encryption.SHAHash / .HMACSHA (native; raw-byte digests
    identical to libcrypto; HMACSHA(bits,data,key) arg order verified vs RFC 4231).
  • STDHTTP → %Net.HttpRequest (native; Send/StatusCode/Data/Headers). respHeaders
    rebuilt as a status-line+headers block so request^STDHTTP parses both engines
    identically. Live success path smoke-tested (GET → 200/body/headers).
  • STDCOMPRESS → embedded Python: zlib (wbits 31 gzip / -15 raw deflate) + libzstd.so.1
    via ctypes (no zstd Python module ships, but the system .so does). M<->Python
    binary bridged latin-1 (codepoint==byte for 0..255).

Core-harness portability (required for the optional suites to run on IRIS):

  • STDASSERT.raises: $ZLEVEL+ZGOTO unwind is YDB-only ( on IRIS). Branch
    on an inlined $ZVERSION probe — IRIS wraps the XECUTE in ObjectScript
    try/catch (helper irisCapture), which unwinds any $$ depth and preserves $ECODE.
    YDB path unchanged. (Discovery logged.)
  • STDCOMPRESSTST: ported $ZCHAR/$ZASCII -> $CHAR/$ASCII (YDB-only intrinsics;
    byte-identical under YDB byte mode and on IRIS, no assertion weakened).
  • IRIS embedded-Python hangs through M $ETRAP -> the IRIS dispatch
    helpers use ObjectScript try/catch instead. (Discovery logged.)

Verification (via normal m test, no hand docker exec):

  • IRIS (vista-iris): 4 optional suites, 150 assertions, 0 failed
    (STDCRYPTOTST 23, STDCRYPTODOCTST 1, STDCOMPRESSTST 59, STDHTTPTST 67).
  • YDB core (m-test-engine, byte mode): 44 suites, 2414 assertions, 0 failed —
    no regression (STDASSERTTST 35/35, STDOSTST 30/30). YDB optional tier still
    awaits the engine-side callouts (follow-up B1).

Regenerated dist/ (STDOS gained engine()); module-tracker rows + 3 discoveries
entries updated in the same commit. fmt clean; lint 0 error-level.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Add IRIS arms to the three optional modules behind a runtime engine-detect
seam, so each module's public API and *TST.m suites work identically on
YottaDB and IRIS. One .m per module — the IRIS arm is an else-branch in the
existing dispatch helper, never a second source file (architecture invariant).

Engine seam:
- STDOS: new $$engine^STDOS() → "iris"/"ydb" via $ZVERSION["IRIS" (safe on
  both engines; never touches the YDB-only $ZYRELEASE).

Backends (YDB $&pkg.fn path unchanged; IRIS branch added ahead of it):
- STDCRYPTO  → $SYSTEM.Encryption.SHAHash / .HMACSHA (native; raw-byte digests
  identical to libcrypto; HMACSHA(bits,data,key) arg order verified vs RFC 4231).
- STDHTTP    → %Net.HttpRequest (native; Send/StatusCode/Data/Headers). respHeaders
  rebuilt as a status-line+headers block so request^STDHTTP parses both engines
  identically. Live success path smoke-tested (GET → 200/body/headers).
- STDCOMPRESS → embedded Python: zlib (wbits 31 gzip / -15 raw deflate) + libzstd.so.1
  via ctypes (no zstd Python module ships, but the system .so does). M<->Python
  binary bridged latin-1 (codepoint==byte for 0..255).

Core-harness portability (required for the optional suites to run on IRIS):
- STDASSERT.raises: $ZLEVEL+ZGOTO unwind is YDB-only (<SYNTAX> on IRIS). Branch
  on an inlined $ZVERSION probe — IRIS wraps the XECUTE in ObjectScript
  try/catch (helper irisCapture), which unwinds any $$ depth and preserves $ECODE.
  YDB path unchanged. (Discovery logged.)
- STDCOMPRESSTST: ported $ZCHAR/$ZASCII -> $CHAR/$ASCII (YDB-only intrinsics;
  byte-identical under YDB byte mode and on IRIS, no assertion weakened).
- IRIS embedded-Python <THROW> hangs through M $ETRAP -> the IRIS dispatch
  helpers use ObjectScript try/catch instead. (Discovery logged.)

Verification (via normal `m test`, no hand docker exec):
- IRIS (vista-iris): 4 optional suites, 150 assertions, 0 failed
  (STDCRYPTOTST 23, STDCRYPTODOCTST 1, STDCOMPRESSTST 59, STDHTTPTST 67).
- YDB core (m-test-engine, byte mode): 44 suites, 2414 assertions, 0 failed —
  no regression (STDASSERTTST 35/35, STDOSTST 30/30). YDB optional tier still
  awaits the engine-side callouts (follow-up B1).

Regenerated dist/ (STDOS gained engine()); module-tracker rows + 3 discoveries
entries updated in the same commit. fmt clean; lint 0 error-level.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rafael5 added a commit that referenced this pull request Jun 7, 2026
Extend the bridge-library architecture diagram (§6) with two real-world
consumer examples that exercise the STD*/VBL* seams in both directions:

- §6.1 Example app #1 — FHIR R4 façade: a generic third-party FHIR REST
  client (inbound, pull clinical data out) that reaches VistA strictly
  through the VWEB HTTPS endpoint, never into the M layers.
- §6.2 Example app #2 — VistA log streaming to AWS S3: outbound egress
  that binds the STDLOG sink seam to a VBLS3 adapter, shipping NDJSON logs
  (SigV4-signed via STDCRYPTO/STDHEX) to S3 instead of an ^XTMP global.
  Includes the why-VistA-barely-logs rationale (log globals grow inside
  the patient DB) and a level-separated Mermaid diagram showing the
  network/trust boundary crossing.

Both Mermaid diagrams validated. TOC updated with the new subsections.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reconciles the stale, conflicting PR #1 against current master. Keeps the
novel payload — IRIS-native backends for the three optional modules — and
drops everything master already provides.

Kept (rebased onto master):
- STDCRYPTO  → $SYSTEM.Encryption.SHAHash / .HMACSHA (IRIS) ahead of the
  YDB $&stdcrypto callout.
- STDHTTP    → %Net.HttpRequest (IRIS) ahead of the YDB $&stdhttp callout.
- STDCOMPRESS→ embedded-Python zlib + ctypes/zstd (IRIS) ahead of the YDB
  $&stdcompress callout.
- STDCOMPRESSTST: $ZCHAR/$ZASCII → $CHAR/$ASCII (IRIS has no $ZCHAR;
  byte-identical under ydb_chset=M — matches the rest of the byte suites).

Dropped (superseded by master's IRIS sweep):
- The PR's $$engine^STDOS() helper — master's STDOS is already IRIS-ported
  by inlining $zversion["IRIS" per function; the 3 backends now use that
  same inlined-probe idiom (6 dispatch call-sites) instead of a helper.
- The PR's STDASSERT irisCapture arm — master already has irisRaises (s9).

Verified dual-engine (m-test-engine + m-test-iris): STDCRYPTOTST 23/23 and
STDHTTPTST 67/67 green on IRIS as well as YDB; STDCRYPTODOCTST 1/1;
STDCOMPRESSTST 59/59 on YDB. STDCOMPRESS-IRIS needs working embedded Python
(the iris-community image lacks it — discoveries 2026-06-14); its logic is
the PR's vista-iris-validated code, unchanged but for the proven seam.

dist/ regenerated; module-tracker + discoveries + memory updated;
make manifest-check / check-manifest / arch check (layer m) all clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rafael5

rafael5 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #11. This branch predated the s9–s12 IRIS sweep on master and could not be rebased/merged in place. #11 carries the identical reconciled change off current master (the $$engine^STDOS() helper and the STDASSERT irisCapture arm were dropped as superseded; the 3 backends now use master's inlined $zversion["IRIS" idiom). Closing in favor of #11.

@rafael5 rafael5 closed this Jun 14, 2026
rafael5 added a commit that referenced this pull request Jun 14, 2026
…ciled) (#11)

* B2: IRIS-native backends for STDCRYPTO / STDCOMPRESS / STDHTTP

Reconciliation of PR #1 onto current master (the s9–s12 IRIS sweep).
Supersedes the stale `iris-native-backends` branch, which could not be
rebased/merged in-place (sandbox denies merge/rebase/force-push); this
branch carries the identical net change off current master so the diff
and merge are clean.

Adds an IRIS dispatch arm to each optional module behind the inlined
`$zversion["IRIS"` probe (master's runtime idiom — not a public engine
helper), ahead of the YDB `$&pkg.fn` callout path:
- STDCRYPTO   → $SYSTEM.Encryption.SHAHash / .HMACSHA
- STDHTTP     → %Net.HttpRequest
- STDCOMPRESS → embedded-Python zlib + ctypes/zstd
- STDCOMPRESSTST: $ZCHAR/$ZASCII → $CHAR/$ASCII (IRIS has no $ZCHAR;
  byte-identical under ydb_chset=M — matches the rest of the byte suites).

Dropped vs the original PR (superseded by master): the $$engine^STDOS()
helper (master's STDOS already inlines the probe) and the STDASSERT
irisCapture arm (master already has irisRaises, s9).

Verified dual-engine (m-test-engine + m-test-iris): STDCRYPTOTST 23/23 and
STDHTTPTST 67/67 green on IRIS as well as YDB; STDCRYPTODOCTST 1/1;
STDCOMPRESSTST 59/59 on YDB. STDCOMPRESS-IRIS needs working embedded Python
(the iris-community image lacks it — discoveries 2026-06-14); its logic is
the PR's vista-iris-validated code, unchanged but for the proven seam.

dist/ regenerated; module-tracker + discoveries + memory updated;
make manifest-check / check-manifest / arch check (layer m) all clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(STDCOMPRESS): drop ^|| memo — tree-sitter-m can't parse it (CI fmt gate)

CI's pinned tree-sitter-m emits 2 ERROR nodes on the two `^||STDCOMPRESS("py")`
process-private-global references in irisInit, failing `m fmt --check` (the
local Go m's newer grammar parses them, hence the miss). master uses no `^||`.

irisInit now re-execs the embedded-Python defs per call instead of memoizing:
idempotent and cheap (ctypes.CDLL refcounts the already-loaded .so; redefining
the helpers is free). IRIS-only path; YDB STDCOMPRESSTST still 59/59. Logged
in discoveries (tree-sitter-m lane: add `^||` to the grammar).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rafael5 rafael5 deleted the iris-native-backends branch June 14, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant