Skip to content

Commit e2d28f5

Browse files
fdesbiensclaude
andauthored
Fixed the Studio view test comparing goldens at the wrong offset (#184)
compare_file() locates the line where comparison should start, so that the banner GUIX Studio writes into every generated file -- which carries a revision string and a generation timestamp -- is skipped rather than compared. It looked that line up correctly in the first file and then looked it up in the first file again for the second: for line in list_2: if compare_start_string in line: start_row_2 = list_1.index(line) So the golden was sliced at the *generated* file's offset. While both files happened to reach "#include" on the same line the mistake was invisible, which is why it survived since the tests were added in #84. The offsets diverged when 6ba13db added a ten-line MIT licence header to all 111 golden .c and .h files. GUIX Studio does not emit that header, so every golden now reaches its first #include ten lines later than the file it is compared against. The golden was therefore sliced ten lines early and compared banner text against source. That made every one of the 107 .c and .h comparisons in the suite fail -- all 29 reported test failures -- while the .csv, .xliff and .xml comparisons passed. Those use skip_line instead of compare_start_string and never reach this code, which is exactly the split the failure log shows. The reported mismatch is the same in all 29: a generated "#include" line against a golden banner comment. Confirmed arithmetically -- in every case the golden line reported sits exactly ten lines before that golden's own first #include: generic_16bpp_resources.c reported idx 13, #include at 23, delta 10 generic_16bpp_resources.h reported idx 16, #include at 26, delta 10 generic_16bpp_specifications.c reported idx 14, #include at 24, delta 10 generic_16bpp_specifications.h reported idx 16, #include at 26, delta 10 compare_output_file() is the only caller that passes compare_start_string, so the change cannot affect the xliff, xml or plain-file comparisons. Verified by running the suite locally against a Studio built from this tree. Seven suites that fail in CI now pass with no mismatches at all, each gaining exactly the tests it had been failing: CI (broken) local (fixed) Font 9 / 1 10 / 0 Multi-Themes 18 / 1 19 / 0 Project Import 10 / 2 12 / 0 Trigger Edit 6 / 1 7 / 0 Trigger Target Rename 1 / 1 2 / 0 Bidi Text 3 / 1 4 / 0 Widget Name 3 / 1 4 / 0 Project Import compares a generated specifications file, so this also shows that the screen flow prototype block added by #173 does not disturb these goldens: that block is only emitted for projects that use Screen Flow, and these do not. No golden file is regenerated. The goldens still carry "GUIX Studio Revision 6.1.12.0" and a 2022 timestamp in their banners, and still name Azure RTOS rather than Eclipse ThreadX, but the banner is what the comparison is supposed to skip -- so none of that needs to be touched to make the suite correct. This workflow had never actually executed before 2026-08-27. Every earlier run was cancelled after queueing 24 hours for the retired windows-2019 image, or sat awaiting approval on a fork pull request, including the run for the v6.5.1 release itself. #174 gave it a runner again; this is the first result it has ever produced, and the defect it found is in the test harness rather than in GUIX or in Studio. Note that studio_view_test.yml triggers only on pull requests targeting master, so this change is not exercised by its own pull request into dev. It is validated by the release pull request that carries dev to master. Assisted-by: Claude Code (Opus 5) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d6a0667 commit e2d28f5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

test/guix_studio_test/test_view/test_utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# https://opensource.org/licenses/MIT.
88
#
99
# SPDX-License-Identifier: MIT
10+
# Some portions generated by Claude Code (Opus 5).
1011

1112
import os
1213
import sys
@@ -217,15 +218,19 @@ def compare_file(pathname_1, pathname_2, encoding = "", compare_start_string = "
217218
start_row_2 = 0
218219

219220
if compare_start_string != "":
220-
# find the line where comparing starts
221+
# Find the line where comparing starts, independently in each file. The
222+
# two files may reach that line at different offsets -- a generated file
223+
# carries the Studio banner, while the golden checked in beside it also
224+
# carries a licence header -- so each start row must be looked up in its
225+
# own list.
221226
for line in list_1:
222227
if compare_start_string in line:
223228
start_row_1 = list_1.index(line)
224229
break;
225230

226231
for line in list_2:
227232
if compare_start_string in line:
228-
start_row_2 = list_1.index(line)
233+
start_row_2 = list_2.index(line)
229234
break;
230235

231236
# compare from the start line

0 commit comments

Comments
 (0)