-
Notifications
You must be signed in to change notification settings - Fork 432
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
feat(migrate): write a log file of all submitted transactions #5757
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
const stats: MigrationProgress = { | ||
documents: 0, | ||
mutations: 0, | ||
pending: 0, | ||
queuedBatches: 0, | ||
completedTransactions: [], | ||
completedTransactionsLength: 0, |
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.
this wasn't strictly needed for this PR, but we didn't use the array for anything else than reading it's length, so thought I'd might as well free up some memory.
Full Report@sanity/portable-text-editor
@sanity/migrate
@sanity/block-tools
@sanity/types
sanity/desk
@sanity/mutator
@sanity/cli
sanity/structure
@sanity/util/concurrency-limiter
@sanity/util/legacyDateFormat
@sanity/schema/_internal
@sanity/util/paths
sanity/router
@sanity/schema
sanity/cli
@sanity/vision
@sanity/util/fs
sanity/_internal
@sanity/util/client
@sanity/util/createSafeJsonParser
sanity/_internalBrowser
@sanity/util/content
sanity
@sanity/diff
|
Component Testing Report Updated Feb 16, 2024 8:44 AM (UTC)
|
489c73f
to
930f2bb
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.
I did successfully generate a logfile and personally feel that doing it by default makes sense, especially as this feature is so new.
I'd like us to surface the no-transaction-log flag pretty quickly to customers, I can see this being a possible footgun since it's not particularly visible and our docs on this are pretty verbose.
I also think the more verbose log return will be a pretty quick feature request but likely more as a series of diffs.
Thanks for the review!
Not sure I understand what you mean by this. What's the footgun here?
Agree! I like the idea of logging as a diff against the current/before-document. It's a slightly more involved task, so I'll file it as a feature request for now, so we can track signal. |
930f2bb
to
aedf68f
Compare
Apologies! "Footgun" was maybe too strong a word here. "Possible inconvenience" or "source of confusion" would have been more accurate. Here's my concern more explicitly: I expect that a number of developers will run these on sometimes high amounts of documents, generating logfiles with tens of thousands of lines each. As far as I can tell, we don't really offer any advice on how these logfiles fit within a typical development workflow. Is it annoying when I accidentally commit these to Git? Or am I supposed to commit these? In what situations should I or should I not keep these logfiles around? So for me, a small source of trouble is really just generating large-ish files and possibly having to keep them around by default. I don't think it's a big issue at all, but just one of those places where I think users would appreciate an opinionated workflow and rationale for what they should do with the things we're generating for them. |
These are good points and I agree with you @cngonzalez. Open for suggestions on how to proceed, but I'm thinking an acceptable path forward would be to:
e.g.:
That should remove some of the potential confusion I would hope? What to do with logfiles in terms of git/source control is something we should still document (I'd say they should be ignored). |
Closing this for now - might pick it up at a later point |
Description
This writes a log of all transactions submitted during a migration to a file within the migration directory. The logfile consists of newline delimited responses from the /mutate API endpoint. I'm going for a tradeoff between minimalistic and valuable here, and did not include the changed documents this time, because of the potential for filling up lots of disk space if running migrations on high volumes. We can always consider making it configurable behind a flag later.
Example output:
☝🏼 The last two lines here are new
What to review
Testing
Notes for release
sanity migrate
now logs all submitted transactions to a file during a migration run.