Skip to content

own-language pre-commit hook refuses any merge of master: master's pr-budget.yml and cli/tri/src/gates.rs are not in foreign-exceptions #10414

Open

Description

@dmitrii-f-t27

@gHashTag, the local own-language pre-commit hook refuses every merge of current master into a branch, so a fork PR cannot be brought up to date without --no-verify, which the hook's own comment forbids.

What happens

On 2026-10-18 I merged master fdeb1db into #8890 (spec/trinet-top). The commit is refused:

.github/workflows/pr-budget.yml: hand-written .yml is forbidden (owner rule 2026-10-05) ...
cli/tri/src/gates.rs: hand-written .rs is forbidden (owner rule 2026-10-05) ...

Neither file is part of #8890. Both came in from master:

Neither is listed in tools/policy/foreign-exceptions.txt on master.

Why

lefthook.yml feeds the gate git diff --name-status --cached. During a merge that diff is everything master brought in, not only what the branch changes. The CI twin (own-language, required) judges the PR's own diff, so it does not see these files.

Either of these fixes it

  1. Add .github/workflows/pr-budget.yml and cli/tri/src/gates.rs to tools/policy/foreign-exceptions.txt on master, if they are owner-approved.
  2. Make the hook judge only what the branch changes during a merge, for example the staged diff against MERGE_HEAD when it exists, decided in specs/policy/own_language.t27.

#8890 waits with the merge resolved locally (including pin declarations on master's new inout ports, #10188) and is not committed until one of these lands.

Dmitrii Fedorov (@dmitrii-f-t27)

Boundary

  • tools/policy/foreign-exceptions.txt
  • specs/policy/own_language.t27
  • gen/c/policy/own_language.c
  • lefthook.yml

User Scenarios

  • Given a fork branch behind master, When its owner merges current master (which brings .github/workflows/pr-budget.yml and cli/tri/src/gates.rs), Then the own-language pre-commit hook accepts the merge commit, because those files are master's, not the branch's.
  • Given a branch that itself adds a hand-written .yml or .rs, When it commits, Then the hook still refuses it, as today.

Requirements

  • FR-001: The pre-commit own-language gate MUST NOT refuse a merge commit for foreign files whose content equals master's (files the merge brings in unchanged).
  • FR-002: The gate MUST keep refusing hand-written foreign files the branch itself adds or changes.
  • FR-003: The decision MUST live in specs/policy/own_language.t27 (or the files MUST be listed in tools/policy/foreign-exceptions.txt on master), not in a bypass.

Success Criteria

Activity

  1. added
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Oct 18, 2026
  2. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## Boundary -- list every file this task may touch, one per line (- specs/x.t27); without it the Queen reserves nothing and no bee can take the issue
    • missing: ## User Scenarios -- at least one Given/When/Then scenario
    • missing: ## Requirements -- numbered obligations, FR-001: ... MUST ...
    • missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
  3. dmitrii-f-t27 commented on Oct 18, 2026

    @dmitrii-f-t27
    ContributorAuthor

    The same hook blocks updating #8532 and #8772 (E2 job link) from master; together with #8890 that is three PRs waiting on this.

    Dmitrii Fedorov (@dmitrii-f-t27)

  4. removed
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Oct 18, 2026
  5. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    The shape check passes now (specs/policy/issue_shape.t27); reopened.

  6. gHashTag commented on Oct 18, 2026

    @gHashTag
    Owner

    Same failure from the foreign-budget command, measured 2026-10-19 on branch claude/t27f-beat-overlay (PR #10610) while merging origin/master:

    foreign-budget: cli/tri/src/main.rs: more than 40 hand-written foreign lines added in one file
    

    None of those lines are from the branch. They come from master's #10587 (b3a226322, tri t27o-sweep). With a merge in progress, git diff --numstat --cached compares the index to HEAD, so everything master brings in counts as "added by this commit".

    A candidate fix for whoever owns lefthook.yml: when .git/MERGE_HEAD exists, diff against MERGE_HEAD rather than HEAD. That diff holds only the branch's own work, which is what the PR-side twin in own-language.yml measures anyway.

    Workaround used here: I aborted the merge and did not use --no-verify. #10610 is carried by #10627, which is a branch on top of it and is mergeable with master.

  7. gHashTag commented on Oct 18, 2026

    @gHashTag
    Owner

    Workaround that keeps every hook on, used on #10551 (head f3aa394):

    1. Merge the master commit just before the one with the large foreign diff (here 9514c30, just before tri t27o-sweep: t27o over a whole tree, rows reused while the file and the two seals hold (Closes #10543) #10587), and resolve the conflicts there. pre-commit passes.
    2. Then git merge origin/master. With no conflicts left, git writes the merge commit itself, and lefthook defines no pre-merge-commit stage.

    This does not fix the gate: a conflict inside master's big foreign commit would still be refused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions