Repository navigation
feat: check tests against the test-audit rules and a per-test time budget with maudecode-ci rules and test-durations (DOTGH-2) - #11
Conversation
…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".
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
…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.
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
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.pyat27fb4ccc381e). No other MaudeCode repository can use them.Solution
maudecode-ci rules --config <file> [--update](lib/rules.js): a port ofcheck-ui-rules.mjswith the same scanner, tally, baseline comparison, lowering-only--update,exceptionsvalidation, config format and messages. One addition:extendsnames 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'sfiles.maudecode-ci test-durations --config <file> REPORT...(lib/durations.js): a port ofcheck-test-durations.pycovering the JUnit XML,xcresulttoolJSON and XCTest log readers,suite::testmatching and the three failures. JUnit is read by scanningtestcasestart tags, and aponytail:comment names that limit. With nobudgetSeconds, the budget is 30 s.CI.mdgets a "Test checks" section covering both commands, the config and baseline formats, the ratchet, the 30 s default, and the rule that everyoverBudgetandexceptionsentry names a ticket or a reason.Validation
node --test: 42/42 locally on Node 24.22.2 at7e3ef31, and 43/43 ateae29f3.extendsmerge order, or disablingnearby,blankPattern, the rule-levelexcludeFilePatternor the top-levelexcludeFilePattern, each turns at least one new test red.bin/maudecode-ci.js: a JUnit report with a 40 s case exits 1 and namesa::b, andruleswith no--configexits 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, plusnearby,blankPatternand both exclusion levels); the baseline ratchet (pass at the count, fail above it,--updatelowers and refuses to raise); an exception without a reason;extendsreplacement; 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, sonode --testnever 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.
c22c421(main) in a temporary worktree, with onlytest/rules.test.jsandtest/durations.test.jscopied in.node --test test/rules.test.js test/durations.test.jsmainreturns 2 withUsage:because neither subcommand exists. For example,✖ the base test rules pass clean tests in each languagegivesAssertionError [ERR_ASSERTION]: Usage: ..., and✖ extends loads the parent's rules first...givesExpected values to be strictly deep-equal.7e3ef31passes 9 of 9. The fullnode --testpasses 42 of 42.Codex review fixes (eae29f3). Baseline 7e3ef31, command
node --test test/rules.test.js test/durations.test.js:test.describe.configure({across lines. Red on 7e3ef31:✖ the base test rules fail each language's violations with each rule's message, with expectedweb/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.overBudgetreason:✖ an overBudget entry without a ticket or reason fails before any test is let throughfails red on 7e3ef31, where{"s::slow": " "}let a 90 s case through. Green on eae29f3.node --test: 43/43 on eae29f3.Device / visual
None needed: there is no user-visible UI.
Risk
Low. The subcommands are new, and
suitesandpre-pushare unchanged apart from the shared usage text.Rollback
Revert this commit. No repository uses these commands yet.