Repository navigation
refactor: store diff in action object (#1693) - #1701
Conversation
✅ Deploy Preview for endearing-brigadeiros-63f9d0 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
dcoric
left a comment
There was a problem hiding this comment.
Thanks for picking this up @amnkarn, I verified the consumer coverage end-to-end (scanDiff, getPush, PushDetails, Cypress mocks) and the legacy fallbacks keep old DB records working, so the compat approach is right. Requesting changes on one compile-level issue plus a few design/test follow-ups:
PushActionViewtype breakstsc(inline, blocking)- diff now persisted 3x per push (inline)
- two test gaps (inline)
- plugin access expectation (inline)
Also: the -40 lines in package-lock.json (removal of "extraneous": true entries) look like an unrelated npm-prune side effect from a local install. Could you revert them or move them to a separate PR so the diff stays clean?
|
Thanks for the thorough review @dcoric! I have addressed all the feedback: to |
|
@amnkarn The lockfile changes still look present and also This would also resolve the conflicts. |
|
@dcoric this should be ready now. Would you mind taking another look? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1701 +/- ##
==========================================
+ Coverage 86.89% 87.00% +0.11%
==========================================
Files 113 113
Lines 6461 6463 +2
Branches 1253 1253
==========================================
+ Hits 5614 5623 +9
+ Misses 542 536 -6
+ Partials 305 304 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jescalada
left a comment
There was a problem hiding this comment.
I feel like this PR is adding complexity (especially with types) when the original goal was to make the diff available, and safe for plugin use.
Can we refactor this so it fits the goal, while being as clean, safe and succinct as possible? AI is very eager to implement exactly what the issue requested without any regard for the maintainability of the code or the appropriateness of the solution 😕
|
@jescalada I left the scanDiff log alone since #1795 already replaces it. Since nothing reads the step content any more we might want to drop it here? |
|
Removed |
|
Might need another approval from @dcoric before merging |
Fixes #1693
Description
This PR refactors
getDiffand related consumers to store and access the git diff directly on theactionobject (action.diff).This makes it easier for subsequent actions (likescanDiff) to retrieve the diff without extracting it from thestepcontent.Changes Made
getDiffto assign the diff string directly toaction.diffand updated theActioninterface.scanDiff.tsto retrieve the diff fromaction.diff.PushActionViewintypes.tsto acceptStep | stringfor the diff property.getPushingit-push.tsto handle the new string format.Backward Compatibility
To ensure historical database records and existing UI components do not break, fallback logic has been added. If
action.diffis not present (or is not a string), the system gracefully falls back to extracting the content fromsteps.find((s) => s.stepName === 'diff')?.contentin bothscanDiff.tsandgit-push.ts.Storage note
action.diffadds a third copy of the diff to each push document, alongsidesteps[].contentandsteps[].logs. RemovingsetContentis deferred to a follow-up under #1691.