Grab path from which nodes are in a select list of labels

some cypher ...

CALL {WITH t MATCH (t)--(m) RETURN m} //Returns subset of nodes
WITH labels(m) AS features, m // grab labels within that subset
UNWIND features as feature
MATCH path=(m:feature)--(n:feature)
RETURN path

So what I am trying to do is grab the distinct paths between any node m and n. However, I only want the path (prior to distinction) to return nodes that are within the labels established previously. This pattern brings in extra node types that are not in the intended subset.

Any ideas?

Okay, more information.

CALL {MATCH (t:Table)--(m) WHERE ID(t)=764 RETURN m}
WITH collect(DISTINCT labels(m)[0]) AS allowableLabels
MATCH path = (m)--(n)
WHERE ALL(node IN nodes(path) WHERE ANY(label IN allowableLabels WHERE label IN labels(node)))
RETURN DISTINCT path

This cypher almost works as it filters out nodes based on a list of filters. Problem is, I need this filtration to happen within a subset of nodes m that belongs to the set of nodes that are labeled according to the allowedlabels. So you would think, "Okay, just pass along m in the WITH clause together with allowedlabels. So you filter down to the subset and then grab nodes in the allowedlabels from within the path indicated in the MATCH pattern". For some reason, the inclusion of the m variable makes the path return empty. Why is this behavior as such?

Sorry, I am a little confused. Without using cypher, can you describe what steps you want to take? It looks like you are given a specific Table node identified by its id. What is the next step after getting the Table node? Are you looking for nodes directly related to the table node to get their set of unique labels? What is next after determining the set of allowableLabels? Do What path(s) do you want to find? Is 'm' supposed to represent the nodes directly related to the Table node (the nodes in your first match)? What does 'n' represent?

Hello and thanks for your time,
So I'll try to be more specific on what I'm trying to do.

Context:
The graph I'm working with has sub-graphs that represent Tabular data. The way I structured it is such that all nodes representing part of one table is tied to a single :Table node with a :PART_OF relation identifier. So if I want to get a particular table's representation, I used the pattern (t:Table)--(m) (or it really should be (t:Table)--{1}(m)) to get all the nodes minus the "Master" :Table node. So now m is the subset of nodes that represent structured, csv-like data that are tied together in a manner like so:
(:DateTime)<-[:RECORDED_ON]-(:Value)-[:AMOUNT_OF]->(:Sales)-[:PRESENT_AT]->(:Location)
so every unique path from :Location (start of a csv header) to :DateTime (end of a csv header) should represent one "record". There are other entities in the graph other than tables, some which may connect with parts of a Table sub-graph (like a :Location node for example).

So what have I attempted:
The return using a Table by its ID is supposed to represent some earlier code that returns sets of "Tables" by a vector similarity match. For this example, we assume we only have one table returned.
I then try to grab the path of all the nodes in this table to each other using path = (m)--(n). Actually, it should be path=(m:Location)-[*]-(n:DateTime), for what I really want, but that's another problem where I would need to automatically grab beginning and ending of the distinct label list returned by labels(m). I might get more paths back than I want this way, but I think I can handle the "record" extraction with some post-processing in python.
However, the (m)--(n) pattern gives me connected nodes outside the "Table" sub-graph, so I figure if I filter out the paths such that I only retain that which contains the labels from m (A.K.A. the csv headers), I would only get paths of every node to every other node (maybe I can specify relation hops with the length of return labels in m) that are with one "Table" sub-graph.
As of right now, including m with the allowedlabels and the "WHERE node in labels filtering" returns nothing.