Repository navigation
Store Secret Sync Metadata in Item Fields, Not 1Password Tags - #4427
Conversation
secrets_sync.py now reads and writes each item's mode and content time as the mode and mtime text fields of a sync section on the item, through op item edit assignments and op item get. It never reads or writes a tag, so a push leaves an item's tags as they are and the account's tag list stops growing with every content change. The listing carries no fields, so a per-item op item get runs wherever the metadata decides the outcome: status --bucket, pull, push, and the read back. status with no bucket reads no item's fields. A create writes the document, then its fields, and warns with the --mode recovery where the field write fails. The plan action for a metadata-only write is now "fields". selftest measures the sync fields instead of the tags, and the field shape stays unmeasured against a live op. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Lists A create that stopped between the document and its fields, at the listing that finds the new item's id or on an interrupt, left the item without its sync fields and printed no recovery. The warning now covers that listing as well as the field write, with a test for each way the create can stop. The op item get and op item edit argument lists are built once and shared with selftest, so selftest measures the exact calls push and pull send, and selftest no longer reads the same item twice. The check that op item get returns the requested id is removed, since that output is the account's own read back by explicit id. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A document create that reported a failure the read-back could not confirm, or that an interrupt stopped, may still have landed with no sync fields. The --mode recovery warning now covers the create call too, with a test for each case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
🟡 Changes recommended
A critical active finding shows section resolution skips all sync fields for the documented item JSON shape, breaking pull, status, and push until the lookup and fixture are corrected.
1 open issue
What changed in this PR
Moves secret synchronization metadata from account-wide 1Password tags into per-item sync.mode and sync.mtime fields while preserving user-defined tags.
Changes:
- Reads and writes metadata through
op item getandop item edit. - Updates create, push, pull, status, recovery, and self-test behavior.
- Expands tests and documentation for field-based metadata and migration.
| File | Description |
|---|---|
| tests/test_secrets_sync.py | Updates the fake op implementation and regression coverage for field-based synchronization metadata, recovery, validation, tags, and self-test behavior. |
| scripts/secrets_sync.py | Implements storage, reading, validation, recovery, and verification of synchronization metadata in item fields. |
| scripts/README.md | Documents the sync field format, field-based workflows, recovery behavior, migration implications, and self-test expectations. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4427 +/- ##
===========================================
- Coverage 81.60% 79.62% -1.99%
===========================================
Files 26 47 +21
Lines 9070 16398 +7328
===========================================
+ Hits 7402 13057 +5655
- Misses 1668 3341 +1673
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action not completed
|
The op item get field shape is unmeasured, and a field's section object may carry only its id, with the label in the item's top-level sections array. Reading the label from the field alone would then find no sync field on any item, and every pull and push would refuse. The label is now read from the field's section object, or else by that object's id from the sections array, with a test of the id-only shape. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
…lts, Secret Sync Fields, and Audit Account Fixes (#4428) Promotes the 28 pull requests that landed on develop since the last promotion (#4388), from the away-mode backlog burndown run. - #4391: Drop the false XML comment suppression claim from the .NET conventions. - #4390: Blank quotations after a heredoc label on its opening line in the paste-safe rule. - #4392: Carry attention lists, cut lists, and opt-in billing in the `backlog_metrics.py` JSON. - #4393: Gate `configure.sh apply`'s interaction limit on a committed bot verification record. - #4394: Make the gh and node report note say a one-line vendor source is configured. - #4395: Add ShellCheck and shfmt lint tasks to the VS Code task snippets. - #4396: Count a CodeRabbit clean pass on the head in the digest's `other_reviewed`. - #4401: Date the line-ending intentRefs by the skill and trim advisory restatements. - #4399: Share one any-level heading region primitive between `heading_body` and `extract_anchored`. - #4398: Name the hub pull requests a standup lands through, and add HACS first-run guidance. - #4404: Add a PowerShell section to CODESTYLE.md and narrow the shell rule. - #4405: Close AUDIT.md section 10's convergence loop and fix three skill pointers. - #4409: Route CODESTYLE.md's General section to the language skills (part of #1153, which stays open). - #4410: Detect a C# test project by its own text rather than its file name. - #4411: Drop the unruled "working gate is not drift" sentence from CODESTYLE.md. - #4412: Track the newest upstream line of each pinned host tool. - #4413: Correct AUDIT.md section 0's account of what the audit checks. - #4416: Add a required coverage shield class to the README audit. - #4414: Tie drive-pr's merge to its authorization and align the pass moments. - #4417: Pass over a second SIGTERM in `pr_review.py` so an interrupt prints one line. - #4418: Point the report-path placeholder at AUDIT.md section 8. - #4419: Correct the audit account copies outside AUDIT.md section 0. - #4422: Drop the archived DevKitCIoT from the rollout checklists. - #4423: Report a stale `pullRequestCheck: false` and correct AUDIT.md section 6. - #4424: Add a `prune` subcommand to retire orphaned canonical review passes. - #4425: Drop the archived DevKitCIoT from the reusable-workflows checklists and fix a normalization docstring. - #4427: Store secret sync metadata in item fields, not 1Password tags. - #4426: Declare and apply the Actions workflow token defaults through `configure.sh` (the `configure.sh` part of #1783, which stays open). ## Owed by the maintainer - #4412: A live run of the new host-tool line tracker. Scheduled runs start only once this reaches `main`, and a `workflow_dispatch` would prove it sooner. - #4426: A fleet `configure.sh apply` for the workflow token defaults, after the per-repository read the 2026-11-01 answer requires. Please also confirm the new `--lower-workflow-token` option, which a `write` repository needs for the apply to lower its default. - #4427: Run `python3 scripts/secrets_sync.py selftest`, then the cleanup script in that pull request's body (`move_sync_tags.py`, dry run first, then `--apply`). Until that runs, every un-migrated secret item refuses to sync. - #4393: The pilot's first interaction limit is set by hand in its settings and its bots verified there. The verification record is committed afterwards through a hub pull request, and only then does `apply` set the limit fleet-wide. - A fleet resync is owed, because carried text changed: AGENTS.md, GOVERNANCE.md, CODESTYLE.md, and several skills. Fixes #4387 Fixes #4383 Fixes #4284 Fixes #1095 Fixes #4299 Fixes #4370 Fixes #4364 Fixes #4173 Fixes #4064 Fixes #3536 Fixes #3929 Fixes #3808 Fixes #3812 Fixes #3810 Fixes #4320 Fixes #4232 Fixes #1748 Fixes #1607 Fixes #1270 Fixes #1170 Fixes #3692 Fixes #4415 Fixes #3908 Fixes #1648 Fixes #4276 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Summary
scripts/secrets_sync.pynow keeps each item's sync metadata in item fields instead of 1Password tags. The file mode and the content time are themodeandmtimetext fields of asyncsection on the item. They are written withop item edit <id> --vault <v> sync.mode[text]=0600 sync.mtime[text]=<iso>and read back withop item get --format json. A field's section is matched by its label. That label is taken from the field's ownsectionobject, or else from the item'ssectionsarray by the section's id. The tool never reads or writes a tag now, so a push leaves an item's tags alone. Before this, every content change added anothermtime:tag to the tag list that covers the whole account.op item listreturns no fields, so a per-itemop item getruns wherever the metadata decides the result:status --bucket,pull,push, and each write's read-back.statuswith no bucket still downloads nothing and reads no fields, and a test asserts that it makes noitem getcall.--mode.fieldsrather thanretag.sync.modefield, so it gets the existing refusal for a missing mode.modefield or needs--mode, and a pull ignores the field. Stub tests cover both.syncfields, read them back, set them again and check thatop document editkeeps them. Tags are no longer probed. The README and the module docstring both say the field shape has not been measured against a liveop.Closes on promotion: #4276
Owed to the maintainer: the one live cleanup run
Until the cleanup below has been run against the real account, every existing secret item stays un-migrated, and each one refuses to sync. On Linux,
pull,status --bucketandpusheach refuse with "carries 0 sync.mode field(s)". On Windows,pullignores the mode, so it still proceeds, using each item's update time as its content time. A Windowspushof an existing item refuses until--modeis given.Running the cleanup is a write to the 1Password account, so it is yours to start. No agent ran it, and nothing in this PR or its tests touched the real vault. The script was tried only against a stub
opin a scratch directory. There, the dry run changed nothing, the first--applymigrated four constructed items, and a second--applysent noop item editat all.Per the decision on #4276, the script is throwaway and is not committed to the tree. Suggested order:
python3 scripts/secrets_sync.py selftest. It measures the new field shape in a scratch vault that it creates and then deletes.eval "$(op signin)").python3 move_sync_tags.pyto see the plan, thenpython3 move_sync_tags.py --apply. Pass--accountif more than one account is configured.The script handles each item as follows:
Secrets <bucket>vaults. Each item carrying amode:ormtime:tag gets oneop item edit. That edit sets eachsyncfield the item lacks and replaces the tags with the item's other tags.--mode.Two things are unmeasured. One is whether
--tags ""clears every tag on a liveop. The other is the field shape itself. The read-back is what catches a difference.Verification
python3 tests/test_secrets_sync.py: 170 tests, OK. This covers the new fakeop item getandop item editassignments. New cases cover a create writing its fields after the document, every way a create can stop before its fields land, an item carrying only tags being refused bypull,status --bucketandpush, a field whose section carries only its id, unexpectedop item getshapes failing loudly, and selftest reporting fields that repeat rather than replace.python3 -m unittest discover -s tests -p test_restore_secrets.py: OK.Local review
Three local strict review passes were recorded, the last over the pushed head with no findings. Earlier passes raised four findings, all fixed in this branch: the create path's recovery warning missed the listing and then the create call itself, an over-hardening id check, and duplicated
opargument lists inselftest.🤖 Generated with Claude Code