Comments (14)
Hey @jvdevlab . I will need more information in order to be able to do anything about this. Are you able to reproduce this consistently with the bulk update? If so, could you verify that the data modified in the file system is within 5 seconds of the date modified in the frontmatter? If so, then there likely is a bug, but if not, it is going to be very hard to track down this issue.
Also, I would like to rule out syncing across multiple devices being the problem. You are not syncing these files from one device to another are you? If so, the Linter has no way to know where a change comes from except when it makes a change itself. So it is not really feasible to just update date modified when the Linter updates the file (the file system is considered to be the source of truth according to the Linter).
Thanks for helping me better understand what is going on in your case!
from obsidian-linter.
Are you able to reproduce this consistently with the bulk update?
Yes.
I take the vault with 1000+ notes that was already linted according to the enabled rules.
I lint the whole vault again (without changing anything) I get 178 changes. I commit to git.
Repeat. I get 170 changes. Commit
Repeat. I get 133 changes. Commit
...
117
I can repeat it and see if it goes down to 0
You can see how with each run I get less and less files. Each next run is a subset of files from previous run. At first I though maybe these files formatted weirdly or there is something special about them. I compared them to "normal" files (for which date-modified is not changing as expected) but I do not see difference. I used diff to show special chars and whatnot but nothing stands out.
I have another vault with all the same plugins, settings, rules etc. except it has 200 notes and it is not happening there.
If so, could you verify that the data modified in the file system is within 5 seconds of the date modified in the frontmatter?
I checked bunch of offending files.
They all shows modified on Saturday, January 27, 2024, 9:50:33 AM in Windows File Explored
In Frontmatter these files range from: 2024.01.27 09:50:20 to 2024.01.27 09:50:27
Also, I would like to rule out syncing across multiple devices being the problem. You are not syncing these files from one device to another are you?
I'm using Obsidian Sync.
I suspected it as well but I think it is safe to rule out. The above runs that I did (where number of changed files keep decreasing) were done during the time when the other devices were offline. So unless there is an issues with single device and Sync we should be good here.
Update:
I just paused the Sync to make sure. Did 2 runs.
- 108 files changed
- 100 files changed
They issue still there and the count keeps going down...
from obsidian-linter.
Interesting. Is it affecting a subset of the same files? If so, does the same happen if you try linting 10 or so of them at random from the list of previously updated files on mass lint? Make sure that when you do a single file lint you change the log level for the debug tab to trace and enable capturing logs when running the linter on save. You can then post the Linter's logs here which should be able to help identify the issue.
I am guessing based on what you are listing as the date modified time is that the larger the amount of files are that get linted, the farther out of sync the date modified file metadata and the file frontmatter get.
I am definitely open to ideas on how to fix this if we can confirm that is the case. However, I am not 100% sure that is the case. Nor do I have a test setup large enough to test this scenario since it sounds like I need to lint more than a couple hundred files for this to happen.
Sorry that this is getting long. I do want to make sure that you are not using custom commands as a part of the way you use the Linter if you are using it in conjunction with the date modified logic since the Linter is unable to account for modifications made by custom commands which could be causing the date modified update to happen since custom commands could modify the file more than 5 seconds from when the Linter sets the date modified (that is not really fixable at this time).
Thanks for the info so far.
from obsidian-linter.
Is it affecting a subset of the same files?
Yes, the next run even so smaller contains files from previous runs. I didn't compare every single file but it is very much look that way.
If so, does the same happen if you try linting 10 or so of them at random from the list of previously updated files on mass lint?
When I open them one by one and do not change anything and hit ctrl+s it is linting them. Says 4 chars added and 4 removed. (minutes and seconds)
Make sure that when you do a single file lint you change the log level for the debug tab to trace and enable capturing logs when running the linter on save. You can then post the Linter's logs here which should be able to help identify the issue.
See attached file.
log.txt
I am definitely open to ideas on how to fix this if we can confirm that is the case.
I didn't look at your code. But if you tracking all the changes before committing the save can you have a postprocessing routine that would check: If the only linting change is date-modified and date-modified already exist with a value then do not commit changes.
I do want to make sure that you are not using custom commands as a part of the way you use the Linter
I do not
Thank you for the plugin and your help in troubleshooting the issue.
Update
From the log,
Running YAML Timestamp
yaml-timestamp: 0.2999999523162842 ms
Changed the timestamp but it's not clear why...
Update
- As I edit and add new notes, the count of affected notes went up. So it's not something wrong with some set of notes. The issue persist and the count will not go down to 0.
from obsidian-linter.
Interesting. This is not something I am seeing anything in the logs that would indicate what is going on. I am thinking that I need the logs with a modified version of the plugin to make it include information about why it is updating the values.
from obsidian-linter.
Could you reproduce the issue again while using the main.js
from the following zip file and grab the debug logs for the file?
main.zip
To install the main.js
:
- Unzip the zip file
- Copy the
main.js
from the output topath_to_vault/.obsidian/plugins/obsidian-linter/
- Then either start Obsidian or turn off and back on again the Linter plugin
Thanks for helping better understand what is going on in this situation.
from obsidian-linter.
Hey. Just wanted to check back in and see if there was any update on whether or not there will be an attempt to reproduce the issue with the custom plugin logic to help better understand the problem. It has more logging info that should clarify why the logic thinks an update needs to happen. If you do not plan on reproducing the issue with the custom logic, that is fine, it just leaves the actual cause of the problem here as a bit of a mystery.
Thanks!
from obsidian-linter.
@pjkaufman Sorry it was on my todo all week. And I didn't get to it. I will do today.
from obsidian-linter.
Here are the results.
First time I ran the linting on the whole vault it modified date for 544 files. Second time -- 445.
Then I cherry picked a file.
date-created: 2024.01.29 16:34:04
date-modified: 2024.02.11 10:13:08 (this was actually from linting the whole vault)
After manually linted it
date-modified: 2024.02.11 10:27:06
Here I are the relevant part from the log.
---
Running YAML Timestamp
Key found
Text modified already? false
modified date time from frontmatter is undefined? false
modified date time is valid? true
current modified date metadata: 2024.02.11 10:13:24
frontmatter modified date: 2024.02.11 10:13:08
time difference between now file modified at time and frontmatter value? 16
yaml-timestamp: 0.5 ms
---
And then it sets it to date-modified: 2024.02.11 10:27:06
Here is the full log.
obsidian-linter.txt
from obsidian-linter.
I was really hoping it was not the time issue. There is really not that much that can be done to avoid that issue unless I allow the user to specify what time in seconds they think that the metadata should be within or figuring out why it is taking 16 seconds between generating the time for the frontmatter and the saving of the file.
from obsidian-linter.
@pjkaufman can you please expose it as advanced setting? It could have 5 sec default (as you mentioned above) and whoever runs into the issue can set a higher number.
from obsidian-linter.
I am not sure if it will get exposed as a setting. It is a bit tricky since some users will go ahead and bork things by changing it. I will have to think about this and see if it is something that makes sense to do. I would much rather address the root cause of the issue without making a settings change. But that will be difficult given the size of the data set needed to test this scenario.
from obsidian-linter.
Hi @pjkaufman,
There are number of large vaults online that can be downloaded. Quick search gave me this one with 1300 notes. There probably bigger ones. Tricky thing is it might not just be the vault size but the rest of the environment like OS version, etc. So not sure if this will help with finding the root cause.
Can you point me to the constant value in the code? (hopefully it's in one place) I can change it locally. And keep changing every time I take a plugin update. I don't know if the Obsidian plugins allow you to externalize constants on the code level. In a way that you can update the plugin but constant will remain the same. This way it will be truly advanced settings as it will not be exposed in the UI.
from obsidian-linter.
The constant in the code is located here. It is not really a constant. It just is used in place since it is only needed there to represent 5 seconds.
from obsidian-linter.
Related Issues (20)
- Bug: numbered list markers all become "1." HOT 3
- Bug: preview mode lint of daily note funnnnnky results HOT 4
- Bug: Linter removes the # from the Share Note share_link URL HOT 1
- Bug: Unable to parse url correctly HOT 2
- Bug: i can't insert yaml by using linger HOT 5
- FR: improve YAML key sort to "at Start" and "at End" order
- Button to exclude file/folder from Linter HOT 2
- Question: Copy `复生吸芽 mAP\@.5` but the pasted text is `复生吸芽 mAP\@`. how to fix it? HOT 3
- FR: Enabling personal additions to auto-correction map HOT 3
- Bug: Smart quotes get applied in Markdown image links HOT 5
- Bug: random deletion of characters/words/line breaks throughout the note HOT 17
- Bug: footnote-after-punctuation fails if reference name contains hyphen
- Question: Custom Command: converting multiple single lines to bullet points HOT 2
- FR: empty line around lists HOT 7
- Bug: Tag Regex Matches Punctuation Like `:` Which Causes Other Problems HOT 4
- Bug: Header capitalization rule does not update link text HOT 2
- FR: Support Obsidian-style comment for inline linter toggle HOT 1
- Bug: "Lint the current File" command failed to execute HOT 4
- Bug: "Move Tags to YAML" breaks when tags have a `/` HOT 5
- Bug: Remove space header when option `RemoveSpaceAroundCharacters` is enabled and Katakata is beginning of the line HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obsidian-linter.