Skip to content

Split list-form tags in start_server, tags and test - #244

Open
madolson wants to merge 1 commit into
unstablefrom
fix-start-server-list-tags
Open

madolson wants to merge 1 commit into
unstablefrom
fix-start-server-list-tags

Conversation

@madolson

@madolson madolson commented Dec 5, 2026

Copy link
Copy Markdown
Owner

start_server {tags {"a b"}} gives two tags, but start_server [list tags [list "a b"]] gives one tag named a b. The parser only strips double quotes, and the braces list adds survive. So a block tagged [list "x external:skip"] is not skipped on an external server, and CONFIG SET of an immutable override like aclfile kills the whole test client. The tags and test procs have the same trap. This flattens the parsed list in all three, so every form gives the same tags.

AI generated details

Problem

tests/support/server.tcl:526 (start_server) and server.tcl:311 (tags proc) do set tags [string map { \" "" } $value]. {"repl external:skip"} becomes repl external:skip, two elements. [list "acl external:skip"] has the string form {acl external:skip}, one element. tags_acceptable (server.tcl:249) does lsearch -exact $tags external:skip, which misses it, so run_external_server_test (server.tcl:420) applies every override with CONFIG SET. test (tests/support/test.tcl:282) takes its tags argument as a list with no processing, so both {"a b"} and [list "a b"] are one tag there.

Seen on #243 in test-external-cluster (https://github.com/madolson/valkey/actions/runs/47453062514/job/145459502181):

[exception]: Executing test client: ERR CONFIG SET failed (possibly related to argument 'aclfile') - can't set immutable config.

The quote stripping dates from 677d14c ("test infra - improve test skipping ability").

Fix

concat {*} the result in all three places. {"a b"}, {a b}, [list a b] and [list "a b"] all give a b.

Existing tags that change

One tag in the tree is a single multi-word tag today: tests/unit/moduleapi/usercall.tcl:189, tags [list "modules usercall external:skip"] (added in valkey-io#3967, first released in 9.2.0). It now becomes three tags, so the block is skipped on an external server and by --tags -modules / --tags -usercall. CI never runs moduleapi tests against an external server, so no CI job changes. Every other tags [list ...] in tests/ already uses one word per element.

Alternative considered

Fixing the callers to use {"x external:skip"} instead of [list ...]. That is what #243 did, and it leaves the next [list "a b"] to fail the same way. The block cannot use the brace form whenever the tags come from a variable.

Testing

No test in the suite, since this is the test framework. Scratch file run against an external server (./src/valkey-server --port 21111 --save "" --daemonize yes, then ./runtest --host 127.0.0.1 --port 21111 --single unit/zz-repro):

start_server [list overrides [list aclfile /nonexistent.acl] tags [list "x external:skip"]] {
    test {list-form start_server external:skip block} { fail "should have been skipped" }
}
start_server {tags {"y"}} {
    tags [list "z external:skip"] {
        test {list-form tags proc external:skip block} { fail "should have been skipped" }
    }
    test {list-form test tag external:skip} { fail "should have been skipped" } {} [list "w external:skip"]
    test {quoted test tag external:skip} { fail "should have been skipped" } {} {"w external:skip"}
    test {sentinel runs} { set _ ok } {ok}
}

Base, first block:

[exception]: Executing test client: ERR CONFIG SET failed (possibly related to argument 'aclfile') - can't set immutable config.

Base, the rest with the first block removed:

[err]: list-form tags proc external:skip block in tests/unit/zz-repro2.tcl
[err]: list-form test tag external:skip in tests/unit/zz-repro2.tcl
[err]: quoted test tag external:skip in tests/unit/zz-repro2.tcl
[ok]: sentinel runs (0 ms)

With the fix:

[ignore]: Not supported on external server
[ignore]: Not supported on external server
[ignore]: list-form test tag external:skip: Not supported on external server
[ignore]: quoted test tag external:skip: Not supported on external server
[ok]: sentinel runs (0 ms)

./runtest --moduleapi --host 127.0.0.1 --port 21111 --single unit/moduleapi/usercall on base dies at the line 189 block with ERR CONFIG SET failed (possibly related to argument 'dir') - can't set protected config. With the fix it is skipped.

Filtering, base against fix, over every existing form ({"network qb"}, {network qb}, [list network qb], "network", tags {"qa"}, tags {qa qb}, test tag {qa qb} and {"qa"}) plus [list "network qb"], under no filter, --tags network, --tags -qb, --tags -qa, --tags -qc and --tags network --tags -qb. Output is identical except for the [list "network qb"] block: base drops it under --tags network and runs it under --tags -qb; with the fix it runs under --tags network and is denied under --tags -qb.

This was generated by AI but verified, with love, by a human.

start_server and the tags proc strip double quotes from the tags value
and use what is left as the tag list. That splits {"repl external:skip"}
into two tags, but [list "acl external:skip"] has the string form
{acl external:skip}, whose braces survive, so it stays one tag named
"acl external:skip". tags_acceptable never sees external:skip, the block
runs against the external server, and CONFIG SET of an immutable
override such as aclfile throws, killing the whole test client. The test
proc has the same problem for both forms, since it does not strip quotes
at all.

Flatten the parsed list one level in all three places, so {"a b"},
{a b}, [list a b] and [list "a b"] all yield the same two tags.

usercall.tcl tags its role block [list "modules usercall external:skip"],
which is a single tag today. It is now skipped on an external server as
intended.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
@madolson madolson added the needs-review Staged work waiting on madolson's review label Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Staged work waiting on madolson's review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant