engine: add --chset flag for byte (M) mode on m test/coverage/watch#2
Merged
Conversation
Byte-oriented m-stdlib suites (STDCSPRNG, STDB64, STDHEX, STDJSON UTF-8
decode) assume one M character == one byte. On YottaDB the m-test-engine
container defaults to ydb_chset=UTF-8, under which byte ops like
$ZCHAR(200) raise %YDB-E-BADCHAR — aborting STDCSPRNGTST (0/0) even
though the library is correct under byte mode.
Add an engine-neutral --chset m|utf-8 flag, threaded through
engine.Options.Chset. The YDB-vs-IRIS difference stays in the engine
adapter (its documented role):
- YDB: prepend `env ydb_chset=<M|UTF-8>` to the invocation argv. Works
for both LocalRunner and DockerRunner (overrides the container
profile default) without widening the Runner seam.
- IRIS: no-op. Byte mode is inherent — a Unicode IRIS instance
round-trips all 256 byte values in-memory and has no ydb_chset
analog. The flag is accepted only to keep the CLI uniform.
Unset (the default) leaves argv untouched, so existing UTF-8 runs are
unchanged.
Verified (YDB m-test-engine / IRIS vista-iris, via the normal m test
path, no hand docker exec):
- YDB core suite under --chset m: 44 suites, 2414 assertions, 0 failed;
STDCSPRNGTST 406/406 green.
- Regression: same suite without the flag → STDCSPRNGTST 0/0 (default
behavior unchanged).
- IRIS STDHEXTST 49/49 identical with and without --chset m (no-op).
Rebased onto post-T0.1 main: internal/engine adapters were unchanged, so
the only conflict was the testCmd struct (kept both --resident and
--chset fields); all engine.New call sites still thread Chset, and the
resident-harness path reuses the same constructed engine. Fixed an
errcheck finding in the new IRIS chset test under the current lint config.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Establish m-cli's per-repo docs/memory/ (org memory rule). Capture the durable fact: running m-stdlib byte suites (STDCSPRNG/STDB64/STDHEX) via m test needs --chset m on YDB; default UTF-8 aborts them; IRIS no-op. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c3d8a69 to
7ea7edf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an engine-neutral
--chset m|utf-8flag tom test,m coverage, andm watch --run, threaded throughengine.Options.Chset. This lets byte-oriented suites (e.g. m-stdlib'sSTDCSPRNG,STDB64,STDHEX,STDJSONUTF-8 decode) run the engine in byte (M) mode, where one M character == one byte.Why
m-stdlib is byte-oriented and is only correct under
ydb_chset=M. The sharedm-test-engine(YottaDB) runsydb_chset=UTF-8by default, where byte values > 127 re-encode ($ZCHAR(200,201,202)→%YDB-E-BADCHAR). That abortedSTDCSPRNGTST(reported 0/0), the lone non-green suite in an otherwise fully-green core.How
internal/engine/ydb.go):cmd()prependsenv ydb_chset=<M|UTF-8>to the argv. Works for both LocalRunner and DockerRunner (overrides the container profile default insidebash -lc) with no Runner-signature change. Mapping inengine.goydbChset():m→M,utf-8→UTF-8,""→unset (no prefix = current behavior).internal/engine/iris.go): no-op. Byte mode is inherent (IRIS round-trips all 256 byte values in-memory; no process-wideydb_chsetanalog). Flag accepted only for a uniform CLI.No regression: with the flag unset, behavior is identical to before.
Verification
Via the normal
m testpath (no handdocker exec), against the runningm-test-enginecontainer:--chset m): 44 suites, 2414 assertions, 0 failed;STDCSPRNGTST406/406 green; no failed suites.STDCSPRNGTST0/0 →TESTS_FAILED(exit 3) — default unchanged.internal/enginegreen incl. newTestYdbChset/TestIrisChset; gofmt clean.Closes Stage A of the m-stdlib follow-up tracker.
🤖 Generated with Claude Code