Conversation
The linked-file status could only say that the file as a whole had changed, and the only ways out replaced everything in one direction. When a single variable moved on disk that was the wrong size of decision, so the way to apply it was to copy the value across by hand. The link now records the digest of each variable's value at every sync, which is what makes it possible to say which side moved for a given variable rather than only for the file. The detail pane marks the entry that differs, and offers to take the file's value or to write its own — both of which touch that one variable and nothing else. A variable the file sets and the item does not is listed in the linked-file section, where it can be added. - Pulling one variable writes nothing, and leaves every other field alone. - Pushing one variable merges into the file as it is now, with that text as the write precondition, so every other line — comments included — stays. - The whole-file digests are only accepted as seen once nothing differs. Recording the file as synced earlier would swallow the changes the owner has not looked at yet. - A variable emptied in the vault but still set in the file stays visible in the detail pane; hiding it left the difference with nothing to click. - The per-variable states hold no values, only which side moved, and they are cleared on lock like everything else derived from vault contents. Links made by earlier versions have no baseline. A variable that differs is reported as diverged rather than attributed to a side that cannot be known; the next sync records one.
An edit landing while the file operation was suspended off-main would have been recorded as the synced value, which then attributed the item's own change to the file on the next check.
With a note above every variable, "is this comment about the entry above or the one below?" is the whole question, and spacing alone leaves it to be measured by eye. - A comment block and the variables it introduces are bracketed by a rule down the left, so what the note covers is drawn rather than inferred. The gutter is always laid out, so variables keep one left edge whether or not their group carries a comment. - Runs of variables are separated by a divider, sections by a wider gap. - Comments are set in the monospaced style the values use: they are text out of the owner's file, not a caption PassStore wrote. - The per-variable sync badge moved from above the entry to directly under the value it is about, and its two choices now line up under the sentence they answer instead of under its icon.
A name and the value under it are one thing; the 8pt gap between them was the same as the one to whatever followed the value, so nothing said which. The label now sits 4pt above its value, and a note or an unresolved difference keeps the wider gap that marks it as a separate statement.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #6 (which is stacked on #5) — this PR's diff is against
feat/env-layout-preservation.Why
The linked-file status could only say that the file as a whole had changed, and both ways out of it replaced everything in one direction. When one variable moved on disk that is the wrong size of decision, so the actual way to apply it was to copy the value across by hand — which is the work linking a file was supposed to remove.
How
The link now records the digest of each variable's value at every sync. That is what makes it possible to say which side moved for a given variable, instead of only for the file:
fileChanged— the file's value moved, the item's did notvaultChanged— the item's moved, the file's did notdiverged— both moved, or the link predates this and the answer is genuinely unknownonlyInVault/onlyInFileThe detail pane marks the entry that differs and offers Use file value / Keep this value. Both apply to that one variable:
The whole-file digests are accepted as seen only when nothing differs any more. Recording the file as synced after a partial pull would quietly swallow the changes nobody has looked at yet, so until then the file-level status keeps reporting that both sides hold something the other does not — which is true.
A variable emptied in the vault but still set in the file now stays visible in the detail pane. It used to be hidden as an empty value, which left the difference with nothing to click.
Security
The cached per-variable states carry no values — only which side moved — so unlocking and browsing does not leave a cache of every linked file's secrets in the view model. The value is read from the file at the moment it is applied. The cache is cleared on lock with the rest of the derived state, and there is a test for that.
The per-variable baseline is a SHA-256 of each value, stored inside the encrypted vault, the same shape as the digests the dismissed-health-finding records already keep.
Compatibility
syncedFieldDigestsis a new optional field on the link, decoded withdecodeIfPresent. A link made by an earlier version has no baseline, so a variable that differs is reported asdiverged— no invented direction — and the next sync in either direction records one.Tests
New
EnvFieldDriftTests/EnvFieldSyncTests: attribution of each side's move (and of a repeated variable, resolved last-wins as dotenv readers do); no baseline meaning unattributed rather than guessed; matching values never reported; pulling one variable leaving the others, the file and the whole-file baseline alone while keeping the replaced value in history; pushing one variable keeping a comment and an untracked variable added on disk; resolving the last difference marking the item in sync; adding a variable that exists on only one side, in each direction; and locking clearing the cache.