Skip to content

WIP: --ignore-element (split out of #9) - #14

Closed
MartenH wants to merge 5 commits into
mainfrom
ignore-element
Closed

MartenH wants to merge 5 commits into
mainfrom
ignore-element

Conversation

@MartenH

@MartenH MartenH commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Split out of #9 so values could merge: this is the --ignore-element work and its review rounds, parked.

State: the branch still carries the old #9 history (values included) and a half-done fix commit; it needs a rebase onto main once #9 is in, and is not ready for review.

Open review findings to address (from #9):

  • merge3: every edit below a removed node, not only the first, must be checked (P1, 14:09Z)
  • merge3: added nodes compared as merged, whatever their fragments (14:09Z)
  • the refusal list built from the keys in effect, not the schema's replaced keys (14:09Z)
  • a fragment holding only ignored items of a repeated role is an empty sequence (14:09Z)
  • diff: a move is ignored only when both its ends are in ignored content (14:09Z)
  • merge3: move destinations checked before a conflict is dropped (16:17Z)
  • value-key multiplicity inferred outside ignored subtrees (16:17Z)

The scope question stays open too: keeping --ignore-element to check, diff and values, and refusing it for merge3, would remove most of these.

🤖 Generated with Claude Code

MartenH and others added 5 commits October 17, 2026 18:09
…-ignore-element

`arxmodel values PATTERN <file|dir>...` merges the files as get does and prints every value
whose AUTOSAR path a path glob matches, or lies below a path it matches, one a line,
`path = "text"`. A value the merge names by its definition (an ECUC parameter or reference
value) is its container's path and the definition's last name (`/Pkg/Cfg/Dim = "10"`), its
label a key; its other parts follow a `#`. Any other value is named as findings name elements
(`/Pkg/Lamp#WATTS = "55"`). The walk writes each path into one builder and matches the glob on
its bytes: a string is made only for a value printed. Checked.values is the library's.

`--ignore-element NAME` (check, merge, get, list, values, diff, merge3, git-diff) treats an
element as structured comments are treated: its content is not compared. Its differences are
no finding, no change and no conflict, and it is no part of the content that tells the values
of one definition apart (the schema's identity roles and the built-in rules alike) nor of a
repeated role's content hash. The repetition hashes now leave structured comments out too, as
the merge does.

On a large real-world model: a value query takes the load and merge plus up to 0.6 s, at the
same peak memory; check and diff take the same time and memory as before and, without the
option, give the same output. A diff between two versions of that model printed mostly a
tool's annotations (a value gaining one even showed as removed and added); with them not
compared, about an eighth of the lines remain: the configuration that changed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- values: an element with a path of its own is no item, though the built-in rules name it by
  its definition too (a container's SHORT-NAME was printed as a value); an item that gives no
  definition is not named by one, as the merge does not name it so.
- merge3: two sides adding content not compared, differently, is no conflict: for an addition
  the conflict's node is the base's parent, so the added node is the one to look at.
- Content hashes: an element not compared is its name alone, also where it is a repeated
  role's item itself; the repetition check says nothing in content not compared.
- The built-in identity rules' state is copied per Flat, the rule's keys bound to the copy:
  a second ruling's ignored elements no longer reach the first's keys. new_ruling and
  check_typed build on the Flat's rules, not the original's.

Each has a test that fails without it. On a large real-world model: check and diff take the
same time and peak memory as on main and, without the option, give the same output.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- values `/`: the root, so every value (no segment matched nothing).
- An item name two identity roles share, under different parents: every role is a candidate,
  not the last one read.
- An element a key reads (a short name, a definition, a label: Flat.key_elements) is always
  compared: ignore_content leaves it out, and the command refuses it (exit 2), since items
  named by it would otherwise come and go as it changes.
- An item's value is the last element its first fragment writes, after its definition, as the
  file has it: an ignored value makes no other part the value, and neither does the merge's
  order (under the built-in rules, where two files give an item each its own value, the first
  file's takes the item's path).
- merge3: a node one side removed while the other changed only content not compared inside it
  is removed, ours or theirs, and no conflict; a node with a conflict besides keeps ours. A
  move on one side and a change inside on the other is no conflict to begin with (flatxml's
  moved conflicts are moves on both sides).

On a large real-world model with its schema, values gives the same output as before at the
same time and peak memory.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- merge3: both sides adding one node that differs only in content not compared is no conflict
  (their content hashed without it, fragment by fragment); ours is kept.
- values: an item's value is, of its parts, one no fragment writes another part after; of
  several the last in the merged view, and of copies of that element (one a file) the first,
  the first file's. An item split over files, its first fragment holding only a flag, no longer
  makes the flag its value.
- check: case_only says nothing in content not compared.
- Repetitions: an ignored item of a repeated role is no item of its sequence, so fragments
  holding different numbers of it do not differ.

On a large real-world model, values gives the same output as before, with its schema and with
the built-in rules.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…nly)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@MartenH

MartenH commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

Closed rather than rebased. The real need is diff noise from tool bookkeeping: on a real ECUC commit, 65 of 79 diff lines were ANNOTATIONS. Filtering the output covers it (arxmodel diff A B | grep -v '#ANNOTATIONS'), so no option is needed. The other parts (ignored content in value identity, merge3 conflicts) have no real case. The branch ignore-element is kept in case one shows up.

@MartenH MartenH closed this Oct 17, 2026
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