test: lay the fixtures out like a real codegen export - #37
Open
longvo92 wants to merge 7 commits into
Open
Conversation
The suite scanned four fixture trees whose shape existed only for the tests: files called comment_only.c and rename_only.c, sitting in src/ and rules/ folders no Embedded Coder export ever produces. fixtures/demo already held a byte-identical copy of every one of them, so the same content was maintained twice and a test path told a reader nothing about where the file would really be found. There is now one tree. Each model owns a <Model>_autosar_rtw/ folder of generated C, the ARXML export sits under arxml/ and the calibration files under a2l/, so a path in an assertion is a path a reviewer would see. Six models carry the whole matrix between them, and the noise rules live in NoiseDemo rather than in files named after the rule they exercise. Verdicts are unchanged throughout: the old and new sides of each carried-over file kept their exact content, and any rewrite (an #include, a header guard) was applied to both sides so the diff between them could not move. Three files did have to change place, because a realistic layout exposes constraints the flat one hid -- a lone added .c forms a one-file model and falls into Shared, so the added file is now SpeedCtrl_data.c, the deleted one NoiseDemo_types.h, and the two shared ARXMLs became NoiseDemo's modular interface/datatype pair. Two pinned numbers moved with the larger tree (A2L updated 1 -> 3 modified, 8 -> 17 reviewable changes). One test was passing for the wrong reason and is fixed here: test_noise_only_files_not_listed asserted that names like uuid_only.arxml were absent, which stayed true for free once nothing was called that any more. 715 tests pass; ruff clean; the fixture scan still exits 1 for the CI gate.
Unticking Comment or Unimportant used to re-judge every affected file to Identical. That put the tree at odds with the exported report, which is always built from the raw scan, and it made the viewer say "Identical" about a file whose comments really had moved -- the one word a reviewer is entitled to read as "nothing differs here at all". The toggles are now what they always looked like: a reading aid. Those rows go grey and drop off the minimap and F7/F8, and nothing else changes. The verdict, the counts and the exported report all keep saying Comment or Unimportant, and Hide identical leaves such a file in the tree -- it hides files that are identical, not files whose differences the reviewer chose to play down. _is_nav now drops a muted category itself rather than relying on the fold having rewritten the status, so F7/F8 still walks past a greyed-out file instead of dead-ending in one with no stops left. Both noise verdicts also share the same almost-equal mark in the tree now. They are one answer to "must I read this?", and the Status word beside the mark is what separates a moved banner from a renamed identifier.
The consistency heads-up sat outside the splitter, pinned under it. That made the one pane whose length is least predictable -- a folder full of stale models -- the only one that could not be dragged, and it took its height off the tree without asking. All three panes are now Section widgets in one vertical splitter: Files, Quick changes, Consistency. Each has a bar you click to fold it away, the way an editor sidebar does it, and folding hands that height to the panes still open. A pane remembers the height it had, so folding one to read something else and opening it again puts it back where the reviewer had it rather than wherever Qt's redistribution left it. Folding caps the widget at its bar rather than hiding it. A hidden widget drops out of the splitter altogether, which throws away the dragged size and makes the handle jump the next time it comes back; the bar also has to survive, or there is no way back into a pane once it is shut. The Consistency section only appears when a scan has something to say and carries the count on its bar, so it still says "2 heads-ups" while folded. The category checkboxes moved above the panes: they drive the diff view as much as the tree, so they should not disappear with the tree when Files is folded. Section headers are QPushButton, not QToolButton -- only the former honours text-align:left from a stylesheet, and a centred pane title reads as a heading for the whole column instead of a bar you can click.
The report's tree and the viewer's tree each carried their own table of verdict marks. They drifted: a comment-only file read '≉' in the report and '≈' in the viewer, so the same file looked like two different findings depending on which surface you opened. Both now read view_model.VERDICT_MARK, and a test pins them to it so a copy cannot creep back in. Two things the real window showed that an offscreen grab could not: - with every pane folded, Qt centred the splitter in the column and left the three bars adrift halfway down an empty panel. Folded flat, the splitter is capped and top-aligned, so the bars stack under the toolbar. - the Comment / Unimportant / Hide identical row floated above all three panes and was stranded mid-panel once they were all folded. It belongs to the tree, so it now lives inside the Files pane and folds away with it.
…one open Fold Files and Quick changes and the Consistency pane got the whole column -- but its scroll area was still capped at 120px from the days it was pinned under the splitter and could not be resized. Qt then had ~700px of unclaimed height to place, so the text ended up stranded in the middle of an empty panel with a gap above it and below it. The pane is a section the reviewer can drag now, so the height is theirs to set: the cap is gone and the scroll area fills whatever the section is given, scrolling past that. Its own "⚠ Consistency — 2 heads-ups" heading is gone too. The section bar directly above it already reads "CONSISTENCY 2 heads-ups", and in a panel this narrow a row spent restating the line above it is a row not spent on which model is out of step. The count still shows while the pane is folded, which is what the heading was really for.
Folding the last open pane takes an early exit -- there is nobody to hand the height to -- and the line that records the size sat after it. Fold the tree and the rollup, drag Consistency to fill the column, fold that too, then open the tree and come back: Consistency reopened at the 200px default instead of the height it had. Recording now happens before the exit. Also drops a redundant ternary in _spread. Both branches computed min(spare[n], left); 20k random cases confirm the two forms never differ, so it was only there to be re-read.
apply_fold re-judged an already-scanned tree so the viewer could collapse a category on a toggle. That is the behaviour this branch removed, and nothing else ever called it -- there is no --fold flag, so no shipped front end reached it. scan(fold=) and fold_status stay: a caller can still ask for the collapse up front. The Vietnamese architecture doc still described the old fold path in full; it now matches the English one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The suite scanned four fixture trees —
tests/fixtures/{old,new,model_old,model_new}— whose shape existed only for the tests: files calledcomment_only.candrename_only.c, sitting insrc/andrules/folders no Embedded Coder export ever produces.fixtures/demoalready held a byte-identical copy of every one of them (verified withdiff -rqbefore deleting), so the same content was maintained twice, and a path in an assertion told a reader nothing about where the file would really be found.There is now one tree:
Six models carry the whole matrix between them, and the noise rules live in a model called
NoiseDemorather than in files named after the rule they exercise.Verdicts did not move
Each carried-over file kept its exact old and new content. Where a rewrite was needed to make the tree read as real (an
#include, a header guard), it was applied to both sides, so the diff between them could not change.Three files did have to change place, because a realistic layout exposes constraints the flat one hid:
.cforms a one-file model and falls into Shared — the added file is nowSpeedCtrl_data.c(_C_DATA_REfoldsX_databack intoX);NoiseDemo_types.hfor the same reason;_interface/_datatypepair.Grouping and the consistency check key off the file stem, not the folder, so a model's C, its ARXML under
arxml/and its A2L undera2l/still land in one group.test_demo.pynow asserts that explicitly.For the reviewer
Two pinned numbers moved with the larger tree —
A2L updated: 1 → 3 modified, and8 → 17reviewable changes. Neither is a loosened assertion; both are the same claim against more files.One test was passing for the wrong reason and is fixed here:
test_noise_only_files_not_listedasserted that names likeuuid_only.arxmlwere absent from the updated-files block, which became true for free once nothing was called that any more. It now names the files that actually exist.CI: the three workflow steps that scanned
tests/fixtures/{old,new}point attests/fixtures/demo/*; the scan still exits1, which is whattest.ymlgates on.python -m unittest discover -s tests— 715 passed.python -m ruff check .— clean.