takt 0.32.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builtins/en/facets/instructions/e2e-coverage-implement.md +26 -0
- package/builtins/en/facets/instructions/e2e-coverage-plan.md +38 -0
- package/builtins/en/facets/instructions/e2e-coverage-supervise.md +21 -0
- package/builtins/en/facets/instructions/fix.md +4 -0
- package/builtins/en/facets/instructions/loop-monitor-ai-fix.md +4 -3
- package/builtins/en/facets/instructions/loop-monitor-reviewers-fix.md +4 -2
- package/builtins/en/facets/instructions/review-frontend.md +7 -0
- package/builtins/en/facets/instructions/security-audit-plan.md +12 -0
- package/builtins/en/facets/instructions/security-audit-review.md +22 -0
- package/builtins/en/facets/instructions/security-audit-supervise.md +20 -0
- package/builtins/en/facets/instructions/security-audit-team-leader.md +27 -0
- package/builtins/en/facets/knowledge/e2e-testing.md +89 -0
- package/builtins/en/facets/knowledge/unit-testing.md +108 -0
- package/builtins/en/facets/output-contracts/e2e-coverage-plan.md +33 -0
- package/builtins/en/facets/output-contracts/security-audit.md +31 -0
- package/builtins/en/facets/personas/coder.md +1 -0
- package/builtins/en/facets/personas/frontend-reviewer.md +4 -0
- package/builtins/en/facets/policies/ai-antipattern.md +43 -0
- package/builtins/en/facets/policies/coding.md +67 -0
- package/builtins/en/facets/policies/design-fidelity.md +51 -0
- package/builtins/en/facets/policies/qa.md +15 -0
- package/builtins/en/facets/policies/testing.md +23 -1
- package/builtins/en/piece-categories.yaml +3 -2
- package/builtins/en/pieces/backend-cqrs.yaml +5 -0
- package/builtins/en/pieces/backend.yaml +5 -0
- package/builtins/en/pieces/default.yaml +2 -0
- package/builtins/en/pieces/dual-cqrs-mini.yaml +5 -0
- package/builtins/en/pieces/dual-cqrs.yaml +7 -1
- package/builtins/en/pieces/dual-mini.yaml +5 -0
- package/builtins/en/pieces/dual.yaml +11 -1
- package/builtins/en/pieces/{e2e-test.yaml → fill-e2e.yaml} +41 -61
- package/builtins/en/pieces/{unit-test.yaml → fill-unit.yaml} +12 -2
- package/builtins/en/pieces/frontend-mini.yaml +5 -0
- package/builtins/en/pieces/frontend.yaml +12 -1
- package/builtins/en/pieces/review-default.yaml +3 -0
- package/builtins/en/pieces/review-dual-cqrs.yaml +3 -1
- package/builtins/en/pieces/review-dual.yaml +3 -1
- package/builtins/en/pieces/review-fix-default.yaml +3 -0
- package/builtins/en/pieces/review-fix-dual-cqrs.yaml +5 -1
- package/builtins/en/pieces/review-fix-dual.yaml +5 -1
- package/builtins/en/pieces/review-fix-frontend.yaml +5 -1
- package/builtins/en/pieces/review-fix-takt-default.yaml +5 -2
- package/builtins/en/pieces/review-frontend.yaml +3 -1
- package/builtins/en/pieces/review-takt-default.yaml +3 -0
- package/builtins/en/pieces/security-audit.yaml +68 -0
- package/builtins/en/pieces/takt-default.yaml +7 -2
- package/builtins/en/pieces/terraform.yaml +0 -5
- package/builtins/ja/INSTRUCTION_STYLE_GUIDE.md +9 -10
- package/builtins/ja/KNOWLEDGE_STYLE_GUIDE.md +4 -4
- package/builtins/ja/OUTPUT_CONTRACT_STYLE_GUIDE.md +4 -4
- package/builtins/ja/PERSONA_STYLE_GUIDE.md +8 -8
- package/builtins/ja/POLICY_STYLE_GUIDE.md +5 -5
- package/builtins/ja/STYLE_GUIDE.md +8 -26
- package/builtins/ja/facets/instructions/e2e-coverage-implement.md +26 -0
- package/builtins/ja/facets/instructions/e2e-coverage-plan.md +38 -0
- package/builtins/ja/facets/instructions/e2e-coverage-supervise.md +21 -0
- package/builtins/ja/facets/instructions/fix.md +4 -0
- package/builtins/ja/facets/instructions/loop-monitor-ai-fix.md +4 -3
- package/builtins/ja/facets/instructions/loop-monitor-reviewers-fix.md +4 -2
- package/builtins/ja/facets/instructions/review-frontend.md +7 -0
- package/builtins/ja/facets/instructions/security-audit-plan.md +12 -0
- package/builtins/ja/facets/instructions/security-audit-review.md +22 -0
- package/builtins/ja/facets/instructions/security-audit-supervise.md +20 -0
- package/builtins/ja/facets/instructions/security-audit-team-leader.md +27 -0
- package/builtins/ja/facets/knowledge/e2e-testing.md +89 -0
- package/builtins/ja/facets/knowledge/unit-testing.md +108 -0
- package/builtins/ja/facets/output-contracts/e2e-coverage-plan.md +33 -0
- package/builtins/ja/facets/output-contracts/security-audit.md +31 -0
- package/builtins/ja/facets/personas/coder.md +1 -0
- package/builtins/ja/facets/personas/frontend-reviewer.md +2 -0
- package/builtins/ja/facets/policies/ai-antipattern.md +43 -0
- package/builtins/ja/facets/policies/coding.md +67 -0
- package/builtins/ja/facets/policies/design-fidelity.md +51 -0
- package/builtins/ja/facets/policies/qa.md +15 -0
- package/builtins/ja/facets/policies/testing.md +23 -1
- package/builtins/ja/piece-categories.yaml +3 -2
- package/builtins/ja/pieces/backend-cqrs.yaml +5 -0
- package/builtins/ja/pieces/backend.yaml +5 -0
- package/builtins/ja/pieces/default.yaml +2 -0
- package/builtins/ja/pieces/dual-cqrs-mini.yaml +5 -0
- package/builtins/ja/pieces/dual-cqrs.yaml +7 -1
- package/builtins/ja/pieces/dual-mini.yaml +5 -0
- package/builtins/ja/pieces/dual.yaml +11 -1
- package/builtins/ja/pieces/{e2e-test.yaml → fill-e2e.yaml} +40 -60
- package/builtins/ja/pieces/{unit-test.yaml → fill-unit.yaml} +12 -2
- package/builtins/ja/pieces/frontend-mini.yaml +5 -0
- package/builtins/ja/pieces/frontend.yaml +12 -1
- package/builtins/ja/pieces/review-default.yaml +3 -0
- package/builtins/ja/pieces/review-dual-cqrs.yaml +3 -1
- package/builtins/ja/pieces/review-dual.yaml +3 -1
- package/builtins/ja/pieces/review-fix-default.yaml +3 -0
- package/builtins/ja/pieces/review-fix-dual-cqrs.yaml +5 -1
- package/builtins/ja/pieces/review-fix-dual.yaml +5 -1
- package/builtins/ja/pieces/review-fix-frontend.yaml +5 -1
- package/builtins/ja/pieces/review-fix-takt-default.yaml +5 -2
- package/builtins/ja/pieces/review-frontend.yaml +3 -1
- package/builtins/ja/pieces/review-takt-default.yaml +3 -0
- package/builtins/ja/pieces/security-audit.yaml +68 -0
- package/builtins/ja/pieces/takt-default.yaml +7 -2
- package/builtins/ja/pieces/terraform.yaml +0 -5
- package/dist/app/cli/routing.js +1 -1
- package/dist/app/cli/routing.js.map +1 -1
- package/dist/core/models/config-types.d.ts +4 -0
- package/dist/core/models/config-types.d.ts.map +1 -1
- package/dist/core/models/schemas.d.ts +4 -0
- package/dist/core/models/schemas.d.ts.map +1 -1
- package/dist/core/models/schemas.js +4 -0
- package/dist/core/models/schemas.js.map +1 -1
- package/dist/core/piece/engine/MovementExecutor.d.ts +1 -0
- package/dist/core/piece/engine/MovementExecutor.d.ts.map +1 -1
- package/dist/core/piece/engine/MovementExecutor.js +8 -4
- package/dist/core/piece/engine/MovementExecutor.js.map +1 -1
- package/dist/core/piece/engine/OptionsBuilder.d.ts.map +1 -1
- package/dist/core/piece/engine/OptionsBuilder.js +4 -1
- package/dist/core/piece/engine/OptionsBuilder.js.map +1 -1
- package/dist/features/config/deploySkillInternal.d.ts.map +1 -1
- package/dist/features/config/deploySkillInternal.js +2 -6
- package/dist/features/config/deploySkillInternal.js.map +1 -1
- package/dist/features/interactive/conversationLoop.d.ts.map +1 -1
- package/dist/features/interactive/conversationLoop.js +4 -15
- package/dist/features/interactive/conversationLoop.js.map +1 -1
- package/dist/features/pipeline/steps.d.ts.map +1 -1
- package/dist/features/pipeline/steps.js +5 -1
- package/dist/features/pipeline/steps.js.map +1 -1
- package/dist/features/tasks/execute/resolveTask.d.ts.map +1 -1
- package/dist/features/tasks/execute/resolveTask.js +11 -3
- package/dist/features/tasks/execute/resolveTask.js.map +1 -1
- package/dist/infra/config/global/globalConfigCore.d.ts.map +1 -1
- package/dist/infra/config/global/globalConfigCore.js +11 -8
- package/dist/infra/config/global/globalConfigCore.js.map +1 -1
- package/dist/infra/config/global/globalConfigSerializer.d.ts.map +1 -1
- package/dist/infra/config/global/globalConfigSerializer.js +6 -0
- package/dist/infra/config/global/globalConfigSerializer.js.map +1 -1
- package/dist/infra/config/pathExpansion.d.ts +3 -0
- package/dist/infra/config/pathExpansion.d.ts.map +1 -0
- package/dist/infra/config/pathExpansion.js +15 -0
- package/dist/infra/config/pathExpansion.js.map +1 -0
- package/dist/infra/config/project/projectConfig.d.ts.map +1 -1
- package/dist/infra/config/project/projectConfig.js +15 -2
- package/dist/infra/config/project/projectConfig.js.map +1 -1
- package/dist/infra/config/resolveConfigValue.d.ts.map +1 -1
- package/dist/infra/config/resolveConfigValue.js +4 -1
- package/dist/infra/config/resolveConfigValue.js.map +1 -1
- package/dist/infra/cursor/client.js +1 -1
- package/dist/infra/cursor/client.js.map +1 -1
- package/dist/infra/github/pr.d.ts.map +1 -1
- package/dist/infra/github/pr.js +36 -8
- package/dist/infra/github/pr.js.map +1 -1
- package/dist/infra/resources/index.d.ts +5 -6
- package/dist/infra/resources/index.d.ts.map +1 -1
- package/dist/infra/resources/index.js +5 -6
- package/dist/infra/resources/index.js.map +1 -1
- package/dist/infra/task/autoCommit.d.ts.map +1 -1
- package/dist/infra/task/autoCommit.js +5 -1
- package/dist/infra/task/autoCommit.js.map +1 -1
- package/dist/infra/task/clone.d.ts +2 -1
- package/dist/infra/task/clone.d.ts.map +1 -1
- package/dist/infra/task/clone.js +5 -2
- package/dist/infra/task/clone.js.map +1 -1
- package/dist/infra/task/git.d.ts +5 -1
- package/dist/infra/task/git.d.ts.map +1 -1
- package/dist/infra/task/git.js +51 -3
- package/dist/infra/task/git.js.map +1 -1
- package/dist/infra/task/index.d.ts +1 -1
- package/dist/infra/task/index.d.ts.map +1 -1
- package/dist/infra/task/index.js +1 -1
- package/dist/infra/task/index.js.map +1 -1
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/index.js.map +1 -1
- package/dist/shared/utils/pathBoundary.d.ts +2 -0
- package/dist/shared/utils/pathBoundary.d.ts.map +1 -0
- package/dist/shared/utils/pathBoundary.js +10 -0
- package/dist/shared/utils/pathBoundary.js.map +1 -0
- package/package.json +1 -1
- package/builtins/en/facets/instructions/implement-e2e-test.md +0 -51
- package/builtins/en/facets/instructions/plan-e2e-test.md +0 -11
- package/builtins/en/templates/instructions/ai-fix.md +0 -74
- package/builtins/en/templates/instructions/ai-review-standalone.md +0 -47
- package/builtins/en/templates/instructions/arbitrate.md +0 -45
- package/builtins/en/templates/instructions/architect.md +0 -48
- package/builtins/en/templates/instructions/fix.md +0 -86
- package/builtins/en/templates/instructions/implement.md +0 -102
- package/builtins/en/templates/instructions/plan.md +0 -55
- package/builtins/en/templates/instructions/review.md +0 -101
- package/builtins/en/templates/instructions/supervise.md +0 -106
- package/builtins/en/templates/personas/character.md +0 -45
- package/builtins/en/templates/personas/expert.md +0 -68
- package/builtins/en/templates/personas/simple.md +0 -22
- package/builtins/en/templates/policies/policy.md +0 -49
- package/builtins/en/templates/reports/architecture-design.md +0 -31
- package/builtins/en/templates/reports/plan.md +0 -70
- package/builtins/en/templates/reports/review.md +0 -143
- package/builtins/en/templates/reports/security-review.md +0 -43
- package/builtins/en/templates/reports/summary.md +0 -52
- package/builtins/en/templates/reports/validation.md +0 -31
- package/builtins/ja/facets/instructions/implement-e2e-test.md +0 -51
- package/builtins/ja/facets/instructions/plan-e2e-test.md +0 -11
- package/builtins/ja/templates/instructions/ai-fix.md +0 -74
- package/builtins/ja/templates/instructions/ai-review-standalone.md +0 -47
- package/builtins/ja/templates/instructions/arbitrate.md +0 -45
- package/builtins/ja/templates/instructions/architect.md +0 -48
- package/builtins/ja/templates/instructions/fix.md +0 -86
- package/builtins/ja/templates/instructions/implement.md +0 -102
- package/builtins/ja/templates/instructions/plan.md +0 -55
- package/builtins/ja/templates/instructions/review.md +0 -101
- package/builtins/ja/templates/instructions/supervise.md +0 -106
- package/builtins/ja/templates/knowledge/knowledge.md +0 -39
- package/builtins/ja/templates/output-contracts/architecture-design.md +0 -31
- package/builtins/ja/templates/output-contracts/plan.md +0 -70
- package/builtins/ja/templates/output-contracts/review.md +0 -143
- package/builtins/ja/templates/output-contracts/security-review.md +0 -43
- package/builtins/ja/templates/output-contracts/summary.md +0 -52
- package/builtins/ja/templates/output-contracts/validation.md +0 -31
- package/builtins/ja/templates/personas/character.md +0 -43
- package/builtins/ja/templates/personas/expert.md +0 -21
- package/builtins/ja/templates/personas/simple.md +0 -22
- package/builtins/ja/templates/policies/policy.md +0 -49
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Implement missing E2E tests based on the test case list.
|
|
2
|
+
|
|
3
|
+
**Important:** Refer to the test plan report: {report:01-e2e-coverage-plan.md}
|
|
4
|
+
|
|
5
|
+
**Note:** If Previous Response exists, this is a resubmission.
|
|
6
|
+
Check which test cases were flagged as unimplemented and implement them.
|
|
7
|
+
|
|
8
|
+
**What to do:**
|
|
9
|
+
1. Review the numbered test case list from the test plan
|
|
10
|
+
2. Implement tests following existing E2E test patterns (file structure, helpers, fixtures, mock strategy)
|
|
11
|
+
3. Implement ALL cases in the test case list (do not stop after implementing just a few)
|
|
12
|
+
4. Run E2E tests and confirm all tests pass
|
|
13
|
+
5. Confirm existing E2E tests are not broken
|
|
14
|
+
|
|
15
|
+
**Implementation constraints:**
|
|
16
|
+
- Do not modify the existing E2E test framework
|
|
17
|
+
- Write one scenario per concern with clear expected results
|
|
18
|
+
- Follow existing fixture/helper/mock patterns for cases with external dependencies
|
|
19
|
+
|
|
20
|
+
**Required output (include headings)**
|
|
21
|
+
## Implemented Test Cases
|
|
22
|
+
- {Test case list number and corresponding test file/test name}
|
|
23
|
+
## Unimplemented Test Cases (if any)
|
|
24
|
+
- {Number and reason for not implementing}
|
|
25
|
+
## Test Results
|
|
26
|
+
- {Execution command and results}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Comprehensively identify all user operation routes in the application and create a list of missing E2E test cases.
|
|
2
|
+
|
|
3
|
+
**Note:** If Previous Response exists, this is a resubmission.
|
|
4
|
+
Review and revise the list based on that feedback.
|
|
5
|
+
|
|
6
|
+
**What to do:**
|
|
7
|
+
|
|
8
|
+
1. **Understand the E2E test infrastructure**
|
|
9
|
+
- Review existing E2E test directory structure, test runner, helpers, fixtures, and mock strategy
|
|
10
|
+
- Identify the test execution commands
|
|
11
|
+
|
|
12
|
+
2. **Identify user operation entry points** (read CODE, not just documentation)
|
|
13
|
+
- For CLI: extract command definitions, subcommands, and options from code
|
|
14
|
+
- For Web: extract routing definitions, page transitions, and API endpoints from code
|
|
15
|
+
- Trace each entry point's handler and processing flow, identifying branches and state transitions
|
|
16
|
+
|
|
17
|
+
3. **Deep-dive into UX variations**
|
|
18
|
+
- For each entry point, enumerate all possible routes a user can take
|
|
19
|
+
- Option/flag combinations that create different branches (e.g., `--pipeline` on/off, `--auto-pr` on/off)
|
|
20
|
+
- State-dependent branches (first run vs existing data, config present vs absent)
|
|
21
|
+
- Not just happy paths — error handling and recovery routes when things fail midway
|
|
22
|
+
- Permission/role-based routes
|
|
23
|
+
- External dependency state branches (connection success vs failure, normal vs abnormal response)
|
|
24
|
+
|
|
25
|
+
4. **Cross-reference with existing E2E tests**
|
|
26
|
+
- Analyze what existing tests cover on a per-file basis
|
|
27
|
+
- Identify which routes are already covered by existing tests
|
|
28
|
+
- List uncovered routes as "missing test cases"
|
|
29
|
+
|
|
30
|
+
5. **Create the test case list**
|
|
31
|
+
- Assign a unique number to every test case (this is the ledger supervisor uses for verification)
|
|
32
|
+
- Assign priority to each case (user impact × untested risk)
|
|
33
|
+
- **Do NOT abbreviate.** Don't stop at 1-2 cases — enumerate ALL identified routes
|
|
34
|
+
|
|
35
|
+
**Strictly prohibited:**
|
|
36
|
+
- Reading only docs/README and guessing test cases → PROHIBITED. Read the code
|
|
37
|
+
- Cutting the list short with "there might be more" → PROHIBITED. Enumerate all
|
|
38
|
+
- Including cases already covered by existing tests → PROHIBITED. Only list verified gaps
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Cross-reference the test case list from the plan with implementation results, and verify all cases have been implemented.
|
|
2
|
+
|
|
3
|
+
**Important:** Refer to the test plan report: {report:01-e2e-coverage-plan.md}
|
|
4
|
+
|
|
5
|
+
**Verification procedure:**
|
|
6
|
+
|
|
7
|
+
1. **Cross-reference with test case list (most important)**
|
|
8
|
+
- Check each numbered test case from the plan report one by one
|
|
9
|
+
- Identify the corresponding test file and test name for each case
|
|
10
|
+
- Read the test file to confirm the case is actually tested
|
|
11
|
+
- List any cases without a corresponding test as "unimplemented"
|
|
12
|
+
- REJECT if even one unimplemented case exists
|
|
13
|
+
|
|
14
|
+
2. **Test quality verification**
|
|
15
|
+
- Does each test correctly verify the intent of the test case?
|
|
16
|
+
- Are assertions appropriate (not just existence checks, but value verification)?
|
|
17
|
+
- Does the mock/fixture usage follow existing patterns?
|
|
18
|
+
|
|
19
|
+
3. **Test execution verification**
|
|
20
|
+
- Run E2E tests and confirm all tests pass
|
|
21
|
+
- Confirm existing tests are not broken
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
Use reports in the Report Directory and fix the issues raised by the reviewer.
|
|
2
2
|
|
|
3
|
+
**Fix principles:**
|
|
4
|
+
- When a finding includes a "suggested fix", follow it rather than inventing your own workaround
|
|
5
|
+
- Fix the target code directly. Do not deflect findings by adding tests or documentation instead
|
|
6
|
+
|
|
3
7
|
**Report reference policy:**
|
|
4
8
|
- Use the latest review reports in the Report Directory as primary evidence.
|
|
5
9
|
- Past iteration reports are saved as `{filename}.{timestamp}` in the same directory (e.g., `architect-review.md.20260304T123456Z`). For each report, run Glob with a `{report-name}.*` pattern, read up to 2 files in descending timestamp order, and understand persists / reopened trends before starting fixes.
|
|
@@ -7,6 +7,7 @@ is healthy (making progress) or unproductive (repeating the same issues).
|
|
|
7
7
|
- AI Review results: {report:ai-review.md}
|
|
8
8
|
|
|
9
9
|
**Judgment criteria:**
|
|
10
|
-
- Are
|
|
11
|
-
-
|
|
12
|
-
-
|
|
10
|
+
- Are the same finding_ids persisting across multiple cycles?
|
|
11
|
+
- Same finding_id repeatedly persists → unproductive (stuck)
|
|
12
|
+
- Previous findings resolved and new findings appear as new → healthy (progressing)
|
|
13
|
+
- Are fixes actually being applied to the code?
|
|
@@ -4,6 +4,8 @@ Review the latest review reports in the Report Directory and determine
|
|
|
4
4
|
whether this loop is healthy (converging) or unproductive (diverging or oscillating).
|
|
5
5
|
|
|
6
6
|
**Judgment criteria:**
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- Are the same finding_ids persisting across multiple cycles?
|
|
8
|
+
- Same finding_id repeatedly persists → unproductive (stuck)
|
|
9
|
+
- Previous findings resolved and new findings appear as new → healthy (converging)
|
|
9
10
|
- Are fixes actually being applied to the code?
|
|
11
|
+
- Is the number of new / reopened findings decreasing overall?
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Review the changes from a frontend development perspective.
|
|
2
2
|
|
|
3
3
|
**Review criteria:**
|
|
4
|
+
- Design fidelity (top priority when a design reference is provided)
|
|
4
5
|
- Component design (separation of concerns, granularity)
|
|
5
6
|
- State management (local vs. global decisions)
|
|
6
7
|
- Performance (re-renders, memoization)
|
|
@@ -8,6 +9,12 @@ Review the changes from a frontend development perspective.
|
|
|
8
9
|
- Data fetching patterns
|
|
9
10
|
- TypeScript type safety
|
|
10
11
|
|
|
12
|
+
**Design fidelity check (when a design reference exists):**
|
|
13
|
+
1. Identify the design reference from the task order's referenced materials
|
|
14
|
+
2. Compare design elements (layout, wording, colors, spacing) against implementation element by element
|
|
15
|
+
3. For any discrepancy, check the decisions log to determine if it was intentional
|
|
16
|
+
4. Report unintentional discrepancies as blocking issues
|
|
17
|
+
|
|
11
18
|
**Note**: If this project does not include a frontend,
|
|
12
19
|
proceed as no issues found.
|
|
13
20
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Understand the overall project structure and create a complete list of files to be audited for security.
|
|
2
|
+
|
|
3
|
+
**What to do:**
|
|
4
|
+
1. Identify the project's source code directories and list all files using Glob
|
|
5
|
+
2. Understand the project's tech stack, frameworks, and major dependencies
|
|
6
|
+
3. Classify each file's role briefly (API layer, domain layer, infrastructure layer, utilities, etc.)
|
|
7
|
+
4. Identify files with high security risk (authentication, input handling, external communication, file operations, configuration, etc.)
|
|
8
|
+
|
|
9
|
+
**Important:**
|
|
10
|
+
- List ALL files without omission. Do not abbreviate
|
|
11
|
+
- Include configuration files and test files
|
|
12
|
+
- Even if the file count is large, list every single file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Re-audit the files that were judged insufficient in the previous audit.
|
|
2
|
+
|
|
3
|
+
**Important:** Review the supervisor's verification results and understand:
|
|
4
|
+
- List of unaudited files
|
|
5
|
+
- List of files flagged as insufficiently audited
|
|
6
|
+
- Specific feedback
|
|
7
|
+
|
|
8
|
+
**What to do:**
|
|
9
|
+
1. **Read each flagged file in full using Read tool one by one**
|
|
10
|
+
2. Review each file from a security perspective
|
|
11
|
+
3. Report discovered issues with severity ratings
|
|
12
|
+
|
|
13
|
+
**Strictly prohibited:**
|
|
14
|
+
- Searching with Grep and only reviewing matching files → PROHIBITED
|
|
15
|
+
- Reading only part of a file → PROHIBITED
|
|
16
|
+
- Skipping a file because it "looks fine" → PROHIBITED
|
|
17
|
+
|
|
18
|
+
**Required output (include headings):**
|
|
19
|
+
## Re-audit Results
|
|
20
|
+
- {Audit results for each file}
|
|
21
|
+
## Detected Issues
|
|
22
|
+
- {Issue details (severity, location, remediation)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Verify the completeness and quality of the security audit.
|
|
2
|
+
|
|
3
|
+
**Important:** Refer to the plan report: {report:01-plan.md}
|
|
4
|
+
|
|
5
|
+
**Verification procedure:**
|
|
6
|
+
|
|
7
|
+
1. **Completeness verification (most important)**
|
|
8
|
+
- Cross-reference the file list from the plan report with files mentioned in the audit results
|
|
9
|
+
- List any files not mentioned in the audit results as "unaudited files"
|
|
10
|
+
- REJECT if even one unaudited file exists
|
|
11
|
+
|
|
12
|
+
2. **Methodology verification**
|
|
13
|
+
- Check whether each file's audit result references specific code content
|
|
14
|
+
- If a file only says "no issues" without mentioning specific content checked, it may not have been actually Read → REJECT
|
|
15
|
+
- Check for signs that judgment was based solely on Grep keyword matching
|
|
16
|
+
|
|
17
|
+
3. **Quality verification**
|
|
18
|
+
- Check whether severity classifications of detected issues are appropriate
|
|
19
|
+
- Read a few high-security-risk files yourself to verify no issues were missed
|
|
20
|
+
- Check whether there are too many false positives
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Decompose the security audit task, assign files to each part, and execute in parallel.
|
|
2
|
+
|
|
3
|
+
**Important:** Refer to the plan report: {report:01-plan.md}
|
|
4
|
+
|
|
5
|
+
**What to do:**
|
|
6
|
+
|
|
7
|
+
1. Review the file list from the plan report and understand all files to be audited
|
|
8
|
+
2. Split files into 3 groups by module/layer
|
|
9
|
+
- Distribute high-security-risk files (authentication, input handling, external communication, etc.) evenly across groups
|
|
10
|
+
- Keep related files (within the same module) in the same group when possible
|
|
11
|
+
3. Assign exclusive file ownership to each part
|
|
12
|
+
|
|
13
|
+
**Each part's instruction MUST include:**
|
|
14
|
+
- **Assigned file list** (all file paths to review via Read)
|
|
15
|
+
- **Audit procedure:**
|
|
16
|
+
1. **Read each assigned file in full using Read tool one by one** (do NOT abbreviate with Grep or partial reads)
|
|
17
|
+
2. Review each file from a security perspective
|
|
18
|
+
3. Report discovered issues with severity ratings
|
|
19
|
+
- **Strictly prohibited:**
|
|
20
|
+
- Searching with Grep and only reviewing matching files → PROHIBITED. Read ALL files
|
|
21
|
+
- Reading only part of a file → PROHIBITED. Read the entire file
|
|
22
|
+
- Skipping a file because it "looks fine" → PROHIBITED. Review every file
|
|
23
|
+
- **Completion criteria:** All assigned files have been Read in full, and audit results are reported for each file
|
|
24
|
+
|
|
25
|
+
**Constraints:**
|
|
26
|
+
- Each part is read-only. Do not modify code
|
|
27
|
+
- Do not audit files outside your assignment (to prevent overlap)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# E2E Testing Knowledge
|
|
2
|
+
|
|
3
|
+
## E2E Test Scope
|
|
4
|
+
|
|
5
|
+
E2E tests verify the entire user operation flow. Their scope differs from unit and integration tests.
|
|
6
|
+
|
|
7
|
+
| Test Type | Scope | Verification Target |
|
|
8
|
+
|-----------|-------|-------------------|
|
|
9
|
+
| Unit | Function/Class | Logic correctness |
|
|
10
|
+
| Integration | Inter-module coupling | Data flow correctness |
|
|
11
|
+
| E2E | Entire user operation flow | Behavior as seen by the user |
|
|
12
|
+
|
|
13
|
+
| Criteria | Judgment |
|
|
14
|
+
|----------|----------|
|
|
15
|
+
| Writing E2E tests for logic that unit tests can cover | Warning. Consider moving to unit tests |
|
|
16
|
+
| Verifying user operation flows | E2E test is appropriate |
|
|
17
|
+
| Scenarios spanning multiple commands/pages | E2E test is appropriate |
|
|
18
|
+
| Error message display verification | E2E test is appropriate |
|
|
19
|
+
|
|
20
|
+
## UX Route Identification
|
|
21
|
+
|
|
22
|
+
E2E test completeness depends on thorough UX route identification. Identify entry points from code, not documentation.
|
|
23
|
+
|
|
24
|
+
### Entry Point Identification
|
|
25
|
+
|
|
26
|
+
| Application Type | How to Find Entry Points |
|
|
27
|
+
|-----------------|-------------------------|
|
|
28
|
+
| CLI | Extract command definitions, subcommand registrations, option/flag definitions from code |
|
|
29
|
+
| Web | Extract routing definitions, page component lists from code |
|
|
30
|
+
| API | Extract endpoint definitions, router registrations from code |
|
|
31
|
+
|
|
32
|
+
### Branch Patterns
|
|
33
|
+
|
|
34
|
+
Exhaustively enumerate routes branching from each entry point.
|
|
35
|
+
|
|
36
|
+
| Branch Pattern | Example |
|
|
37
|
+
|---------------|---------|
|
|
38
|
+
| Option/flag combinations | `--verbose` on/off, `--format json` vs `--format table` |
|
|
39
|
+
| State-dependent branches | First run vs existing data, config present vs absent |
|
|
40
|
+
| Permission/role | Admin vs regular user, authenticated vs unauthenticated |
|
|
41
|
+
| External dependency state | Connection success vs timeout, normal vs error response |
|
|
42
|
+
| Error recovery | Retry on midway failure, rollback |
|
|
43
|
+
| Input variations | Valid input, invalid input, empty input, boundary values |
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Mock Boundary Design
|
|
47
|
+
|
|
48
|
+
In E2E tests, deciding "how far to run real code and where to start mocking" is critical.
|
|
49
|
+
|
|
50
|
+
### Mock Design Principles
|
|
51
|
+
|
|
52
|
+
- Run the application code under test as-is
|
|
53
|
+
- Insert mocks at external service boundaries
|
|
54
|
+
- Follow existing fixture/helper mock patterns
|
|
55
|
+
- Check existing mock infrastructure before introducing new mechanisms
|
|
56
|
+
|
|
57
|
+
## Flaky Test Prevention
|
|
58
|
+
|
|
59
|
+
E2E tests are prone to non-deterministic failures.
|
|
60
|
+
|
|
61
|
+
| Cause | Mitigation |
|
|
62
|
+
|-------|-----------|
|
|
63
|
+
| Timing dependency | Use explicit wait conditions (state-based waits, not fixed sleeps) |
|
|
64
|
+
| Port conflicts | Assign random ports per test |
|
|
65
|
+
| Filesystem residue | Create temp directories per test, cleanup on teardown |
|
|
66
|
+
| Process leaks | Set timeouts and force-kill |
|
|
67
|
+
| Environment dependency | Explicitly set up prerequisites for test execution |
|
|
68
|
+
| Execution order dependency | Initialize state so each test runs independently |
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// NG - fixed sleep for timing
|
|
72
|
+
await sleep(3000)
|
|
73
|
+
expect(result).toBeDefined()
|
|
74
|
+
|
|
75
|
+
// OK - condition-based wait
|
|
76
|
+
await waitFor(() => expect(result).toBeDefined(), { timeout: 5000 })
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Test Case Management
|
|
80
|
+
|
|
81
|
+
Manage test cases as a list to guarantee E2E test completeness.
|
|
82
|
+
|
|
83
|
+
| Principle | Description |
|
|
84
|
+
|-----------|-------------|
|
|
85
|
+
| Numbered list | Assign a unique number to each test case and track implementation status |
|
|
86
|
+
| Classify by entry point | Group by command/page/endpoint |
|
|
87
|
+
| Prioritize | Determine priority by user impact × untested risk |
|
|
88
|
+
| Cross-reference with existing tests | Check existing test coverage before adding new tests |
|
|
89
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Unit Testing Knowledge
|
|
2
|
+
|
|
3
|
+
## Test Double Selection
|
|
4
|
+
|
|
5
|
+
Choose test doubles based on purpose. Excessive mocking reduces test reliability.
|
|
6
|
+
|
|
7
|
+
| Type | Purpose | Use Case |
|
|
8
|
+
|------|---------|----------|
|
|
9
|
+
| Stub | Return fixed values | Control output of external dependencies |
|
|
10
|
+
| Mock | Verify invocations | Confirm method calls and arguments |
|
|
11
|
+
| Spy | Record calls while preserving implementation | Verify side effects |
|
|
12
|
+
| Fake | Lightweight implementation | In-memory DB or similar lightweight substitutes |
|
|
13
|
+
|
|
14
|
+
### Mock Granularity
|
|
15
|
+
|
|
16
|
+
- Mock only direct dependencies of the test target (not indirect dependencies)
|
|
17
|
+
- "Too many mocks" suggests a design problem in the test target
|
|
18
|
+
- Pure functions have no dependencies and need no mocking
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// NG - mocking internal implementation (testing implementation, not behavior)
|
|
22
|
+
vi.spyOn(service, 'privateMethod')
|
|
23
|
+
service.execute()
|
|
24
|
+
expect(service.privateMethod).toHaveBeenCalled()
|
|
25
|
+
|
|
26
|
+
// OK - mock external dependency, verify behavior
|
|
27
|
+
const repository = { findById: vi.fn().mockResolvedValue(user) }
|
|
28
|
+
const service = new UserService(repository)
|
|
29
|
+
const result = await service.getUser('id')
|
|
30
|
+
expect(result).toEqual(user)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Boundary Value Analysis
|
|
34
|
+
|
|
35
|
+
Boundary values and equivalence partitioning are fundamental unit testing techniques.
|
|
36
|
+
|
|
37
|
+
| Technique | Description |
|
|
38
|
+
|-----------|-------------|
|
|
39
|
+
| Equivalence partitioning | Divide inputs into equivalent groups, test one from each |
|
|
40
|
+
| Boundary value analysis | Test at equivalence class boundaries (boundary, boundary±1) |
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// NG - happy path only
|
|
44
|
+
test('validates age', () => {
|
|
45
|
+
expect(validateAge(25)).toBe(true)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
// OK - includes boundary values
|
|
49
|
+
test('validates age at boundaries', () => {
|
|
50
|
+
expect(validateAge(0)).toBe(true) // lower bound
|
|
51
|
+
expect(validateAge(-1)).toBe(false) // lower bound - 1
|
|
52
|
+
expect(validateAge(150)).toBe(true) // upper bound
|
|
53
|
+
expect(validateAge(151)).toBe(false) // upper bound + 1
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Test Fixture Design
|
|
58
|
+
|
|
59
|
+
Manage test data with factory functions.
|
|
60
|
+
|
|
61
|
+
- Generate minimal fixtures with factory functions
|
|
62
|
+
- Fill test-irrelevant fields with defaults
|
|
63
|
+
- Do not share and mutate fixtures between tests (maintain test independence)
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// NG - defining all fields every time
|
|
67
|
+
const user = { id: '1', name: 'test', email: 'test@example.com', role: 'admin', createdAt: new Date() }
|
|
68
|
+
|
|
69
|
+
// OK - factory function with minimal overrides
|
|
70
|
+
const createUser = (overrides: Partial<User> = {}): User => ({
|
|
71
|
+
id: 'test-id',
|
|
72
|
+
name: 'test-user',
|
|
73
|
+
email: 'test@example.com',
|
|
74
|
+
role: 'user',
|
|
75
|
+
...overrides,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
test('admin can delete', () => {
|
|
79
|
+
const admin = createUser({ role: 'admin' })
|
|
80
|
+
// only test-relevant fields are explicit
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Test Target Isolation
|
|
85
|
+
|
|
86
|
+
Testability is an indicator of design quality. Hard-to-test code has tightly coupled dependencies.
|
|
87
|
+
|
|
88
|
+
### Dependency Injection Patterns
|
|
89
|
+
|
|
90
|
+
| Pattern | Use Case |
|
|
91
|
+
|---------|----------|
|
|
92
|
+
| Constructor injection | Class-based dependency separation |
|
|
93
|
+
| Function arguments | Accept dependencies as function parameters |
|
|
94
|
+
| Module replacement | Replace entire modules during testing |
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// NG - creates dependency directly (cannot mock in tests)
|
|
98
|
+
class OrderService {
|
|
99
|
+
private repo = new OrderRepository()
|
|
100
|
+
async create(order: Order) { return this.repo.save(order) }
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// OK - constructor injection (mockable in tests)
|
|
104
|
+
class OrderService {
|
|
105
|
+
constructor(private readonly repo: OrderRepository) {}
|
|
106
|
+
async create(order: Order) { return this.repo.save(order) }
|
|
107
|
+
}
|
|
108
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
```markdown
|
|
2
|
+
# E2E Coverage Plan
|
|
3
|
+
|
|
4
|
+
## Project Overview
|
|
5
|
+
{Tech stack, E2E test framework, test execution commands}
|
|
6
|
+
|
|
7
|
+
## User Operation Entry Points
|
|
8
|
+
| # | Entry Point | Type | Handler |
|
|
9
|
+
|---|-------------|------|---------|
|
|
10
|
+
| 1 | {command/route/endpoint} | CLI/Web/API | `src/file.ts:42` |
|
|
11
|
+
|
|
12
|
+
## UX Route Analysis
|
|
13
|
+
### {Entry Point Name}
|
|
14
|
+
| # | Route | Branch Condition | Existing Test |
|
|
15
|
+
|---|-------|-----------------|---------------|
|
|
16
|
+
| 1 | {happy path} | - | ✅ `e2e/file.test.ts` / ❌ none |
|
|
17
|
+
| 2 | {with option X} | `--flag` | ❌ none |
|
|
18
|
+
| 3 | {on error} | {condition} | ❌ none |
|
|
19
|
+
|
|
20
|
+
## Missing Test Case List
|
|
21
|
+
| # | Entry Point | Test Case | Priority | Expected Result to Verify |
|
|
22
|
+
|---|-------------|-----------|----------|--------------------------|
|
|
23
|
+
| 1 | {entry point} | {case summary} | High/Med/Low | {expected result} |
|
|
24
|
+
| 2 | {entry point} | {case summary} | High/Med/Low | {expected result} |
|
|
25
|
+
|
|
26
|
+
## Test Strategy
|
|
27
|
+
- {Mock strategy}
|
|
28
|
+
- {Fixture design}
|
|
29
|
+
- {Existing helper usage}
|
|
30
|
+
|
|
31
|
+
## Implementation Guidelines
|
|
32
|
+
- {Instructions for test implementer}
|
|
33
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
```markdown
|
|
2
|
+
# Security Audit Report
|
|
3
|
+
|
|
4
|
+
## Result: APPROVE / REJECT
|
|
5
|
+
|
|
6
|
+
## Severity: None / Low / Medium / High / Critical
|
|
7
|
+
|
|
8
|
+
## Audit Scope
|
|
9
|
+
| # | File | Audited | Risk Classification |
|
|
10
|
+
|---|------|---------|-------------------|
|
|
11
|
+
| 1 | `src/file.ts` | ✅ | High / Medium / Low |
|
|
12
|
+
|
|
13
|
+
## Detected Issues
|
|
14
|
+
| # | Severity | Category | Location | Issue | Remediation |
|
|
15
|
+
|---|----------|----------|----------|-------|-------------|
|
|
16
|
+
| 1 | Critical | injection | `src/file.ts:42` | {issue description} | {remediation} |
|
|
17
|
+
|
|
18
|
+
## Files with No Issues
|
|
19
|
+
- {list of files where no issues were detected}
|
|
20
|
+
|
|
21
|
+
## Recommendations (non-blocking)
|
|
22
|
+
- {security improvement suggestions}
|
|
23
|
+
|
|
24
|
+
## REJECT Criteria
|
|
25
|
+
- REJECT if one or more High or Critical issues exist
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Cognitive load reduction rules:**
|
|
29
|
+
- No issues → Audit scope table only (15 lines max)
|
|
30
|
+
- Low/Medium only → + issues table (30 lines max)
|
|
31
|
+
- High/Critical present → Full output
|
|
@@ -19,6 +19,7 @@ You are the implementer. Focus on implementation, not design decisions.
|
|
|
19
19
|
- Thoroughness over speed. Code correctness over implementation ease
|
|
20
20
|
- Prioritize "works correctly" over "works for now"
|
|
21
21
|
- Don't implement by guessing; report unclear points
|
|
22
|
+
- When a design reference is provided, match UI appearance, structure, and wording to the design. Do not add, omit, or change anything on your own judgment
|
|
22
23
|
- Work only within the specified project directory (reading external files for reference is allowed)
|
|
23
24
|
|
|
24
25
|
**Reviewer's feedback is absolute. Your understanding is wrong.**
|
|
@@ -12,6 +12,9 @@ The user interface is the only point of contact between the system and users. No
|
|
|
12
12
|
|
|
13
13
|
## Areas of Expertise
|
|
14
14
|
|
|
15
|
+
### Design Fidelity
|
|
16
|
+
- When a design reference is provided, verify implementation matches the design element by element
|
|
17
|
+
|
|
15
18
|
### Component Design
|
|
16
19
|
- Separation of concerns and component granularity
|
|
17
20
|
- Props design and data flow
|
|
@@ -34,6 +37,7 @@ The user interface is the only point of contact between the system and users. No
|
|
|
34
37
|
|
|
35
38
|
## Important
|
|
36
39
|
|
|
40
|
+
- **Design fidelity first**: When a design reference exists, verify design match before evaluating UX quality
|
|
37
41
|
- **Prioritize user experience**: UX over technical correctness
|
|
38
42
|
- **Performance can't be fixed later**: Consider at design stage
|
|
39
43
|
- **Accessibility is hard to retrofit**: Build in from the start
|
|
@@ -75,6 +75,49 @@ Verification approach:
|
|
|
75
75
|
2. If the only difference is optional argument presence, unify with ternary or spread syntax
|
|
76
76
|
3. If branches have different preprocessing, store results in a variable and make a single call
|
|
77
77
|
|
|
78
|
+
## Callback + External Variable Capture Abuse
|
|
79
|
+
|
|
80
|
+
AI tends to implement data retrieval via callbacks and external variable capture when return values would suffice.
|
|
81
|
+
|
|
82
|
+
| Pattern | Example | Verdict |
|
|
83
|
+
|---------|---------|---------|
|
|
84
|
+
| Assign to external variable in callback | `let result; await f(x => { result = x })` | REJECT |
|
|
85
|
+
| Get value via event handler | `emitter.on('data', d => { captured = d })` to synchronously get value | REJECT |
|
|
86
|
+
| Build state across multiple callbacks | `forEach(item => { externalMap.set(...) })` to construct result | REJECT |
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// REJECT - Capturing external variable via callback
|
|
90
|
+
let selectedMode: string | undefined;
|
|
91
|
+
await promptUser(choices, (choice) => {
|
|
92
|
+
selectedMode = choice;
|
|
93
|
+
});
|
|
94
|
+
return selectedMode;
|
|
95
|
+
|
|
96
|
+
// OK - Receive via return value
|
|
97
|
+
const selectedMode = await promptUser(choices);
|
|
98
|
+
return selectedMode;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Verification approach:
|
|
102
|
+
1. Find places where callback functions assign to variables in the outer scope
|
|
103
|
+
2. Check if the value can be returned as a function return value
|
|
104
|
+
3. If possible, flag for rewriting to the return-value pattern
|
|
105
|
+
|
|
106
|
+
## Inappropriate Response to Review Findings
|
|
107
|
+
|
|
108
|
+
AI sometimes "addresses" review findings by adding tests or documentation that "verify the finding" instead of actually fixing the code.
|
|
109
|
+
|
|
110
|
+
| Pattern | Example | Verdict |
|
|
111
|
+
|---------|---------|---------|
|
|
112
|
+
| Adding tests instead of fixing | "Remove unnecessary comments" → adds tests verifying comment presence | REJECT |
|
|
113
|
+
| Adding docs instead of fixing | "DRY violation" → adds documentation explaining duplication is intentional | REJECT |
|
|
114
|
+
| Changing unrelated files | Security finding → performs unrelated refactoring | REJECT |
|
|
115
|
+
|
|
116
|
+
Verification approach:
|
|
117
|
+
1. Check if the fix diff includes changes to the finding's target file and target lines
|
|
118
|
+
2. If the fix consists only of new file additions, check whether those files "fix" the issue or merely "verify" it
|
|
119
|
+
3. If tests are added as part of the fix, verify they test "correct behavior after the fix" (not "the finding itself")
|
|
120
|
+
|
|
78
121
|
## Context Fitness Assessment
|
|
79
122
|
|
|
80
123
|
Does the code fit this specific project?
|
|
@@ -305,6 +305,73 @@ function formatDate(date: Date): string { ... }
|
|
|
305
305
|
function formatPercentage(value: number): string { ... }
|
|
306
306
|
```
|
|
307
307
|
|
|
308
|
+
## Same Implementation with Different Names (DRY Violation)
|
|
309
|
+
|
|
310
|
+
AI tends to define the same logic under multiple function names.
|
|
311
|
+
|
|
312
|
+
| Pattern | Example | Verdict |
|
|
313
|
+
|---------|---------|---------|
|
|
314
|
+
| Same implementation with different names | `copyFacets()` and `placeFacetFiles()` doing the same thing | REJECT |
|
|
315
|
+
| Same parameter signature and body | Two functions taking the same params and doing the same work | REJECT |
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// REJECT - Same implementation exists under different names
|
|
319
|
+
function copyFiles(src: string, dest: string): void {
|
|
320
|
+
for (const f of readdirSync(src)) {
|
|
321
|
+
copyFileSync(join(src, f), join(dest, f));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function placeFiles(src: string, dest: string): void {
|
|
325
|
+
for (const f of readdirSync(src)) {
|
|
326
|
+
copyFileSync(join(src, f), join(dest, f));
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// OK - Consolidate into a single function
|
|
331
|
+
function copyFiles(src: string, dest: string): void {
|
|
332
|
+
for (const f of readdirSync(src)) {
|
|
333
|
+
copyFileSync(join(src, f), join(dest, f));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Verification approach:
|
|
339
|
+
1. Check if newly added functions have bodies identical or nearly identical to existing functions
|
|
340
|
+
2. Compare functions within the same file and within the same module
|
|
341
|
+
3. If duplication is found, consolidate into one and unify call sites
|
|
342
|
+
|
|
343
|
+
## Dangerous Stateful Regex Patterns
|
|
344
|
+
|
|
345
|
+
Regular expressions with the `/g` flag are stateful (they retain `lastIndex`). Defining them at module scope and mixing `test()` and `replace()` causes unexpected results.
|
|
346
|
+
|
|
347
|
+
| Pattern | Example | Verdict |
|
|
348
|
+
|---------|---------|---------|
|
|
349
|
+
| Module-scope `/g` regex used with `test()` | `const RE = /x/g; if (RE.test(s)) ...` | REJECT |
|
|
350
|
+
| `/g` regex shared between `test()` and `replace()` | `RE.test(s)` followed by `s.replace(RE, ...)` | REJECT |
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
// REJECT - Module-scope /g regex used with test()
|
|
354
|
+
const PATTERN = /\{\{facet:(\w+)\}\}/g;
|
|
355
|
+
function hasFacetRef(text: string): boolean {
|
|
356
|
+
return PATTERN.test(text); // lastIndex advances, next call returns different result
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// OK - Don't use /g for test(), or create new RegExp inside function
|
|
360
|
+
const PATTERN_CHECK = /\{\{facet:(\w+)\}\}/; // no /g
|
|
361
|
+
const PATTERN_REPLACE = /\{\{facet:(\w+)\}\}/g; // /g for replace
|
|
362
|
+
function hasFacetRef(text: string): boolean {
|
|
363
|
+
return PATTERN_CHECK.test(text);
|
|
364
|
+
}
|
|
365
|
+
function replaceFacetRefs(text: string): string {
|
|
366
|
+
return text.replace(PATTERN_REPLACE, ...);
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Verification approach:
|
|
371
|
+
1. Check if module-scope regexes have the `/g` flag
|
|
372
|
+
2. Check if `/g` regexes are used with `test()`
|
|
373
|
+
3. Check if the same regex is used with both `test()` and `replace()`
|
|
374
|
+
|
|
308
375
|
## Prohibited
|
|
309
376
|
|
|
310
377
|
- **Fallbacks are prohibited by default** - Do not write fallbacks using `?? 'unknown'`, `|| 'default'`, or swallowing via `try-catch`. Propagate errors upward. If absolutely necessary, add a comment explaining why
|