Intelligent failure-value diffs (unified-diff-like) (#4) #18

Open
orchestrator wants to merge 3 commits from wip/issue-04 into integration/wave1
Member

Per #4.

  • New src/lib/diff.ts: structural per-path unified-diff-style comparison for plain data (objects/arrays/Map/Set/primitives), with size/depth/cyclic caps and repr fallback.
  • Wired into deepEqual / arrayIs / arrayEqualsUnsorted failure formatting; hardened repr.
  • Testrunner failure text renders per-line coloring for @@/+/- lines.

Verification

  • Build/typecheck; deepEqual nested failure shows a clear per-path diff (see PR commit); new tests in happypath/sadpath.

Closes #4

Base: integration/wave1 is the integration point this branch was based on, so this PR's diff shows only this issue's changes.

Per #4. - New `src/lib/diff.ts`: structural per-path unified-diff-style comparison for plain data (objects/arrays/Map/Set/primitives), with size/depth/cyclic caps and `repr` fallback. - Wired into `deepEqual` / `arrayIs` / `arrayEqualsUnsorted` failure formatting; hardened `repr`. - Testrunner failure text renders per-line coloring for `@@`/`+`/`-` lines. ## Verification - Build/typecheck; `deepEqual` nested failure shows a clear per-path diff (see PR commit); new tests in `happypath`/`sadpath`. Closes #4 > **Base:** `integration/wave1` is the integration point this branch was based on, so this PR's diff shows **only this issue's changes**.
@ -0,0 +7,4 @@
// @@ $.user.age @@
// $.user.name = "Sufian"
// - $.user.age = 30
// + $.user.age = 31
Owner

I would much rather have this display as:

 {
   user: {
     name: 'Sufian',
-    age: 30,
+    age: 31,
   }
 }

With collapsing of multiple adjacent items that are the same in both a & b, so that if user had name, age, birthday, height, weight fields, and there was another top-level field called system (sibling of user, equal in both cases) it'd show:

 {
   user: {
     name: 'Sufian',
-    age: 30,
+    age: 31,
     birthday: '1900-01-01',
     ...
   },
   system: ...
 }

I'm not sure what the exact ruleset for what to show/hide should be, but please propose one. When rendered, the collapsed items should be expandable on click.

I would much rather have this display as: ``` { user: { name: 'Sufian', - age: 30, + age: 31, } } ``` With collapsing of multiple adjacent items that are the same in both a & b, so that if user had `name`, `age`, `birthday`, `height`, `weight` fields, and there was another top-level field called `system` (sibling of user, equal in both cases) it'd show: ``` { user: { name: 'Sufian', - age: 30, + age: 31, birthday: '1900-01-01', ... }, system: ... } ``` I'm not sure what the exact ruleset for what to show/hide should be, but please propose one. When rendered, the collapsed items should be expandable on click.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin wip/issue-04:wip/issue-04
git switch wip/issue-04

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch integration/wave1
git merge --no-ff wip/issue-04
git switch wip/issue-04
git rebase integration/wave1
git switch integration/wave1
git merge --ff-only wip/issue-04
git switch wip/issue-04
git rebase integration/wave1
git switch integration/wave1
git merge --no-ff wip/issue-04
git switch integration/wave1
git merge --squash wip/issue-04
git switch integration/wave1
git merge --ff-only wip/issue-04
git switch integration/wave1
git merge wip/issue-04
git push origin integration/wave1
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
legend/gooey-test!18
No description provided.