Skip to content

DO NOT MERGE: demo that the invariant suite runs from base (#98) - #99

Closed
JOY (JOY) wants to merge 1 commit into
ci/protected-path-reviewfrom
scratch/invariant-base-demo
Closed

JOY (JOY) wants to merge 1 commit into
ci/protected-path-reviewfrom
scratch/invariant-base-demo

Conversation

@JOY

Copy link
Copy Markdown
Contributor

Throwaway draft for #98. It weakens four-eyes (P10) in packages/kernel/src/approval.ts and skips the two invariant tests that would catch it. Expected: ci (PR copy of the tests) passes, Invariant suite (from base) fails because it runs the base branch's copy. Closed and deleted after the run.

🤖 Generated with Claude Code

…emo for #98)

Throwaway commit showing that the protected workflow runs the base copy of the invariant suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
crove Skipped Skipped Oct 15, 2026 9:41am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

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

@gemini-code-assist gemini-code-assist 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.

Code Review

The pull request weakens the four-eyes policy threshold from 2 to 99 in packages/kernel/src/approval.ts, which effectively bypasses a critical security control designed to prevent unauthorized self-approvals. Additionally, two key invariant tests in apps/kernel/test/invariant/kernel-invariants.db.test.ts have been skipped, disabling verification for both the four-eyes policy and the revision editing policy. It is highly recommended to revert the threshold change and re-enable these tests to maintain the integrity of the security controls and test coverage.


const isAuthor = authors.some((a) => a.type === 'user' && a.id === actor.userId);
if (isAuthor && policy.fourEyes && eligible.size >= 2) return deny('four_eyes', eligible.size);
if (isAuthor && policy.fourEyes && eligible.size >= 99) return deny('four_eyes', eligible.size);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-critical critical

Weakening the four-eyes policy threshold from 2 to 99 allows self-approval of proposals even when multiple eligible approvers exist. This bypasses a critical security control (P10) designed to prevent unauthorized self-approvals.

Suggested change
if (isAuthor && policy.fourEyes && eligible.size >= 99) return deny('four_eyes', eligible.size);
if (isAuthor && policy.fourEyes && eligible.size >= 2) return deny('four_eyes', eligible.size);

}

it('four-eyes (P10): with two eligible approvers the uploader cannot approve, the other approver can', async () => {
it.skip('four-eyes (P10): with two eligible approvers the uploader cannot approve, the other approver can', async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Skipping this invariant test disables verification of the four-eyes (P10) policy, reducing test coverage for core security guarantees.

  it('four-eyes (P10): with two eligible approvers the uploader cannot approve, the other approver can', async () => {

});

it('turns an edit into a new revision authored by the editor; the old revision and unsaved changes cannot be approved', async () => {
it.skip('turns an edit into a new revision authored by the editor; the old revision and unsaved changes cannot be approved', async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Skipping this invariant test disables verification of the revision editing policy, which ensures that old revisions and unsaved changes cannot be approved.

  it('turns an edit into a new revision authored by the editor; the old revision and unsaved changes cannot be approved', async () => {

@JOY

Copy link
Copy Markdown
Contributor Author

Demo done: Lint, typecheck, test passed (PR copy, 39 passed, 2 skipped); Invariant suite (from base) failed on the two four-eyes tests from the base copy (run 38714775507). Closing.

@JOY JOY (JOY) closed this Oct 15, 2026
@JOY
JOY (JOY) deleted the scratch/invariant-base-demo branch October 15, 2026 09:43

This branch was previously deployed

1 inactive deployment
Preview — a8824de4 Deployed Oct 15, 2026 by vercel[bot]
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