-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cards are likely collapsed into a single deck on push
operations
#109
Comments
Since the test DSL is mostly finished, writing a test for this bug is now the highest priority! 😡 |
Can be fixed by making all cards symlinks. So now there is no special "ground-truth" card anywhere in the repository. We have a This way there are never any dangling symlinks when we move the "ground-truth" card to another deck, because there is none. And thus the symlinks always point to the same thing. We should probably not try to deduplicate card symlinks in a single deck. The symlink names will be of the form |
The existing See: https://stackoverflow.com/a/46807414 Then we'll add another subroutine that does the diffs for the card links. Since card content is completely determined by the note content, this will only exist to set decks. We follow the symlink to get the So in fact the |
Okay, but with this new structure, how does a user create a new note from the filesystem? |
Users will have to create new notes with a subcommand, We need the The |
This is becoming stupidly complicated. What if we just forget about the "location of card is the deck" thing and just have a bunch of note files in a flat directory, and each note file has a section: ### Decks
```
Card 1: aa::bb
``` |
Or a pre-commit hook that refreshes the filenames of everything in the This seems like the most promising approach. It remains to be seen whether there will be too much name churn for Thus the plan so far should be to implement |
Should we even allow cards generated from a single note to be in different decks? Are there any legitimate use-cases for this? What if instead, we assume that most notes have all their cards in the same deck, and we create a top-level Alternatively, for notes whose cards are split between decks, all such cards usually share some superdeck, so perhaps we just include them in their last common ancestor deck. But then how do we represent deck changes? Uh oh, it doesn't work out nicely 😢 |
Okay, the plan that seems okay is:
|
What if we just not support cards in different decks? We can make the program error-out when this happens. |
It looks like calls to
update_note()
will collapse cards into whatever deck the single source-of-truth file is in. See below:ki/ki/__init__.py
Lines 484 to 491 in 44e497f
This is a major bug, and I'm surprised we don't have a test for it yet. It is also slightly difficult to detect, since roundtripping does work so long as we don't make changes to notes locally.
This will require some changes to the
diff2()
logic, since for every symlink that's been modified, renamed, added, or deleted, we should check both thea_file
andb_file
for affected cards, and update the decks accordingly using calls tocol.set_deck()
.The text was updated successfully, but these errors were encountered: