Skip to content

WIP: differential P3 remainders — baseline gate in CI + dd timestamp normalization (#1127) - #1439

Merged
caomengxuan666 merged 17 commits into
mainfrom
p3-1127-baseline-timestamp
Oct 29, 2026
Merged

caomengxuan666 merged 17 commits into
mainfrom
p3-1127-baseline-timestamp

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Refs #1127 (P3 test-framework remainders). Never closes the umbrella.

Item 1 - P3.3: baseline.json only-grows gate, wired

compare-baseline.py implements the only-grows rule and runner.sh already invoked it from its tail when passed --results - but no workflow ran runner.sh at all, so the gate never executed in CI and the ledger rotted (87 of 265 corpus cases unrecorded).

  • New baseline job in gnu-master-differential.yml (chosen over build-winuxcmd.yml: this is the differential workflow; the job sits next to the recorded-results compare job but is independent of it - it needs a live Linux oracle, not the pinned-master artifact). It builds winuxcmd, sets up WSL (Ubuntu 24.04 = coreutils 9.4, the recorded oracle), and runs the full corpus runner with --results, so the runner's own diff check and compare-baseline.py both gate the job. Results + report are uploaded as the differential-baseline artifact either way.
  • Environment bring-up found by the first runs, all recorded in the job comments: GNU_BIN=/usr/bin is load-bearing (oracle lookup through the shell resolves printf/test/echo/true/false to bash builtins, not paths - those cases silently SKIPped); cal on Ubuntu 24.04 comes from ncal.
  • baseline.json is refreshed from the job's own results artifact: the 87 unrecorded cases are now recorded with the buckets they actually produced; the only pre-existing entries changed are the two dd cases (KNOWN_DIFF -> PASS, caused by item 2). No recorded bucket was refreshed to excuse a regression.

Current gate state (honest): all 265 cases execute in CI (0 SKIP). The job is still red - at the runner stage, not the ledger stage - because 11 cases diff in the CI environment. With the refreshed ledger, compare-baseline.py's own verdict is down to 5 recorded cases whose CI behavior differs from the maintainer-recorded baseline. Both lists are enumerated in the task REPORT delivered with this PR; adjudicating/fixing those cases is product/case work outside this wiring PR, and this PR does not paper over any of them (no whitelist additions, no bucket edits beyond the above).

Item 2 - P3.2: timestamp normalization

  • runner.sh gains a symmetric normalize_output pass in its comparison chain (after exact and CRLF-only checks): CR stripped, and dd's volatile stderr summary masked - everything after bytes copied, (GNU's elapsed/rate tail and optional human-readable size) dropped, +0 partial-record counts canonicalized. A real partial (0+1 vs 1) still differs by design.
  • The corpus/dd/01-count and corpus/dd/02-skip whitelist exemptions - which existed only for that volatile summary - are removed; both cases PASS in every CI run of this branch (locally proven beforehand against real GNU coreutils 9.4 output + the dd.cpp source format). WinuxCmd dd's summary is fully deterministic (no timing is printed at all), and GNU's timing tail was the only run-varying part.

Commits: one per item, plus two small CI bring-up fixes and the baseline data refresh, each scoped and explained.

runner.sh gains a symmetric normalize_output pass in its comparison
chain: after the exact and CRLF-only checks, outputs that agree once CR
is stripped and dd's volatile stderr summary is masked count as PASS.
The mask drops everything after "bytes copied," (GNU's elapsed-time /
transfer-rate tail and the optional human-readable size) and
canonicalizes a "+0" partial-record count. Partial counts other than
+0 are deliberately not masked, so a record-counting divergence
("0+1 records in" vs "1 records in") stays visible.

corpus/dd/01-count and corpus/dd/02-skip differed only in those masked
parts - their copied files already compared byte-identical - so their
whitelist exemptions are removed, with the reasoning recorded in
whitelist.txt in place of the entries. Both cases now compare on the
deterministic record totals and byte counts and PASS; baseline.json
needs no change because PASS improves on their recorded KNOWN_DIFF.

Verified locally against real GNU coreutils 9.4 dd output for both
cases, plus negative controls (partial records and a real count
difference still differ after normalization).

Refs #1127 (P3.2)
baseline.json's only-grows gate (compare-baseline.py) was invoked only
by runner.sh's tail, and no workflow ran runner.sh, so the gate never
executed in CI and the baseline silently rotted (87 corpus cases are
not recorded in it). Add a baseline job to gnu-master-differential -
the differential workflow, alongside the recorded-results compare job -
that builds winuxcmd and runs the full corpus runner with --results
inside WSL on the Windows runner. WSL reproduces the environment the
corpus and baseline were recorded in (a live Linux GNU oracle with the
Windows build reachable); Ubuntu 24.04 provides coreutils 9.4, the
recorded oracle, so no case has to skip and the gate's
unexplained-skip rule stays meaningful. The runner's own exit code
fails the job on unexpected diffs, and compare-baseline.py fails it on
missing, unrecorded, skipped or regressed cases. Results and report
are uploaded as artifacts either way.

Refs #1127 (P3.3)
First CI run of the baseline job executed the corpus end to end but
SKIPped every printf/test/echo/true/false case (19 of them recorded
PASS in baseline.json): without GNU_BIN the runner resolves oracle
commands through the shell, and those five are bash builtins, not
paths, so find_oracle found nothing executable. Point GNU_BIN at
/usr/bin, where all of them are real coreutils binaries. cal was also
missing from the stock WSL image; add bsdextrautils (its provider) to
the setup-wsl packages alongside python3.

Refs #1127 (P3.3)
Run 2 still skipped both cal cases: bsdextrautils installed cleanly
but does not ship cal on Ubuntu 24.04 - ncal does. Add it.

Refs #1127 (P3.3)
…esults

baseline.json covered 178 of the 265 corpus cases; the other 87 were
added to the corpus after the ledger froze and were never recorded, so
compare-baseline.py rejected every one as an unrecorded new case.
Record the missing entries from the baseline job's own results
artifact (the WSL / coreutils 9.4 run of this branch): each previously
unrecorded case is now listed with the bucket it actually produced
there, including the ones that currently diff - those stay visible
because the runner fails on unexpected diffs independently of the
ledger. The only recorded entries changed are dd/01-count and
dd/02-skip, KNOWN_DIFF -> PASS, which is the normalization commit's
doing. No recorded bucket was refreshed to excuse a regression.

With this ledger, compare-baseline's verdict on the current tree is
down to five recorded cases whose CI behavior differs from the
maintainer-recorded baseline (cal x2, cmp/14, sdiff/30, locale/42),
enumerated in the PR description for owner adjudication.

Refs #1127 (P3.3)
…ne gate

compare-baseline.py's ORDER had no KNOWN_DIFF entry, so the bucket
scored 99 by default. That cut both ways: a recorded PASS producing
its whitelisted (explained) diff counted as a regression - the
regressions/30-sdiff-output-file shape - and, symmetrically, a
recorded KNOWN_DIFF degrading to an unexplained OUT_DIFF scored
2 < 99 and passed silently.

KNOWN_DIFF is the bucket runner.sh assigns precisely when a diff is
explained by whitelist.txt, i.e. an accepted terminal state, so it
now ranks with PASS. PASS <-> KNOWN_DIFF transitions stay silent;
any move from either to an unexplained bucket still fails.

Proven with fixtures against the old and new script: PASS->KNOWN_DIFF
was an error, now OK; PASS->OUT_DIFF was and still is an error;
KNOWN_DIFF->OUT_DIFF was OK, now an error.

Refs #1127
…SLENV

runner.sh pins LC_ALL/LANG for both sides so a verdict never depends
on the host locale, and the subject invocation exports them - but
when the runner itself runs inside WSL (the CI baseline job), the
Windows subject is reached through the interop chain, where only
WSLENV-listed variables cross over. Only WINUX_LANG was listed, so
the subject silently ran under the Windows host locale while the
oracle ran under LC_ALL=C.

That is exactly the locale/42-locale-keyword failure: the charmap
that the locale applet reports is defined by the selected locale,
and the applet consults LC_ALL first (src/commands/locale.cpp), so
with LC_ALL delivered it answers ANSI_X3.4-1968 like the oracle.
Add LC_ALL and LANG to the WSLENV forwarding list; on native
Windows runners the entries are inert because the exports already
reach the subject directly.

Refs #1127
…mplementation delta

In the baseline job (WSL Ubuntu 24.04) the only cal is ncal's BSD
cal: bsdextrautils 2.39 ships no cal binary at all (verified against
the local 2.39.3 package contents), and no util-linux cal package
exists for 24.04. ncal pads every row to 22 columns with trailing
blanks and centres the title over 22 columns; the applet implements
the util-linux layout (20 columns, no trailing padding -
src/commands/cal.cpp kMonthWidth = 20) against which these cases
recorded PASS. For cal/02 the delta is wider: -m is --monday in
util-linux and the applet, but a month operand in ncal.

Both diffs are therefore properties of which cal implementation
serves as oracle, not of the applet. Whitelist both with the
mechanism stated, matching the file's existing oracle: entries.
Evidence: ncal 12.1.8 (the 24.04 package) run locally -
cal 3 2025 produces 22-wide rows with trailing blanks on every line.

Refs #1127
… share semantics

Both cases were recorded at EXIT_DIFF by the wave-1 refresh, and
both fail on file-system operations the WSL-side runner can only
perform through the \\wsl.localhost 9p share (the runner's workdirs
live on WSL ext4; the Windows subject reaches them through the 9p
redirector):

- regressions/56-find-L-loop: find's loop detection compares the
  (volume serial, file index) identity of each descent against its
  ancestors (src/commands/find.cpp, find_loop_ancestor). The 9p
  redirector does not return a matching identity for a directory
  re-reached through a symlink loop, so the subject does not stop
  where GNU stops.
- regressions/57-ln-backup-control: after the backup rename, the
  case creates a symlink; reparse-point creation through the 9p
  share is not supported by the redirector, so the subject exits
  non-zero where GNU (ext4 side) succeeds.

Same family as the already-whitelisted regressions/23-cp-link-option
and corpus/ln/35-hard (hard links across the same share). The
entries state the mechanism, per the file's convention. If either
case ever fails in the native-Windows runner shape, the mechanism
is falsified and the entry must come back out - that check is
recorded in the wave-1b report.

Refs #1127
…wording bug

The recorded PASS for corpus/cmp/14-differ is stale: against the
pinned oracle (GNU coreutils 9.4; the case declares
oracle_version >= 9) the first-difference line reads

    a.txt b.txt differ: char 1, line 1

while the applet prints "differ: byte 1, line 1"
(src/commands/cmp.cpp, print_difference). GNU renamed the token in
the plain message; only the -b form still says "byte". This is a
product wording bug, filed as a finding with a minimal reproducer
in the wave-1b report for the main session to open an issue from;
the applet is deliberately not fixed in this PR.

Recording the observed bucket keeps the gate honest without hiding
anything: runner.sh still fails this case on every run until the
applet is fixed (the runner acts before the ledger is consulted),
and the gate's job is to flag new worsening, not to re-litigate a
known, tracked bug on every run. Same treatment the wave-1 refresh
applied to the seven diff-bucket cases it recorded faithfully.

Refs #1127
… does not deliver

This reverts the runner.sh half of the locale/42 disposition
(commit 292973b). The hypothesis was that the pinned locale failed
to reach the Windows subject in the WSL baseline job because only
WSLENV-listed variables cross the interop chain. Run 40941525029
(head 765593c, workflow_dispatch) falsified it: with LC_ALL/LANG
added to the forwarding list, regressions/42-locale-keyword still
came out OUT_DIFF and every other case's bucket was unchanged.

The applet is not at fault: src/commands/locale.cpp consults
LC_ALL first and answers ANSI_X3.4-1968 for LC_ALL=C, matching the
oracle. The pinned locale simply does not reach the subject in
this launch shape by any knob the runner controls, so the case is
dispositioned as environment sensitivity in the whitelist instead
(next commit), where the mechanism is recorded. Keeping a no-op
forwarding entry whose comment claims otherwise would leave the
runner documenting something empirically false.

Refs #1127
…locale unreachable in the WSL runner shape

locale charmap is defined by the locale the subject runs under.
The runner pins LC_ALL=C for both sides and the applet honours it
(src/commands/locale.cpp consults LC_ALL first and answers
ANSI_X3.4-1968), but in the WSL-side baseline job the export does
not reach the Windows subject through the interop chain: the
subject answers from the host locale while the oracle answers for
LC_ALL=C. Forwarding LC_ALL/LANG through WSLENV was tried on this
branch and the CI verdict did not change (run 40941525029), so the
premise "subject runs under the pinned locale" is not deliverable
in this launch shape by runner-side means.

In the native runner shape the export reaches the subject directly
and the case passes (its recorded bucket). Whitelist with the
mechanism stated, matching the file's environment: entries. If the
case ever passes in the baseline job (e.g. the launch shape gains a
working locale channel), the entry degrades gracefully - a PASS
stays PASS - and can be dropped.

Refs #1127
… live clock reads

Found by run 40943010494 on this branch: corpus/date/01-epoch
(date +%s) flipped PASS -> OUT_DIFF after passing in the three
preceding baseline runs. The case is a race by construction: the
runner executes the subject and the oracle sequentially, and two
live epoch-seconds reads differ whenever a second boundary falls
between them. Both sides share the host clock, so neither answer
was wrong; the comparison itself is unsound. It was the only
live-clock case in the corpus (sole +%s user, sole date case
without -d/-r).

Fix the case, keeping its coverage: -d @1234567890 +%s round-trips
a fixed epoch through the same +%s formatting path with an
input-determined answer, matching the corpus doctrine that
time-shaped outputs are input-determined (wave-1 REPORT 2.2).
Whitelisting was rejected: it would convert any future real date
diff on this case into KNOWN_DIFF.

Refs #1127
…tion

The closed-stdin cases corpus/cat/03-closed-stdin and
corpus/tee/02-closed-stdin pin coreutils' own read-error diagnostics,
which require `args: <&-` to reach the subject as a genuinely closed
descriptor. In the recorded baseline shape the subject is reached
through the WSL interop chain, which substitutes a handle of its own,
so the subject walks a different error path and the cases sat at
OUT_DIFF: gate-silent, but permanently red in the runner. whitelist.txt
documents the maintainers' refusal to record these two as known
differences, so a whitelist entry was not an option; the failure is a
launch-chain limitation, not a product difference.

Modelled on the existing `oracle:` precondition, a case can now
declare `subject: native` (or `interop`). runner.sh derives
SUBJECT_LAUNCH from uname -s next to ORACLE_PLATFORM and SKIPs a case
whose declared shape does not match, keeping the cases runnable under
a native Windows launch. Both cases declare `subject: native`
alongside their existing `oracle: linux`, and baseline.json records
the observed SKIP bucket for exactly these two entries.

compare-baseline.py learns the matching notion of an explained skip.
Until now every SKIP result failed as "unexplained", even one the
baseline itself records, so a preconditioned case could never be
recorded honestly. A skip the baseline records is now the case's
declared verdict in the recorded shape and passes; any other skip
still fails as unexplained, and a recorded skip that starts producing
verdicts fails too, so a changed launch environment demands a
deliberate baseline refresh instead of silently adopting a bucket
that was never dispositioned.

Refs #1127
…stamp

# Conflicts:
#	tests/differential/baseline.json
#	tests/differential/whitelist.txt
…hed literally, not as a regex

The recorded PASS for corpus/sdiff/12-ignore-matching-lines came
from #1440's GNU-vs-GNU validation; the first true two-sided runs
(the two byte-identical result sets harvested in wave-1d) show
the subject's exit code differing from GNU's, deterministically.

Case: f1 = keep/skip-1/end, f2 = keep/skip-2/end, run as
`sdiff -I ^skip- f1.txt f2.txt`. GNU diffutils 3.10 exits 0: the
regular expression ^skip- matches both changed lines, so the
only change is ignored and the pair displays as a common row.
The applet exits 1. Mechanism: the hunk-drop predicate
diff_engine::make_blank_or_matching_predicate
(src/commands/diff_engine.h) tests each changed line with
std::string::find - a literal substring search - so the needle
"^skip-", caret included, never occurs in "skip-1"/"skip-2";
drop_ignored_hunks keeps the DEL/INS hunk and the exit branch
in src/commands/sdiff.cpp sees a non-KEEP edit. GNU's -I takes a
regular expression; any RE metacharacter (^, ., [...], ...)
fails the same way, while plain substring patterns accidentally
work. The same predicate backs diff -I (src/commands/diff.cpp),
so the defect is shared there.

This is a product bug, filed as a finding with a minimal
reproducer in the wave-1e report for the main session to open
an issue from; the applet is deliberately not fixed in this PR.
It is a sibling of the -o exit-status bug (#1441), not the same
mechanism: that one is the -o path's unconditional return 0,
this one is the display path's literal-match predicate.

Recording the observed bucket keeps the gate honest without
hiding anything: runner.sh still fails this case on every run
until the applet is fixed. Same treatment wave-1b applied to
cmp/14.

Refs #1127
#1446

PR #1446 (merged to main as 01da9b9) fixed the three product
bugs these cases pin: cmp's plain differ message counts chars,
not bytes (#1443); tac accepts a literal empty -s separator
(#1444); printf's invalid-conversion diagnostic carries no
quotes (#1445). The two byte-identical two-sided result sets
harvested in wave-1d were produced on merge head faac22e, which
contains #1446, and all three cases come out PASS in both.

Re-record the observed buckets so the baseline states the
current expectation: corpus/cmp/14-differ OUT_DIFF -> PASS,
regressions/50-tac-empty-separator EXIT_DIFF -> PASS,
regressions/52-printf-invalid-conversion OUT_DIFF -> PASS.
The only-grows gate accepts improvements silently; recording
them makes any future flip back a flagged regression.

Refs #1127
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.

1 participant