-
Notifications
You must be signed in to change notification settings - Fork 7
feat: allow actions to run after other action #1027
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
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
eec0167
feat: add action success events to db
tefkah 4ce4eb8
feat: setup basic chain actions
tefkah 67a8e29
chore: merge
tefkah d455437
fix: remove unique constraint
tefkah ec99078
fix: fix types for actioninstancescontext
tefkah 3ce58ce
fix: ignore error
tefkah e2ba8e0
fix: fix type errors
tefkah d4bff98
feat: progress
tefkah 0cd8be8
chore: remove logs
tefkah cb16088
chore: fix type errors
tefkah a5b4552
fix: make work
tefkah 29b5048
dev: allow rules to be seeded
tefkah 4dadc0d
dev: add tests
tefkah 74e95c7
Merge branch 'main' into tfk/rule-after-action
tefkah 91774c5
fix: update seed scripts
tefkah 076387e
Merge branch 'tfk/rule-after-action' of https://github.com/pubpub/pla…
tefkah af205db
fix: correctly fail actions if they return clientException, and check…
tefkah eadb6c2
feat: add max stack depth protection at rule run- and creation time
tefkah a34cef8
fix: fix type errors
tefkah a3516d6
fix: fix test
tefkah e173c15
dev: add chained rules to croccroc seed
tefkah ca92e0f
dev: add sequential rule test
tefkah 2d83030
dev: add better logs for failing action trigger in flock
tefkah f4da9e0
chore: make minio startup faster
tefkah 6d9465a
fix: make jobs work when self hosting
tefkah 58555c3
fix: set pubpub url correctly for jobs during tests
tefkah 8f6f390
fix: remove some logs and comments
tefkah c91ba97
Merge branch 'main' into tfk/rule-after-action
tefkah a13d506
chore: remove some comments
tefkah 6621b11
chore: clean up rules a bit
tefkah 56a4bc3
fix: remove commented out 'use server'
tefkah bf6cd9a
chore: merge
tefkah 7d048da
Merge branch 'main' into tfk/rule-after-action
tefkah 5621ede
Merge branch 'main' into tfk/rule-after-action
tefkah 4ddab90
fix: use new action seed syntax
tefkah 322c039
chore: also stub sentry
tefkah e7fbafe
chore: merge
tefkah fcf8bf0
refactor: rename triggering/watchedAction(instance) to sourceAction
tefkah cbc3d98
fix: revert platform-migrations changes
tefkah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,29 +29,29 @@ const pubTriggerTestSeed = async () => { | |
}, | ||
stages: { | ||
Submission: { | ||
actions: [ | ||
{ | ||
actions: { | ||
"1": { | ||
action: Action.log, | ||
config: { | ||
debounce: 1, | ||
}, | ||
}, | ||
{ | ||
"2": { | ||
action: Action.email, | ||
config: { | ||
recipient: "[email protected]", | ||
recipientEmail: "[email protected]", | ||
body: "Hello", | ||
subject: "Test", | ||
}, | ||
}, | ||
{ | ||
"3": { | ||
action: Action.googleDriveImport, | ||
config: { | ||
docUrl: "https://docs.google.com/document/d/1234567890", | ||
outputField: `${slugName}:title`, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
pubs: [ | ||
|
@@ -83,9 +83,10 @@ describe("runActionInstance", () => { | |
pubId: pubs[0].id, | ||
event: Event.pubEnteredStage, | ||
communityId: community.id, | ||
stack: [], | ||
}); | ||
|
||
expect(result).toEqual({ | ||
expect(result).toMatchObject({ | ||
success: true, | ||
report: "Logged out some data, check your console.", | ||
data: {}, | ||
|
@@ -101,7 +102,7 @@ describe("runActionInstance", () => { | |
expect(actionRuns).toHaveLength(1); | ||
|
||
expect(actionRuns[0].status).toEqual(ActionRunStatus.success); | ||
expect(actionRuns[0].result, "Action run should be successfully created").toEqual({ | ||
expect(actionRuns[0].result, "Action run should be successfully created").toMatchObject({ | ||
success: true, | ||
report: "Logged out some data, check your console.", | ||
data: {}, | ||
|
@@ -133,6 +134,7 @@ describe("runActionInstance", () => { | |
docUrl: fakeDocURL, | ||
}, | ||
communityId: community.id, | ||
stack: [], | ||
}); | ||
|
||
expect(result).toEqual({ | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
since im passing around the
scheduledActionRunId
anyway, i don't need to look it up anymore (which was flaky).what this was doing at first was incorrect anyway. it was based on the (then already) invalid assumption that there would only be one action run scheduled per action instance per stage per pub.
basically, when we just had the
pubEnteredStage
rule for a specificactionInstanceId
, i wouldscheduled
ActionRun
scheduled
ActionRun
for that actionInstance and pub, and update it.however this was very finicky. if for instance, you move a pub in and out of a stage twice, you'd end up with two scheduled actioninstances for the same pub id. then this query would fail, as
eb.selectFrom
would return two actions.this assumption would be even more incorrect now, as one actioninstance now can have many scheduled actionruns (Log1->Log2 and Log1->Log3)
even if i limited this, there was no guarantee i would pick out the correct action run.
therefore, passing around the scheduledActionRunId was the way to go
(btw the reason i am creating/updating the actionrun in the first place is bc i need it to set the
lastModifiedBy
if the action run ends up modifying a pub)