kernelci / kernelci/kernelci-core

Use a path string instead of a string list to encode Node paths

Open
#2,462 1 comment 0 reactions 1 assignee Claimed by @r-c-n View on GitHub
Dominant language
Python
Stars
120
Forks
107
Avg merge
1d 2h
Merged PRs (30d)
21

Description

Currently, all Nodes have a path field that encodes the path to that node from a root node (in practice, a checkout node) as a list of strings. I don't know the reason to pick a list to encode a path, but there are certain shortcomings that come with it, the most important of which is that it severely handicaps the way it can be used in queries. That is, we can't search for nodes with a certain string in their paths because we can't express that kind of condition (match an element inside a list) in our queries.

I propose we use a more universal approach to paths and use a common slash-separated path string instead?

Pros:

- They can be properly used as query conditions
- They can carry additional information that the lists can't provide: for instance, we can encode whether a node is a leaf node or an intermediate node by having the intermediate nodes end their path string with a trailing slash ('/'). This would give us additional expressiveness in the queries for free, we'd be able to quickly identify if a node contains children nodes or if it's a leaf node.
- No loss of expressiveness or features compared to the current implementation.

Cons:

- The character used as the separator can't appear in the name of a test suite, test case, etc.

This could be done with very few code changes, a simple set of helper functions can do the work of managing this field (appending parts to the path, setting a trailing slash when adding children nodes, unpacking path parts, etc).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.