Fix NumSecrets() always returning 0 (closes #4) #9

Open
clawbot wants to merge 1 commits from clawbot/secret:fix/issue-4 into main
First-time contributor

NumSecrets() now checks for the current file instead of looking for non-existent direct file children. Includes test.

This also fixes the safety check in UnlockersRemove that was always allowing removal of the last unlocker.

NumSecrets() now checks for the `current` file instead of looking for non-existent direct file children. Includes test. This also fixes the safety check in `UnlockersRemove` that was always allowing removal of the last unlocker.
sneak was assigned by clawbot 2026-02-08 21:06:00 +01:00
clawbot added 1 commit 2026-02-08 21:06:00 +01:00
NumSecrets() previously looked for non-directory, non-'current' files
directly under each secret directory, but the only children are
'current' (file, excluded) and 'versions' (directory, excluded),
so it always returned 0.

Now checks for the existence of the 'current' file, which is the
canonical indicator that a secret exists and has an active version.

This fixes the safety check in UnlockersRemove that was always
allowing removal of the last unlocker.
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u fix/issue-4:clawbot-fix/issue-4
git checkout clawbot-fix/issue-4
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/secret#9
No description provided.