Skip to content

Judge secrets_sync Staleness by Content Time So a Retag Cannot Hide a Newer Local Copy #4190

Closed

Description

@ptr727

Problem

scripts/secrets_sync.py judges staleness by comparing a local file's mtime with the remote item's updated_at. A retag, which is a mode-only push, moves updated_at forward without changing the content.

So on a second host that holds a newer, unpushed copy of the same file:

  • pull reads the local copy as older than the remote one, and pull --yes overwrites it.
  • A later push from that host skips the file as stale.

How to Reproduce

With the fake op in tests/test_secrets_sync.py: push a file from one temporary home, edit the same title in a second temporary home so its mtime is later, then retag the item from the first home. Pull into the second home with --yes. The newer local content is replaced.

Fix Direction

The review pass recommends recording each pushed file's content time in a second tag, mtime:<iso>, and judging staleness against that tag rather than updated_at. A retag then leaves the content time alone. An item with no such tag needs a stated rule, such as falling back to updated_at.

Scope

Reachable only when two hosts hold the same title. Fix before the tool is used from a second host.

Deferred from #4165 by the maintainer's decision, where a local strict-review pass raised it.

Activity

  1. ptr727 commented on Nov 15, 2026

    @ptr727
    OwnerAuthor

    Answered by the maintainer, 2026-11-15. Push records the content time in an mtime:<UTC ISO> tag, and a retag keeps it. An item with no such tag reads as its updated_at, and its next push adds the tag. Pull sets each written file's mtime to the item's content time, so both sides compare on one clock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions