Skip to content

Conversation

@vyavdoshenko
Copy link
Contributor

@vyavdoshenko vyavdoshenko commented Oct 31, 2025

Fixes 4 failing integration tests.

What was broken:

  • Tests failed on missing @search ACL category
  • FT._DEBUG command not implemented

Results:
Before: 48 failed / 22 passed
After: 44 failed / 26 passed (+4 tests fixed)

Copy link
Contributor

@dranikpg dranikpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need anything except ACL fixes just for the sake of being there

@vyavdoshenko vyavdoshenko requested a review from dranikpg November 2, 2025 13:02
if (parser.Check("CONTROLLED_VARIABLE")) {
if (parser.Check("SET")) {
// Consume variable name and value
if (parser.HasNext())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these optional? if not please change the code to be more strict.
@BorysTheDev can you help with the advice on how to improve parsing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked Valkey search code.

 if (keyword == "SHOW_INFO") {
    return vmsdk::info_field::ShowInfo(ctx, itr, options);
  } else if (keyword == "PAUSEPOINT") {
    return PausePointControlCmd(ctx, itr);
  } else if (keyword == "CONTROLLED_VARIABLE") {
    return ControlledCmd(ctx, itr);
  } else if (keyword == "HELP") {
    return HelpCmd(ctx, itr);
  } else {
    return absl::InvalidArgumentError(absl::StrCat(
        "Unknown subcommand: ", *itr.GetStringView(), " try HELP subcommand"));
  }
absl::Status ControlledCmd(ValkeyModuleCtx *ctx, vmsdk::ArgsIterator &itr) {
  std::string keyword;
  VMSDK_RETURN_IF_ERROR(vmsdk::ParseParamValue(itr, keyword));
  keyword = absl::AsciiStrToUpper(keyword);
  if (keyword == "LIST") {
    VMSDK_RETURN_IF_ERROR(CheckEndOfArgs(itr));
    auto results = vmsdk::debug::ControlledGetValues();
    ValkeyModule_ReplyWithArray(ctx, 2 * results.size());
    for (auto &r : results) {
      ValkeyModule_ReplyWithCString(ctx, r.first.data());
      ValkeyModule_ReplyWithCString(ctx, r.second.data());
    }
    return absl::OkStatus();
  }
  std::string test_control_name;
  std::string value;
  VMSDK_RETURN_IF_ERROR(vmsdk::ParseParamValue(itr, test_control_name));
  if (keyword == "GET") {
    VMSDK_ASSIGN_OR_RETURN(value,
                           vmsdk::debug::ControlledGet(test_control_name));
    VMSDK_RETURN_IF_ERROR(CheckEndOfArgs(itr));
    ValkeyModule_ReplyWithCString(ctx, value.data());
  } else if (keyword == "SET") {
    VMSDK_RETURN_IF_ERROR(vmsdk::ParseParamValue(itr, value));
    VMSDK_RETURN_IF_ERROR(CheckEndOfArgs(itr));
    VMSDK_RETURN_IF_ERROR(
        vmsdk::debug::ControlledSet(test_control_name, value));
    ValkeyModule_ReplyWithSimpleString(ctx, "OK");
  } else {
    ValkeyModule_ReplyWithError(
        ctx, absl::StrCat("Unknown keyword", keyword).data());
  }
  return absl::OkStatus();
}

So I think we can do the next:

auto cmd = parser.MapNext("HELP", &HelpCmd, "CONTROLLED_VARIABLE", &ControlledCmd,...);
if (parser.TakeError()) {
  rb.sendError()
}
return cmd(...);
}

void ControlledCmd(...) {
  auto action = parser.MapNext("SET", SET, "GET", GET ...)
    switch (action) {
        case SET: 
          parser.Next();
          break:
        case GET:
          ....
    }
    if (parser.TakeError()) {
       rb.sendError()
     }
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, this approach adds more bolerplate. I suggest leave the current approach, I guess we will update this command soon fixing failed tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok please add error checking

Copy link
Collaborator

@romange romange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@romange
Copy link
Collaborator

romange commented Nov 5, 2025

we are not implementing the command, so not need for this boilerplate. I think checking parser for errors is important, also just consume the tokens that must be present.

@vyavdoshenko
Copy link
Contributor Author

we are not implementing the command, so not need for this boilerplate. I think checking parser for errors is important, also just consume the tokens that must be present.

Added more strict check.

@vyavdoshenko vyavdoshenko requested a review from romange November 5, 2025 12:02
@vyavdoshenko vyavdoshenko merged commit 23fb0fa into main Nov 5, 2025
10 checks passed
@vyavdoshenko vyavdoshenko deleted the bobik/integration_tests_update branch November 5, 2025 13:57
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.

5 participants