Skip to content

feat: check tests against the test-audit rules and a per-test time budget with maudecode-ci rules and test-durations (DOTGH-2) - #11

Merged
kiliantyler merged 2 commits into
mainfrom
ci/DOTGH-2-factory-8ffcb690
Nov 24, 2026
Merged

kiliantyler merged 2 commits into
mainfrom
ci/DOTGH-2-factory-8ffcb690

Conversation

@kiliantyler

@kiliantyler kiliantyler commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Ticket

DOTGH-2

Problem

The test-audit pattern scan (fixed sleeps, elapsed-time assertions, retries) and the per-test run-time budget live only in Talaria (scripts/check-ui-rules.mjs, scripts/check-test-durations.py at 27fb4ccc381e). No other MaudeCode repository can use them.

Solution

  • maudecode-ci rules --config <file> [--update] (lib/rules.js): a port of check-ui-rules.mjs with the same scanner, tally, baseline comparison, lowering-only --update, exceptions validation, config format and messages. One addition: extends names one parent config, by a relative path or a package path such as @maudecode/ci/rules/test-rules.base.json. The parent's rules load first, and a local rule with the same id replaces the parent's.
  • rules/test-rules.base.json: Talaria's five language-generic rules (clock-sleep, clock-elapsed, unheld-clock, retry, retry-config) with their Swift, TypeScript and Python patterns and messages unchanged. Shipped through the package's files.
  • maudecode-ci test-durations --config <file> REPORT... (lib/durations.js): a port of check-test-durations.py covering the JUnit XML, xcresulttool JSON and XCTest log readers, suite::test matching and the three failures. JUnit is read by scanning testcase start tags, and a ponytail: comment names that limit. With no budgetSeconds, the budget is 30 s.
  • CI.md gets a "Test checks" section covering both commands, the config and baseline formats, the ratchet, the 30 s default, and the rule that every overBudget and exceptions entry names a ticket or a reason.
  • No dependency added. Talaria and the other repositories adopt the commands in their own tickets.

Validation

  • node --test: 42/42 locally on Node 24.22.2 at 7e3ef31, and 43/43 at eae29f3.
  • Mutation checks: swapping the extends merge order, or disabling nearby, blankPattern, the rule-level excludeFilePattern or the top-level excludeFilePattern, each turns at least one new test red.
  • Smoke test through bin/maudecode-ci.js: a JUnit report with a 40 s case exits 1 and names a::b, and rules with no --config exits 1 with its usage error.

New tests and what they own (test-audit gate):

  • test/rules.test.js: what counts and where (file, original line, rule, message, plus nearby, blankPattern and both exclusion levels); the baseline ratchet (pass at the count, fail above it, --update lowers and refuses to raise); an exception without a reason; extends replacement; the base rules against a violating fixture per language (Swift, TypeScript, TypeScript Playwright config, Python) and against clean ones. The fixtures are generated in temp directories, so node --test never collects them.
  • test/durations.test.js: each report format with a listed and an over-budget test under the default budget; parametrized and describe-block matching; no report and a report with no cases.

Regression proof

These are new commands, so the red run executes the new tests against the code from before the change.

  • Baseline: c22c421 (main) in a temporary worktree, with only test/rules.test.js and test/durations.test.js copied in.
  • Command: node --test test/rules.test.js test/durations.test.js
  • Red: exit 1, 0 passed, 9 failed. All 9 fail on assertions, not on load: main returns 2 with Usage: because neither subcommand exists. For example, ✖ the base test rules pass clean tests in each language gives AssertionError [ERR_ASSERTION]: Usage: ..., and ✖ extends loads the parent's rules first... gives Expected values to be strictly deep-equal.
  • Green: the same command at 7e3ef31 passes 9 of 9. The full node --test passes 42 of 42.

Codex review fixes (eae29f3). Baseline 7e3ef31, command node --test test/rules.test.js test/durations.test.js:

  • Multiline retry: the TypeScript fixture now splits test.describe.configure({ across lines. Red on 7e3ef31: ✖ the base test rules fail each language's violations with each rule's message, with expected web/src/wait.test.ts:1 retry: test-audit defect loop: ... missing from actual. Green on eae29f3. Rules can now set "multiline": true. All five base rules do; other rules still match line by line.
  • Empty overBudget reason: ✖ an overBudget entry without a ticket or reason fails before any test is let through fails red on 7e3ef31, where {"s::slow": " "} let a 90 s case through. Green on eae29f3.
  • Full node --test: 43/43 on eae29f3.

Device / visual

None needed: there is no user-visible UI.

Risk

Low. The subcommands are new, and suites and pre-push are unchanged apart from the shared usage text.

Rollback

Revert this commit. No repository uses these commands yet.

…dget with maudecode-ci rules and test-durations (DOTGH-2)

Talaria's pattern scanner with its lowering-only baseline and its per-test run-time budget move into the shared
package, so any MaudeCode repository can hold its tests to the same defect rules in CI. `rules` keeps Talaria's config
and baseline formats and adds `extends`; rules/test-rules.base.json carries the five language-generic test rules.
`test-durations` reads JUnit XML, xcresulttool JSON and XCTest logs, with a 30 s default budget. Neither adds a
dependency. CI.md documents both under "Test checks".
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 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-24T04:45:29.167810Z 7e3ef31 Manual request
🔒 Security Review ✅ Completed 2026-11-24T04:49:13.420035Z 7e3ef31 Manual request
ℹ️ 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.

@kiliantyler

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 7e3ef31192

ℹ️ 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 lib/rules.js Resolved
Comment thread lib/durations.js Resolved
…entry without a reason (DOTGH-2)

A rule marked multiline matches its patterns against the whole file and reports the line a match starts on, so
`test.describe.configure({` with `retries: 2` on the next line no longer passes the base retry rule. The five base
rules are multiline; other rules keep matching line by line. test-durations now fails when an overBudget entry's value
is empty, before any report is read.
@kiliantyler
kiliantyler merged commit 42c0ee2 into main Nov 24, 2026
1 check passed
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 7e3ef31192

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

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