Skip to content

fix(skills): preserve local lock during sync - #179

Closed
shunkakinoki wants to merge 1 commit into
mainfrom
codex/fix-preserve-skills-lock-sync
Closed

fix(skills): preserve local lock during sync#179
shunkakinoki wants to merge 1 commit into
mainfrom
codex/fix-preserve-skills-lock-sync

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • run deployment syncs against a temporary copy of the committed skills lock
  • keep user-modified skills-lock.json content untouched on success and failure
  • cover command propagation, Make variable inheritance, cleanup, and failure behavior

Validation

  • bun run check
  • shellcheck scripts/with-committed-skills-lock.sh tests/with-committed-skills-lock.sh
  • bash -n scripts/with-committed-skills-lock.sh tests/with-committed-skills-lock.sh
  • jq -e . package.json
  • git diff --check

Refs shunkakinokisoftware-hnnt


Summary by cubic

Prevent deployment sync from overwriting a user-modified skills-lock.json by running sync against a temporary copy of the committed lock. Adds a wrapper script, updates make sync, and includes tests to ensure the working lock is preserved.

  • Bug Fixes
    • Added scripts/with-committed-skills-lock.sh to run sync with a temp lock from HEAD:skills-lock.json (falls back to the current lock if git metadata is missing).
    • Updated Makefile: sync wraps a new sync-internal; SKILLS_LOCK_FILE is now ?= so the temp lock override is respected.
    • Added tests/with-committed-skills-lock.sh and wired it into bun run check; clarified README. Ensures the working lock is untouched on success or failure, cleans up temp files, and propagates exit codes.

Written for commit 7dd20ef. Summary will update on new commits.

Review in cubic

Run deployment syncs against a temporary copy of the committed skills lock so generated re-locking cannot overwrite user-owned checkout changes.

Refs shunkakinokisoftware-hnnt
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a24de53e-45c7-4aa8-9578-256d14146e62

📥 Commits

Reviewing files that changed from the base of the PR and between bfc6007 and 7dd20ef.

📒 Files selected for processing (5)
  • Makefile
  • README.md
  • package.json
  • scripts/with-committed-skills-lock.sh
  • tests/with-committed-skills-lock.sh

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Synchronization now uses the committed skills lock by default, while supporting explicit lock-file overrides.
    • Temporary lock handling protects local changes during synchronization and cleans up automatically.
  • Documentation

    • Clarified synchronization behavior and documented intentional skills-lock updates.
  • Tests

    • Added end-to-end coverage for lock isolation, cleanup, Make-based workflows, and error propagation.
    • The standard checks now include the new test suite.

Walkthrough

The sync workflow now uses the committed skills-lock.json through a temporary lock override. A Bash wrapper provides cleanup and exit-status handling. Make targets, documentation, package scripts, and end-to-end tests support the new workflow.

Changes

Committed lock sync

Layer / File(s) Summary
Committed lock wrapper
scripts/with-committed-skills-lock.sh
The wrapper selects the committed or configured lock, creates a temporary file, sets SKILLS_LOCK_FILE, cleans up, and preserves command status.
Sync target integration
Makefile, README.md
sync invokes the wrapper and delegates to sync-internal. The documentation describes committed-lock synchronization and intentional lock updates.
Isolation tests and test wiring
tests/with-committed-skills-lock.sh, package.json
Tests cover direct execution, Make execution, cleanup, lock preservation, and failure status propagation. Package scripts run these tests before other checks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

A rabbit guards the lock tonight,
With temporary paws held tight.
Make syncs softly, files stay whole,
Tests hop through each command’s role.
Cleanup runs when failures call—
The committed lock protects them all. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving local skills-lock.json content during synchronization.
Description check ✅ Passed The description directly explains the temporary committed lock, preservation behavior, tests, and validation for the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-preserve-skills-lock-sync

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

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Makefile">

<violation number="1" location="Makefile:37">
P3: `make -f /path/to/Makefile sync` fails outside the checkout because this wrapper is resolved from the caller’s working directory. Resolve the script relative to the Makefile, matching the other project paths.</violation>
</file>

<file name="tests/with-committed-skills-lock.sh">

<violation number="1" location="tests/with-committed-skills-lock.sh:31">
P3: The three scenarios (direct command, make, failure) all run against the committed-git fixture, so the script's fallback path (git show failing → copy CURRENT_LOCK) is never exercised. Consider adding a case where DOTAGENTS_ROOT has no git metadata (or a repo without a committed skills-lock) and assert the temporary lock then mirrors the working lock while the working file is still left untouched.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread Makefile
sync: ruler-prepare ## Sync project commands, skills, and MCP configuration to assistant-specific directories.
.PHONY: sync sync-internal
sync: ## Sync project commands, skills, and MCP configuration without rewriting the committed lock.
@./scripts/with-committed-skills-lock.sh $(MAKE) sync-internal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: make -f /path/to/Makefile sync fails outside the checkout because this wrapper is resolved from the caller’s working directory. Resolve the script relative to the Makefile, matching the other project paths.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Makefile, line 37:

<comment>`make -f /path/to/Makefile sync` fails outside the checkout because this wrapper is resolved from the caller’s working directory. Resolve the script relative to the Makefile, matching the other project paths.</comment>

<file context>
@@ -32,8 +32,11 @@ DOTDIRS_SRC_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
-sync: ruler-prepare ## Sync project commands, skills, and MCP configuration to assistant-specific directories.
+.PHONY: sync sync-internal
+sync: ## Sync project commands, skills, and MCP configuration without rewriting the committed lock.
+	@./scripts/with-committed-skills-lock.sh $(MAKE) sync-internal
+
+sync-internal: ruler-prepare
</file context>
Suggested change
@./scripts/with-committed-skills-lock.sh $(MAKE) sync-internal
@"$(dir $(lastword $(MAKEFILE_LIST)))scripts/with-committed-skills-lock.sh" $(MAKE) sync-internal

CAPTURE="$TEST_ROOT/capture"
MOCK_COMMAND="$TEST_ROOT/capture-lock"
mkdir -p "$FIXTURE"
git -C "$FIXTURE" init --quiet

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The three scenarios (direct command, make, failure) all run against the committed-git fixture, so the script's fallback path (git show failing → copy CURRENT_LOCK) is never exercised. Consider adding a case where DOTAGENTS_ROOT has no git metadata (or a repo without a committed skills-lock) and assert the temporary lock then mirrors the working lock while the working file is still left untouched.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/with-committed-skills-lock.sh, line 31:

<comment>The three scenarios (direct command, make, failure) all run against the committed-git fixture, so the script's fallback path (git show failing → copy CURRENT_LOCK) is never exercised. Consider adding a case where DOTAGENTS_ROOT has no git metadata (or a repo without a committed skills-lock) and assert the temporary lock then mirrors the working lock while the working file is still left untouched.</comment>

<file context>
@@ -0,0 +1,91 @@
+CAPTURE="$TEST_ROOT/capture"
+MOCK_COMMAND="$TEST_ROOT/capture-lock"
+mkdir -p "$FIXTURE"
+git -C "$FIXTURE" init --quiet
+git -C "$FIXTURE" config user.email test@example.com
+git -C "$FIXTURE" config user.name 'Dotagents Test'
</file context>

@shunkakinoki

Copy link
Copy Markdown
Owner Author

Closing: this overgeneralized a host checkout issue into unnecessary sync behavior.

@shunkakinoki
shunkakinoki deleted the codex/fix-preserve-skills-lock-sync branch August 3, 2026 07:30
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