Skip to content

One failure format across ub commands; default Python run finds tests/ - #13

Merged
0xjgv merged 2 commits into
mainfrom
ub-cli-report-format
Nov 17, 2026
Merged

0xjgv merged 2 commits into
mainfrom
ub-cli-report-format

Conversation

@0xjgv

@0xjgv 0xjgv commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Round-3 dogfood fixes: one failure format for ub crap, ub mutate and ub check, and a default Python coverage run that finds tests/.

Changes

  1. One CRAP format. ub check now prints the ub crap line, so it shows CC and coverage: 18.0 CRAP, 8 CC, 46% covered: pkg/fn (check.crap_line).
  2. One line per mutant. ub check prints each surviving or uncovered mutant as src/ub_cli/engines.py:109 survived > -> >=, capped at 20 with ... and N more; --verbose for all. Non-verbose ub mutate prints the same line (check.mutant_line). A covered site with no recorded outcome counts as survived, as the engine's totals count it.
  3. Default Python run.
    • (a) The no-executed-lines message names the command that ran, e.g. Did `python3 -m coverage run ... -m unittest discover -s tests` run the tests?. It names the custom --coverage-command too. For other languages it still says "the coverage command".
    • (b) Picked: when the default run is unittest discover (with or without -s .), the top level has no test*.py, and tests/ or test/ exists without __init__.py, ub runs -s tests. This lives in engines.py: it swaps crapper.runners.run_shell and test_plan in mutator.engine and check. Coverage runs and mutant runs therefore use the same tests in ub crap, ub mutate and ub check.
      • Rejected: a message-only fix, which leaves the most common layout broken.
      • Rejected: a retry when "Ran 0 tests" appears, which means parsing output and running twice.
      • Rejected: editing vendor/, which is forbidden.
      • Known limit, marked with a shortcut: comment: a layout where -s . would find tests inside some other package is not detected.
  4. Relative path. Wrote .metrics/crap.edn and .metrics/dry.edn print relative to the root. --verbose keeps upstream output; the parity test enforces this.
  5. Unknown coverage. ub mutate --scan says (coverage unknown) when no report covers a file, but not with --no-coverage. The observed (75 uncovered) came from the zero-hit report that the 0-test default run left behind. Fix 3b removes that cause.
  6. engines.py passes ub's gate. New tests cover crap_report (threshold, the cap at exactly 10, and no-coverage), mutation_summary scoring, and the verbose hint. Two redundant expressions are simplified: path == target or (is_relative_to already holds for equal paths) and a .get(..., True) default that can never apply.

Verification

make test:

Ran 87 tests in 13.512s

OK

rm -rf target .metrics; $UB crap: before, exit 2 (Coverage reports show no executed lines ... Did the coverage command run the tests?). After:

exit 0
CRAP: 8 of 63 functions >= 10
  600.0 CRAP, 24 CC, 0% covered: scripts.collect_notices/collect
  ...
  14.0 CRAP, 14 CC, 100% covered: ub_cli.skill/install
  12.4 CRAP, 12 CC, 86% covered: ub_cli.signature/verify
Wrote .metrics/crap.edn

After COV: $UB check -s src --use-existing-coverage --test-command "$TEST".

Before (main de3c2c2): stdout 958 bytes, exit 1

CRAP: 3 of 48 functions >= 10
  CRAP 18.0 >= 10 in ub_cli.engines/crap_report
  CRAP 12.4 >= 10 in ub_cli.signature/verify
  CRAP 14.0 >= 10 in ub_cli.skill/install
Duplication: 0 pairs >= 0.8
Mutation: 226 killed, 23 survived, 7 uncovered
  src/ub_cli/engines.py:45 has 2 surviving and 0 uncovered mutants
  src/ub_cli/engines.py:75 has 0 surviving and 1 uncovered mutants
  src/ub_cli/engines.py:101 has 1 surviving and 0 uncovered mutants
  src/ub_cli/engines.py:109 has 1 surviving and 4 uncovered mutants
  src/ub_cli/engines.py:154 has 2 surviving and 0 uncovered mutants
  src/ub_cli/engines.py:168 has 2 surviving and 0 uncovered mutants
  src/ub_cli/signature.py:36 has 5 surviving and 0 uncovered mutants
  src/ub_cli/signature.py:40 has 3 surviving and 1 uncovered mutants
  src/ub_cli/signature.py:70 has 2 surviving and 1 uncovered mutants
  src/ub_cli/signature.py:81 has 5 surviving and 0 uncovered mutants
Gates failed with 13 failing items.

After: stdout 1062 bytes, exit 1. No engines.py items remain. The remaining items are in signature.py and skill.py, which lead ub-cli-self-gate owns.

CRAP: 2 of 54 functions >= 10
  12.4 CRAP, 12 CC, 86% covered: ub_cli.signature/verify
  14.0 CRAP, 14 CC, 100% covered: ub_cli.skill/install
Duplication: 0 pairs >= 0.8
Mutation: 253 killed, 15 survived, 2 uncovered
  src/ub_cli/signature.py:37 survived * -> /
  src/ub_cli/signature.py:37 survived * -> /
  src/ub_cli/signature.py:37 survived and -> or
  src/ub_cli/signature.py:37 survived * -> /
  src/ub_cli/signature.py:37 survived * -> /
  src/ub_cli/signature.py:41 survived >= -> >
  src/ub_cli/signature.py:44 survived 0 -> 1
  src/ub_cli/signature.py:45 uncovered 0 -> 1
  src/ub_cli/signature.py:49 survived * -> /
  src/ub_cli/signature.py:71 survived or -> and
  src/ub_cli/signature.py:72 uncovered False -> True
  src/ub_cli/signature.py:75 survived >= -> >
  src/ub_cli/signature.py:83 survived True -> False
  src/ub_cli/signature.py:84 survived or -> and
  src/ub_cli/signature.py:89 survived True -> False
  src/ub_cli/signature.py:90 survived True -> False
  src/ub_cli/signature.py:91 survived or -> and
Gates failed with 19 failing items.

Not checked

  • Mixed-language projects: in the no-executed-lines message, only Python and custom commands are named.
  • The tests/ rewrite with pytest projects. They are untouched, because only unittest discover argv is rewritten.
  • Python ub check without --test-command on this repo, end to end.

…/ for default Python runs

- CRAP lines read '18.0 CRAP, 8 CC, 46% covered: pkg/fn' in ub crap and ub check.
- ub check and ub mutate print one line per unkilled mutant: 'path:line survived > -> >='.
- The no-executed-lines message names the custom or Python coverage command that ran.
- Default unittest discovery runs tests/ or test/ when the top level holds no tests.
- 'Wrote' prints the metrics path relative to the root.
- ub mutate --scan says 'coverage unknown' when no report covers a file.
- Tests clear ub's own gate for engines.py.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T17:03:48.155598Z e498684 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e498684302

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ub_cli/engines.py Resolved
@0xjgv
0xjgv merged commit b0a5c9b into main Nov 17, 2026
1 check passed
@0xjgv
0xjgv deleted the ub-cli-report-format branch November 17, 2026 18:55
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