-
Notifications
You must be signed in to change notification settings - Fork 176
refactor: store diff in action object (#1693) #1701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,11 +179,10 @@ const exec = async (_req: Request, action: Action): Promise<Action> => { | |
|
|
||
| const { steps, commitFrom, commitTo } = action; | ||
| step.log(`Scanning diff: ${commitFrom}:${commitTo}`); | ||
| const diff = action.diff ?? steps.find((s) => s.stepName === 'diff')?.content; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two test gaps worth closing:
|
||
|
|
||
| const diff = steps.find((s) => s.stepName === 'diff')?.content; | ||
|
|
||
| step.log(diff); | ||
| const diffViolations = getDiffViolations(diff, action.project, step); | ||
| step.log(diff as string); | ||
| const diffViolations = getDiffViolations(diff as string, action.project, step); | ||
|
|
||
| if (diffViolations) { | ||
| const formattedMatches = Array.isArray(diffViolations) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff is now persisted in three places per push:
action.diff, stepcontent, and steplogs. All three get serialized into the audit DB on everywriteAudit(NeDB and Mongo). NeDB'sgetPusheshas no projection, so the pushes-list payload also grows by another full-diff copy per push.Now that all consumers read
action.diff(the legacy fallback is only needed for old records), could we dropstep.setContent(diff)and the full-diffstep.log(diff)here and keep just a summary (e.g. diff size)? If you'd rather keep this PR minimal, let's at least note the extra storage copy in the description and track the cleanup as a follow-up.