Skip to content

Carry config notices in the result, not only on stderr #727

Open

Description

@invictustitan2

From #722, where you asked for this to have its own issue, with the design agreed before any code. There's no code here, only what I measured and the questions I'd want settled first.

What happens

When part of a config isn't in force, the CLI says so: each case below prints a notice to stderr and the run carries on. That's by design, and fail-open on inherit_from is documented; I'm not arguing against either. What I measured is where the notice ends up on the other integrations. These are local fixtures, measured on 20 November: this repository at 029bf06 (the only commit since, #724, doesn't touch these paths), commit-check-action at adc0ec2 and commit-check-mcp at f8feca9, both still their heads. "Step log only" and "no notice" mean the run's every stream was captured and the notice was in that one or in none.

The config says CLI pre-commit hook Action summary, PR comment, result MCP result
inherit_from that can't load (missing file, 404, DNS, refused connection) ⊘ … could not be loaded: …; continuing with the local config Passed; notice hidden passed; notice only in the step log pass; notice only on server stderr
a parent that has its own inherit_from ⊘ … is ignored: only one level of inherit_from is followed Passed passed; step log only pass; server stderr only
a misspelt key (subject_max_lenght) ⚠ unknown setting … is ignored Passed passed; step log only pass; no notice
CCHK_SUBJECT_MAX_LENGTH=abc Warning: Invalid value for CCHK_… Passed passed; step log only n/a: the server doesn't read CCHK_*
files = "x" ⊘ [files] must be a table, …; the file rules are disabled Passed "Files: skipped", with "no rule is set in the [files] section of the config" n/a
[files] max_size = "5M" ⊘ [files] max_size = '5M' is not usable; CC302 file-size is disabled Passed "Files: passed" n/a
--branch with no branch rule configured ⊘ --branch requested but no branch rules are configured … Passed "Branch: passed" pass, with an empty checks list
[pull_request] ai_declaration_checkbox (singular) nothing; CC501 is off no hook runs it "skipped: ai_attribution is "ignore"", though with the key spelt right the same config fails CC501 n/a

The hook column shows pre-commit hiding a passing hook's output, as it does by design; with verbose: true every notice showed (14 of 14). The network cases gave the same outcome as the local missing file on every integration, 3 out of 3 runs each. commit-check-ci prints each notice in its log, beside passed.

What already reaches them

ignore_authors and warn do reach the Action and the MCP result. The Action's summary shows "skipped: author … is in [commit].ignore_authors" and "passed with warnings"; the MCP returns skip and a warn check. Those two travel in the result itself, as status: skip with its reason and as the warnings count, and each integration renders them. The cases in the table are printed beside the result, before the engine runs, so nothing downstream has them to render.

A possible shape

This is a sketch to react to, not a proposal to merge. One additive field next to status, warnings and checks, in --format json and the API:

{
  "status": "pass",
  "warnings": 0,
  "checks": ["…"],
  "config": {
    "inherit_from": {"source": "github:org/.github:commit-check.toml", "loaded": false, "error": "HTTP Error 404: Not Found"},
    "notices": [
      {"setting": "commit.subject_max_lenght", "notice": "unknown setting, ignored"},
      {"setting": "files.max_size", "notice": "'5M' is not usable; CC302 file-size is disabled"}
    ]
  }
}

status and the exit code stay as they are, and so do the CLI's stderr lines. unknown_setting_warnings() already returns its list; today it's only printed. The Action could then show a line under the summary the way it shows a skip reason, and put the same in result. The MCP could return it in the structured result. pre-commit can't be changed from here, so for that one I think a line in the pre-commit guide about verbose: true is the most that can be done.

Questions for you

  1. Shape. A separate field as above, or entries in checks? A separate field leaves every current consumer unchanged; a check entry would change what a check is.
  2. A parent that didn't load. Should it stay pass? The documented fail-open says yes. An opt-in that fails the run, for an org that depends on its parent policy, would be a separate decision, and I'm only raising it.
  3. Which parent ran. With loaded: true, should the result also carry what was loaded, such as the ref or a hash of the bytes? github:org/repo:path follows the default branch, so the same commit and config can be judged under a different policy from one day to the next. A hash would at least let two runs show they used the same parent.
  4. [pull_request]. The unknown-setting check skips this section because the GitHub App reads the rest of it (config_merger.py:115-118). That's how the singular ai_declaration_checkbox turns CC501 off with no line anywhere. Would a list of the keys the App reads let the CLI report the others? Separately, the Action gives ai_attribution is "ignore" as the reason for the skip, and in that case it isn't the cause.
  5. A run that checked nothing. --branch with no branch rule returns pass with an empty checks list, because overall_status() reads no checks as a pass. Should an empty run be skip, the way a fully skipped run already is?
  6. Order. I'd suggest the core result first, then the Action and the MCP, each in its own repository. The MCP not reading CCHK_* is a separate issue, and I'd raise it in commit-check-mcp.

I have the captures behind every row and can share any of them.

Activity

  1. shenxianpeng commented on Nov 21, 2026

    @shenxianpeng
    Member

    Thanks, I reproduced these on 2.23.1 and they match: the notices go to stderr only, so --format json, the Action's summary and result, and the MCP result never see them, and every case returns pass. One small difference: with [files] max_size = "5M" as the only file rule, the Action shows "Files: skipped, no rule is set in the [files] section", not "passed". The notice is still lost either way.

    My answers:

    1. Shape. A separate field, not entries in checks. I'd keep it flat: a top-level notices list, each entry with the setting and the message, and leave inherit_from details out for now. Fewer new names to commit to.
    2. A parent that didn't load. Stays pass, as documented. An opt-in that fails the run can wait until an org asks for it.
    3. Which parent ran. Not now. Let's get the notices through first.
    4. [pull_request]. Yes. The App reads only check, ai_label and body_ai_attribution, and the CLI reads ai_declaration_checkboxes, so the CLI can report any other key in that section as unknown. That catches the singular ai_declaration_checkbox. You're also right that the Action's "ai_attribution is ignore" reason is wrong in that case; it should only be given when the policy really is ignore.
    5. A run that checked nothing. Agreed: an empty checks list should be skip, the same as a fully skipped run. The exit code stays 0.
    6. Order. Agreed: core first (notices + unknown [pull_request] keys + empty run as skip), then the Action, then the MCP. Please open the CCHK_* one in commit-check-mcp separately. A line in the pre-commit guide about verbose: true is a good idea too.

    If you'd like to build the core part, go ahead and I'll review it. Please keep the names as above, and ask here before adding any other new field or key.

  2. invictustitan2 commented on Nov 21, 2026

    @invictustitan2
    ContributorAuthor

    Thanks, and you're right about max_size. My fixture also set prohibited_patterns = ["*.pem"], which the row left out, so "passed" held only for that config. With max_size as the only rule, the Action's reason "no rule is set" is wrong as well: a rule is set, it just can't be used. I'll take that with the ai_attribution reason in the Action part.

    I'll build the core part. Before I start, here's what I'd do, so you can stop me early:

    • notices: each entry is {"setting": …, "message": …}. setting uses the form the CLI already prints, such as [files] max_size or [commit] subject_max_lenght, and otherwise inherit_from, the CCHK_* variable's name, or --branch/--files. message is the stderr line without its leading mark. The stderr lines stay.
    • What it carries: the seven places that print a setting out of force: inherit_from not loaded, a nested inherit_from, an unknown setting, an invalid CCHK_* value, [files] not a table, a [files] value that can't be used, and --branch/--files with nothing configured. The --files one wasn't in my table, but it's the same code. Skip and warning summaries aren't included, since checks already carries them.
    • [pull_request]: check, ai_label, body_ai_attribution and ai_declaration_checkboxes are known; any other key is reported, with the closest match. [jira] stays exempt.
    • Empty run: overall_status() reads no checks as skip. The exit code stays 0, and text output is unchanged.

    Three things to confirm:

    1. Under ai_attribution = "ignore", --ai-attribution-only returns no checks, so it becomes skip. ai_tools is unchanged. Your test test_ignore_runs_nothing_but_still_names_the_tools and the policies guide both say it passes. I read your answer as covering this, so I'd change both. Is that right?
    2. Should notices be on every result, as an empty list when there are none, like warnings? Or only when there's at least one?
    3. The API raises the [files] notices itself, so they'd be carried. It doesn't check a passed config dict for unknown keys today. Should it stay that way?

    I'll open the CCHK_* issue in commit-check-mcp, and send the verbose: true line and the guide wording to commit-check.com once the core change is clear.

  3. shenxianpeng commented on Nov 21, 2026

    @shenxianpeng
    Member

    Thanks, this is clean and matches what we agreed in #727. I checked it locally: the JSON result carries all five kinds of notice in the same order as stderr, [pull_request] ai_declaration_checkbox now gets the "did you mean" hint, and --files with nothing configured gives skip with exit 0.

    Answers to your three questions, for the record:

    1. Yes, --ai-attribution-only under ignore with no ai_declaration_checkboxes set is skip.
    2. Yes, notices is always there, as an empty list when there are none.
    3. Yes, the API keeps not checking a passed dict's keys for now.

    Merging. The Action and MCP parts, and the site pages, can follow as you planned.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions