Multipart shapes, left/right align text in node

\documentclass[preview,border=3mm,tikz]{standalone}
\usetikzlibrary{shapes.multipart}
\tikzset{%
base/.style args={#1/#2/#3}{%
shape=rectangle split,
draw, inner sep=1mm, outer sep=0mm,
rectangle split parts=2,
rectangle split part fill={white,gray!20},
rectangle split draw splits=false,
rectangle split part align={left, right},
node contents={\nodepart{one}  #2
\nodepart{two}  #3},
}
}% end of tikzset

\begin{document}
\begin{tikzpicture}[every node/.append style={minimum width=24mm}]
\node (c1) [base=22mm/one line/two\\ line ];
\end{tikzpicture}
\begin{tikzpicture}[every node/.append style={text width=22mm}]
\node (c1) [base=22mm/one line/two\\ line ];
\end{tikzpicture}
\end{document}


In the first case the text is correct aligned and as expected in the second part is not broken into two lines. However, replacing minimum width with text width nullify left/right aligning of text in nodes' parts (and enable break text in more lines).

Is this a feature? How to convince TikZ that it will right align text in the second node part?

The minimum width case runs as I expect, \\ doesn't work unless you put it in a multi-line environment, I've used varwidth, but you can see this gorgeous answer for alternatives and explanation.

I'm not an expert, but I think that in the text width case, on the contrary, there is tikz a bug (edit: I thought it was a bug, but it is not, see Zarko's answer).

As you can see in my mwe, I've tried with varwidth, \makecell, tabular, and \flushright, but they do not work.

The only solution that works is a flushright environment with a vertical alignment adjustment.

\documentclass[preview,border=3mm,tikz]{standalone}
\usetikzlibrary{shapes.multipart}
\usepackage{makecell}
\usepackage{varwidth}
\tikzset{%
base/.style args={#1/#2/#3}{%
shape=rectangle split,
draw, inner sep=1mm, outer sep=0mm,
rectangle split parts=2,
rectangle split part fill={white,gray!20},
rectangle split draw splits=false,
rectangle split part align={left, right},
node contents={\nodepart{one}  #2
\nodepart{two}  #3},
}
}% end of tikzset

\begin{document}
% the first case is easily solvable with varwidth:
\begin{tikzpicture}[every node/.append style={minimum width=24mm}]
\node (c1) [base=22mm/one line/\begin{varwidth}{22mm}{two\\ line}\end{varwidth}];
\end{tikzpicture}

% in the second case only flushright with a vertical alignment adjustment works:
\begin{tikzpicture}[every node/.append style={text width=22mm}]
\node (c1) [base=22mm/one line/\vspace{-1.2\baselineskip}\begin{flushright}
two\\ line  \end{flushright}];
\end{tikzpicture}

% these are other solutions that I've tried but DO NOT work
% varwidth:
\begin{tikzpicture}[every node/.append style={text width=22mm}]
\node (c1) [base=22mm/one line/\begin{varwidth}{22mm}two\\ line\\ \end{varwidth}];
\end{tikzpicture}
% \makecell:
\begin{tikzpicture}[every node/.append style={text width=22mm}]
\node (c1) [base=22mm/one line/\makecell{two\\ line}];
\end{tikzpicture}
% tabular:
\begin{tikzpicture}[every node/.append style={text width=22mm}]
\node (c1) [base=22mm/one line/\begin{tabular}{r}two\\ line\\ \end{tabular}];
\end{tikzpicture}
% \flushright:
\begin{tikzpicture}[every node/.append style={text width=22mm}]
\node (c1) [base=22mm/one line/\flushright two\\ line];
\end{tikzpicture}
\end{document}


minimum width case with varwidth:

text width case with flusright and vertical alignment adjustment:

• Thank you very much for exhaustive answer! Now I look how to include your solutions in node style (will try latter in the day). Do you maybe know, if someone already made bug report for this? Mar 6 '17 at 9:08
• Meanwhile I succeed to integrate your solution with  varwidth into node style and also discover new one, for which I will write answer. At evening I will ask on chat room, how to check, if some bug is already reported (or I need to read all reports). Mar 6 '17 at 9:58
• now I have filling, that this is not a bug, rather my misunderstanding, how things works and an undocumented features. See my answer below. Mar 6 '17 at 10:23
• No, without your answer I will never find own one. And your answer fulfill all my expectation. Mar 6 '17 at 10:35

In effort to integrate of CarLaTeX solution into node style I discover the following solutions:

\documentclass[preview,border=3mm,tikz]{standalone}
\usetikzlibrary{shapes.multipart}
\begin{document}
\begin{tikzpicture}[
base/.style args={#1/#2/#3}{%
shape=rectangle split,
draw, inner sep=0.5mm, outer sep=0mm,
rectangle split parts=2,
rectangle split part fill={red!20,white},
rectangle split draw splits=false,
minimum width=#1,
rectangle split part align={left, right},% second part is right aligned with left aligned content
node contents={\nodepart{one}  #2
\nodepart{two}  #3},
}
]
\node (c1) [base=22mm/one line/longer two lines text];
\end{tikzpicture}

\begin{tikzpicture}[
base/.style args={#1/#2/#3}{%
shape=rectangle split,
draw, inner sep=0.5mm, outer sep=0mm,
rectangle split parts=2,
rectangle split part fill={red!20,white},
rectangle split draw splits=false,
minimum width=#1,