Skip to content

sync_shared: optional version lock key, the release tag on the locked commit (F14) - #31

Merged
SDNick484 merged 1 commit into
mainfrom
audit/lock-version-tags
Nov 10, 2026
Merged

SDNick484 merged 1 commit into
mainfrom
audit/lock-version-tags

Conversation

@SDNick484

Copy link
Copy Markdown
Owner

Refs #16 (F14 (b): tag main so shared.lock can carry a human-readable version next to the SHA).

Convention change: the lock may carry version = "vX.Y.Z". It is a label; the commit stays the pin.

Behaviour

Command With this PR
--update Looks up release tags on the commit it moves to (one GET /repos/{repo}/tags?per_page=100) and writes the highest. A release beats its own -rcN; non-version tags are ignored. Untagged → no version key, and a stale one is dropped.
--update on an already-locked commit that has since been tagged Adds the version: shared.lock: already at 84bf57a (v0.1.0)
--update when the tag lookup fails (rate limit, network) Warns, doesn't fail. If the commit is unchanged, the old version is kept; if it moved, none is written.
--check shared files: all 16 match mcp-server-shared at 84bf57a v0.1.0 (locked)
sync_all_siblings.py status COMMIT column: 84bf57a v0.1.0
read_lock version is a known key (no F9 warning). Anything other than a strict vX.Y.Z[-pre] is refused, because the value is written back into TOML verbatim.

Rollout: why the reader doesn't need a separate release

Siblings run their own copy of sync_shared.py (sync_all_siblings.py calls scripts/sync_shared.py in each sibling). --update fetches the new script and writes the lock in one run, using the running (old) copy's dump(). So:

  1. Merge this PR.
  2. B: sync_all_siblings.py update --pr. Each sibling's old script (from ea07617) writes the new sync_shared.py (reader + writer) and a lock without version, because the old script doesn't write it. No warnings anywhere.
  3. Merge the 9 sync PRs. Every sibling now runs a script that reads version.
  4. Next sync after a tagged main. The new script writes version, and the same commit carries that script, so the only reader of that lock is one that knows the key.

An older script only sees the key if someone copies a lock by hand or downgrades the script. Even then it warns and ignores the key (F9 warns, it doesn't fail).

Rollback: delete the version line. Every script, old or new, accepts a lock without it.

This gives you the "reader first, then writer" ordering from one PR. If you'd still rather split it (reader now, writer after B), say so and I'll cut the writer into a stacked draft.

The tag itself

Not pushed. See my question in the session about which commit v0.1.0 should be: today's main (84bf57a), or the main that B releases after the A-series merges. Only a tagged commit that B (or a later sync) moves to gets a version in sibling locks.

Tests

  • 8 new tests: update records the tag; an untagged commit gets none and a stale one is dropped; a later tag is picked up; tag precedence (v1.10.0 > v1.9.0 > v1.10.0-rc2); a failed lookup keeps or drops the version as described; round trip with a bad-value refusal (incl. a TOML-injection attempt); odd API answers; the status column.
  • The fake GitHub fixture serves /tags.
  • 91 sync tests pass; ruff, format and mypy are clean. The full suite's only failure is the existing hypothesis flake fixed in logsafe: redact() masks e-mail addresses; anchor the quadratic URL-password rule #28.

🤖 Generated with Claude Code

…ocked commit (F14)

shared.lock may now carry `version = "v0.1.0"` next to `commit`. It is a label
for people; the SHA stays the pin.

- --update looks up the release tags on the commit it moves to (one call to
  GitHub's tags endpoint, first 100) and writes the highest (vX.Y.Z[-pre];
  a release beats its own -rcN), or leaves the key out when the commit is
  untagged. Tagging the locked commit later is picked up by the next --update
  ("already at 1a2b3c4 (v0.1.0)"). A failed lookup warns and doesn't fail the
  update: same commit keeps its version, a new commit gets none.
- read_lock knows the key (no unknown-key warning) and refuses anything that
  isn't a strict vX.Y.Z[-pre]: the value goes back into TOML as written.
- --check's label and --update's message show it; so does the COMMIT column
  of sync_all_siblings.py status.

Rollout: siblings run their own copy of this script, and --update writes the
lock with the copy that is running, i.e. the one from before the update. So
the sync that delivers this script still writes a lock without `version`; the
key first appears on the following --update, written and then read by a
script that knows it. An older script only ever sees it if a lock is copied
or downgraded by hand, and then it warns and ignores the key. Rollback:
delete the line.

Refs #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SDNick484
SDNick484 merged commit 09d5efa into main Nov 10, 2026
4 checks passed
@SDNick484
SDNick484 deleted the audit/lock-version-tags branch November 10, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant