-
Notifications
You must be signed in to change notification settings - Fork 0
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
RFC: Update timestamps to reflect dev status changes #203
base: main
Are you sure you want to change the base?
Conversation
2099be4
to
ae87602
Compare
); | ||
// Update the timestamp for all the designs that updated their dev status | ||
await Promise.all([ | ||
await jiraService.submitDesigns( |
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.
@Roystbeef I think I'm missing something here. Can you provide some detail about how this process works?
From what I can tell:
figmaService.getAvailableDesignsFromSameFile
returns the node with the storeddevStatusLastModified
on line 47 above- Then here you send the design to Jira and update the
devStatusLastModified
at the same time
Wouldn't this send a stale value to Jira?
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.
Thank you for the description in the summary. I understand how this works now. My concern with this approach is it's a lot of complexity to workaround an issue that is better solved in Figmas API.
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.
My concern with this approach is it's a lot of complexity to workaround an issue that is better solved in Figmas API.
Yeah I agree that having Figma's API handle this is most definitely the better long-term solution. My understanding of the situation is the current lastModified
value we currently expose for nodes just surfaces a value that previously was only used privately for a different set of use cases. There's a few approaches we could take for this API going forward (eg. building it with the REST API in mind so that devstatus changes (among others) are reflected in the timestamp).
Unfortunately, IMO this is the only feasible solution to getting this ready by GA and IMO feels better scoped since any tech debt we're introducing is only on the relevant integration :/
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.
Sounds good @Roystbeef and we're happy to defer to you as maintainer of the app however please consider this issue was not raised by customers but only found by us while testing. You could defer until Figmas API can be changed, keeping this workaround in your back pocket in case you receive feedback from customers.
src/infrastructure/figma/transformers/figma-node-transformer.ts
Outdated
Show resolved
Hide resolved
Jira handles out of order processing and will store entities with older lastModified (updateSequenceNumber in the Jira API) if it hasn't received that version before, or if it has received that version, Jira will ignore the update. While it should not cause a problem, it is unusual because you'd be sending updated data with an older version number. |
hmm, this sounds like we have quite a bit of leeway then. In theory, we wouldn't need to keep track of the
There should be no difference in data when this occurs. Since neither the node nor its dev status will have been modified in this case. |
589d62b
to
ec33e57
Compare
default to `UNKNOWN` and `Date(0).toISOString()` or our DB values. This simplifies the the logic here by not having to fork behavior based on nullable values
549a880
to
8acdb69
Compare
Summary
This PR adds logic to use the file's last modified time for a node when the node's dev status changes. This is to work around the fact that a node's lastModified time is not updated when its dev status changes in Figma.
In order to track this, I've added the following fields to
associated_figma_design
devStatus
lastUpdated
The
devStatus
just tracks the last devStatus we read from the node so we can detect when it changes to use the file's last modified timestamp instead.the
lastUpdated
track the last timestamp we sent to Jira. This is useful when the following series of events occurs:In this case, we want to use the timestamp we previously used on the node when only the devStatus changed
These fields start off as
AtlassianDesignStatus.UNKNOWN
andnew Date(0).toISOString()
which happen to be the same as when an associated design added using the backfill migration.getLastUpdatedTimeForNode
is where the bulk of the complexity lies:Most of the time we want to use the last modified time we have on the node. The exceptions to this are:
The devStatus and lastUpdated time we send to Jira are always written to the DB (for simplicity).
The one thing to call out is after we deploy this change, since we default to
AtlassianDesignStatus.UNKNOWN
, we'll miss any updates where the devstatus for a node has changed but the node itself hasn't. Subsequent changes to the devstatus for those nodes will, however be captured. IMO this is okay since we're running into this for every dev status change currently.Test Plan