Skip to content

Share merge and push command rules across provider packages - #80

Merged
erickb336 merged 5 commits into
mainfrom
codex/shared-merge-push-policy
Oct 7, 2026
Merged

erickb336 merged 5 commits into
mainfrom
codex/shared-merge-push-policy

Conversation

@erickb336

Copy link
Copy Markdown
Owner

Second focused lifecycle split from #75, based on main 886b1f6 after #78 and #79 merged. The branch includes both merged behaviors and the reviewed whitespace correction.

Claude keeps its existing merge and push rules. Their command classification now lives in core, so both provider bundles can use the same rules. The provider still reads the checkout branch, checks the verdicts, and handles the first creation of main.

Scope and compatibility

  • Core command policy now classifies merge commands and identifies merge text. Core push policy classifies push commands using a branch reader supplied by the provider.
  • The state tool and command policy share the same PR-number rule.
  • T199 remains unchanged in core command policy. Missing required modules still refuse command tools before other handling.
  • Claude supplies its existing PR validation evidence. If its state tool is broken, the hook keeps the old diagnostic order and still refuses the merge.
  • The existing hook and launcher test files are unchanged from Share command reading and policy across provider packages #78.
  • No new dependencies, file rules, mode phrases, roles, Codex runtime, or Claude-owned issue changes. Future changes to merge/push command classification belong in packages/sage-core/command-policy.mjs and packages/sage-core/push-policy.mjs. Provider first-upload handling stays in the Claude hook.

Validation

Fake ps, pgrep, and kill were first on PATH for every test run. Command strings went only to parsers and hook inputs, never to a real shell.

Command Last result
npm run build built 112 files
npm run check all checks pass
node --test scripts/providers.test.mjs tests 14; pass 14; fail 0
npm test tests 475; pass 475; fail 0
git diff --exit-code origin/main -- scripts/sage-hook.test.mjs scripts/launcher.test.mjs scripts/sage.test.mjs Exit 0; existing tests unchanged
git diff --check origin/main Exit 0

Three new tests cover merge syntax and harmless text, push restrictions and injected branch evidence, and missing transitive modules plus broken-state diagnostics. In a detached worktree from origin/main (886b1f6), copy only the provider test file and run its shared merge and push extraction cases: tests 3; pass 0; fail 3. Main lacks the shared APIs and transitive-module checks.

Independent review found no blocking issues.

Not verified

The push API expects a synchronous branch reader that returns a normalized branch name or undefined. Claude already supplies that form; other provider callers are not integrated here.

Live provider sessions and real GitHub writes were not tested. Automatic Codex enforcement remains separate work in #75.

…sh-policy

# Conflicts:
#	packages/sage-claude/hooks/command-policy.mjs
#	packages/sage-claude/hooks/sage-hook.mjs
#	packages/sage-core/command-policy.mjs
#	packages/sage-core/index.mjs
#	plugins/sage-codex/core/command-policy.mjs
#	plugins/sage-codex/core/index.mjs
#	plugins/sage/core/command-policy.mjs
#	plugins/sage/core/index.mjs
#	plugins/sage/hooks/command-policy.mjs
#	plugins/sage/hooks/sage-hook.mjs
#	scripts/providers.test.mjs

@erickb336 erickb336 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Codex review at 317fe252dad9795aedbf7ca8be84926aa3310441: no blocking findings. Independent code review confirmed that T199, the verified/pr-ready transition, import failure guards, and broken-state merge diagnostics remain intact. Existing hook, launcher, and state tests are unchanged from main. Generated files match source.

Fresh validation on main 886b1f6: build 112 files; check passed; full suite 475 tests, 475 pass, 0 fail. The three new tests all fail individually on detached main with only the test file copied over. CI run 37685382433 passed on this commit.

No live provider session or real GitHub write was tested. The shared push API still requires its documented synchronous branch-reader contract. Ready for the owner's merge; this review does not claim automatic Codex enforcement.

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