-
-
Notifications
You must be signed in to change notification settings - Fork 10
refactor: contest label split by type #4021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,962
−1,607
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
afdd72e
refactor: extract contest prefix dictionaries to prefixes.ts
KATO-Hiro 39fe5e4
refactor: extract classifyContest to classification.ts
KATO-Hiro 6fed75b
refactor: extract contest priority to priority.ts
KATO-Hiro 12db45f
refactor: split contest label generation into per-type files
KATO-Hiro 8f5faf2
refactor: extract task_index_label, split tests into co-located files
KATO-Hiro 83f6955
refactor: add barrel export and update all import paths
KATO-Hiro 6bd7e22
docs: update paths and guide for new contest module structure
KATO-Hiro e7ca889
docs: add contest module restructure plan with rationale and lessons
KATO-Hiro 651f98b
docs: apply prettier formatting to plan.md table
KATO-Hiro 1d4a531
docs: condense contest module restructure plan
KATO-Hiro 28be5fe
docs: remove contest module restructure plan
KATO-Hiro 750265c
refactor(contests): split label tests by contest type and harden edge…
KATO-Hiro 2ff2fb0
docs(rules): add test-integrity guards and verify-test-strength skill
KATO-Hiro 5a07662
test(contests): expand university label cases and clarify registry rule
KATO-Hiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| name: verify-test-strength | ||
| description: Prove what a test file actually detects by mutating the production source. Use when a test file's value is in doubt — after writing tests for existing behavior, before deleting or compressing tests, or when reviewing a large test file that may be tautological. | ||
| argument-hint: '[test-file-path]' | ||
| --- | ||
|
|
||
| Measure the detection power of the tests for: $ARGUMENTS | ||
|
|
||
| 1. **Baseline** — run the target test file; record the pass count | ||
| 2. **Mutate** — apply the mutants in [instructions.md](instructions.md) one at a time, restoring after each; record which test names fail | ||
| 3. **Report** — a mutant × detecting-test matrix; name the missing tests and the deletion candidates | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Mutation-Based Test Verification | ||
|
|
||
| Mutate the production source, never the test. A test's worth is what it detects, not how many cases it enumerates. | ||
|
|
||
| ## Mutants | ||
|
|
||
| Apply 3–4, one at a time, restoring before the next. | ||
|
|
||
| | Mutant | Detects | | ||
| | ------------------------------------ | ------------------------------------- | | ||
| | Remove one entry from a lookup table | Registry exhaustiveness | | ||
| | Swap two values that encode an order | The ordering contract | | ||
| | Make the function return a constant | That the function is exercised at all | | ||
| | Invert one guard clause | Boundary handling | | ||
|
|
||
| **Mutants must preserve the original type.** A `0.5` mutant for an integer field is caught by a type check (`Number.isInteger`), not by the assertion being measured — a false positive about the test's strength. | ||
|
|
||
| ## Procedure | ||
|
|
||
| ```bash | ||
| cp <source> /tmp/source.bak # 1. save | ||
| perl -0777 -pi -e 's/<pattern>/<mutant>/' <source> # 2. mutate | ||
| pnpm exec vitest run <test-file> --reporter=verbose # 3. run | ||
| cp /tmp/source.bak <source> && git diff <source> # 4. restore, then verify | ||
| ``` | ||
|
|
||
| Repeat per mutant. Step 4 is not optional — an unrestored mutant silently poisons every later measurement. | ||
|
|
||
| ## Reading results | ||
|
|
||
| Read stdout from `--reporter=default` / `--reporter=verbose`. **Never read a cached JSON report** (`.vitest/json/output.json`) — under a CLI wrapper it may not be rewritten, leaving a stale file from a previous run that reports the mutant as undetected. | ||
|
|
||
| ## Interpreting | ||
|
|
||
| - **A mutant nothing catches** — a missing test. Write it. | ||
| - **A test catching nothing that other tests miss** — a deletion candidate. Confirm by re-running the full mutant set without it. | ||
| - **N tests failing on one mutant** — not N times the value. Parameterized cases over one fixture usually report the same fact N times; the count is a proxy, not evidence. | ||
|
|
||
| Record the matrix in the commit message or `plan.md` when it justifies removing tests — it is the evidence `.claude/rules/testing.md` requires for a deliberate test-count drop. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.