Skip to content

reckless: test step doesn't work for plugins using cln-plugin #8764

@daywalker90

Description

@daywalker90

This part in tools/reckless _install_plugin does not seem to work for rust plugins:

test = run([Path(staged_src.source_loc).joinpath(staged_src.entry)],
                   cwd=str(staging_path), stdout=PIPE, stderr=PIPE,
                   text=True, timeout=10)
{
     "result": [
        null
     ],
     "log": [
        "DEBUG: Searching for summars",
        "DEBUG: InstInfo(summars, /home/runner/work/plugins/plugins, None, Cargo.toml, Cargo.toml, summars), Source.LOCAL_REPO",
        "INFO: found summars in source: /home/runner/work/plugins/plugins",
        "DEBUG: entry: Cargo.toml",
        "DEBUG: sub-directory: summars",
        "DEBUG: Retrieving summars from /home/runner/work/plugins/plugins",
        "DEBUG: Install requested from InstInfo(summars, /home/runner/work/plugins/plugins, None, Cargo.toml, Cargo.toml, summars).",
        "INFO: cloning Source.LOCAL_REPO InstInfo(summars, /home/runner/work/plugins/plugins, None, Cargo.toml, Cargo.toml, summars)",
        "DEBUG: cloned_src: InstInfo(summars, /tmp/reckless-095512175hgd_mrx8/clone, None, Cargo.toml, Cargo.toml, summars/summars)",
        "DEBUG: using latest commit of default branch",
        "DEBUG: checked out HEAD: 75da2a02de17526e701d8a1454489a71d3e3e062",
        "DEBUG: using installer rust",
        "DEBUG: creating /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars",
        "DEBUG: creating /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars/source",
        "DEBUG: copying /tmp/reckless-095512175hgd_mrx8/clone/summars/summars tree to /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars/source/summars",
        "DEBUG: linking source /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars/source/summars/Cargo.toml to /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars/Cargo.toml",
        "DEBUG: InstInfo(summars, /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars, None, Cargo.toml, Cargo.toml, source/summars)",
        "DEBUG: cargo installing from /tmp/ltests-l_2xm2pn/test_plugin_install_raw_1/lightning-1/reckless/summars/source/summars",
        "DEBUG: rust project compiled successfully",
        "DEBUG: plugin testing error:",
        "DEBUG:   Error: Lost connection to lightning expecting getmanifest",
        "ERROR: plugin testing failed",
        "WARNING: summars: installation aborted"
     ]
  }

The error message Error: Lost connection to lightning expecting getmanifest is from the cln-plugin lib and is only triggered if the input stream gets closed:

match input.next().await {
            Some(Ok(messages::JsonRpc::Request(id, messages::Request::Getmanifest(m)))) => {
                output
                    .lock()
                    .await
                    .send(json!({
                        "jsonrpc": "2.0",
                        "result": self.handle_get_manifest(m),
                        "id": id,
                    }))
                    .await?
            }
            Some(o) => return Err(anyhow!("Got unexpected message {:?} from lightningd", o)),
            None => {
                return Err(anyhow!(
                    "Lost connection to lightning expecting getmanifest"
                ))
            }
        };

LLM says subprocess.run immediately closes it to reattach itself or something and i think that is the case.

If i run the plugin directly in the terminal it just hangs as expected, waiting for the manifest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions