Skip to content

Move Content Time Forward on an Equal-Time Update, and Re-Check Other Buckets After the Prompt - #4196

Merged
ptr727 merged 5 commits into
developfrom
feature/secrets-sync-promotion-fixes-2
Nov 15, 2026
Merged

ptr727 merged 5 commits into
developfrom
feature/secrets-sync-promotion-fixes-2

Conversation

@ptr727

@ptr727 ptr727 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Answers two of the five findings the hosted review raised on the promotion's second round, #4194. The other three, two about a parent directory swapped for a link and one about title_for listing names through a link, are declined with evidence in their threads under the trust-boundary rule.

  • An equal-time update moves the content time forward. An update whose file is not strictly newer than the remote content time now records forced_time, not that same time again. So a host still holding the replaced bytes at that timestamp reads them as older, and it can't push them back without --overwrite-newer.
  • Other buckets are re-checked after the prompt. Where a prompt was shown and a plan creates an item, push lists the other Secrets * buckets again after it. A title another bucket took during the prompt is then refused rather than duplicated.

Verification

  • python3 tests/test_secrets_sync.py: 156 tests, OK. Both new cases also ran against develop's script and failed there.
  • ruff format, ruff check, mypy and the .husky/pre-commit hook are clean.

Local review

The docstring finding this body listed is fixed in f19e84b and 4fa6b83. The docstring now states each write's content time, and the pass covering this head raised no findings.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Pushes now recheck for duplicate titles in other secrets buckets after confirmation, preventing a push if a conflict appears while you are prompted.
    • When updating content with a timestamp equal to the existing content timestamp, the push now advances the timestamp. If remote content is newer, the resulting timestamp is set just after the remote timestamp.
  • Documentation
    • Clarified how push handles duplicate titles and content timestamps for creates, updates, and retags.

ptr727 and others added 3 commits November 15, 2026 11:31
… Buckets After the Prompt

An update whose file is not strictly newer than the remote content time
now records forced_time, so a host holding the replaced bytes at that
same timestamp reads them as older. Push lists the other buckets again
after its confirmation prompt, so a title another bucket took during the
prompt is refused rather than duplicated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nt-Time Docstring

The post-prompt cross-bucket check runs only where a prompt was shown
and a plan creates an item, so a --yes push or an updates-only push
lists nothing extra. The content_time docstring says an update whose
file is not strictly newer records forced_time, and the equal-time test
moves beside its content-time siblings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 15, 2026 19:38
@ptr727

ptr727 commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head fed147b0893e8206599c8f8169007f8bb1064bca, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The push flow now uses a forced content time when the local modification time is not later than the remote content time. For confirmed pushes that include creates, it rechecks cross-bucket title conflicts before writing.

Changes: Secrets push behavior

Layer / File(s) Summary
Content-time selection
scripts/secrets_sync.py, tests/test_secrets_sync.py
Update plans use the local modification time only when it is strictly later than the remote content time. Otherwise, they use the forced time. The test covers an update whose modification time equals the existing content-time tag.
Post-confirmation title check
scripts/secrets_sync.py, tests/test_secrets_sync.py, scripts/README.md
When a confirmed push includes a create, the command re-lists vaults and checks for cross-bucket title conflicts. The test verifies that a title acquired during confirmation causes the push to fail without writes. The documentation describes the check and content-time selection.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 4190: The update changes content-time selection for updates that are not newer than the remote content time. It does not add the proposed mtime:<iso> content-time tag.
  • Issue 4191: The change rechecks cross-bucket title conflicts after confirmation for pushes that include creates. It does not implement the issue’s proposed pre-push listing of every bucket.
Merge Risk: Minimal · up to 4fa6b

This change makes secrets pushes safer: replaced content can no longer be pushed back silently, and a title claimed in another bucket during the confirmation prompt is refused rather than duplicated. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names two changes that the changeset makes: the equal-time update now records forced_time (the summary says non-strictly-newer updates use forced_time, and a test covers an update whose mtim…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two changes that the changeset makes: the equal-time update now records forced_time (the summary says non-strictly-newer updates use forced_time, and a test covers an update whose mtime equals the content-time tag), and cmd_push re-checks other buckets for title conflicts after the confirmation prompt. Both match the objectives. The title is long at 15 words and 94 characters, and it uses title case, but it is specific and accurate.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b6c6bed and 4fa6b83.

Files selected for processing: 3

  • scripts/README.md
  • scripts/secrets_sync.py
  • tests/test_secrets_sync.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change still has an active documentation inconsistency in the overwrite-path contract: the docstring does not describe the strictly-newer local mtime behavior.

1 open issue
What changed in this PR

This PR hardens the secrets synchronization workflow by advancing content timestamps for equal-time updates and rechecking cross-bucket ownership after confirmation.

Changes:

  • Advances content timestamps when local content is not strictly newer than the remote content.
  • Rechecks other buckets after the push confirmation prompt.
  • Adds regression tests and updates the synchronization documentation.
File Description
tests/​test_secrets_sync.py Adds regression tests for equal-time updates and titles claimed by another bucket during confirmation.
scripts/​secrets_sync.py Updates content-time handling and adds post-prompt cross-bucket ownership validation.
scripts/​README.md Documents the revised timestamp and bucket recheck behavior.

Review effort: Lite

Comment thread scripts/secrets_sync.py Resolved
@ptr727

ptr727 commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 4fa6b83521acbac35e50a72cdca785be73332538, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.05%. Comparing base (b6c6bed) to head (4fa6b83).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4196   +/-   ##
========================================
  Coverage    78.05%   78.05%           
========================================
  Files           42       42           
  Lines        15319    15319           
========================================
  Hits         11958    11958           
  Misses        3361     3361           
Flag Coverage Δ
python-3.13 78.05% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit c6064d7 into develop Nov 15, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/secrets-sync-promotion-fixes-2 branch November 15, 2026 20:00
ptr727 added a commit that referenced this pull request Nov 15, 2026
…#4194)

## Summary

Promotes the 1Password secrets sync tool and its review fixes from
`develop` to `main`.

- #4165: adds `scripts/secrets_sync.py`. It syncs secret files between a
home directory and 1Password through the `op` CLI, with one vault per
bucket and one Document item per file.
- #4193: fixes the three review findings deferred from #4165, so the
tool can ship.
- Staleness is judged by a content-time tag, so a mode-only retag no
longer reads as newer content.
  - Push refuses a title another bucket already holds.
  - Pull refuses to replace a file another user owns.
- It also adds stale-plan refusals on push, pull and archive, a named
recovery for an update interrupted between its content and tag writes,
and a re-time on pull for files the #4165 code wrote.
- #4195: answers this promotion's review. Pull re-checks the remote item
and the session after its prompt, a pulled file's mtime is set before
the rename, and a selftest that leaves its scratch vault behind exits 2.
- #4196: answers the promotion's second review round. An update at an
equal content time moves the time forward, and push re-checks other
buckets after its prompt.

Native Windows verification of the tool stays tracked in #4188, which
this promotion leaves open.

Closes #4190
Closes #4191
Closes #4192

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants