Skip to content

Commit 18063e5

Browse files
author
alpsla
committed
rex(#3): Create Live Test Fixture - TypeScript
1 parent d8b8fed commit 18063e5

3 files changed

Lines changed: 245 additions & 4 deletions

File tree

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
/**
2+
* Live Test TypeScript File for Tier 2 Native Fixer Validation
3+
*
4+
* This file contains INTENTIONAL issues that should be fixed by various tiers:
5+
*
6+
* Tier 1 (ESLint --fix):
7+
* - semi: Missing semicolons
8+
* - quotes: Inconsistent quote style (single vs double)
9+
* - comma-dangle: Missing trailing commas
10+
* - indent: Inconsistent indentation
11+
* - no-trailing-spaces: Trailing whitespace
12+
*
13+
* Tier 3 (AI Required):
14+
* - @typescript-eslint/no-explicit-any: Requires semantic understanding to replace
15+
* - @typescript-eslint/no-unused-vars: Requires understanding of code intent
16+
*
17+
* DO NOT manually fix these issues - they are test fixtures.
18+
*/
19+
20+
// Tier 1: Missing semicolons (semi rule)
21+
const APP_NAME = "TestApp"
22+
const VERSION = "1.0.0"
23+
const DEBUG_MODE = true
24+
25+
// Tier 1: Inconsistent quotes (quotes rule) - should be single quotes
26+
const MESSAGE = "Hello World"
27+
const ERROR_MSG = "Something went wrong"
28+
const SUCCESS = "Operation completed"
29+
30+
// Tier 3: @typescript-eslint/no-explicit-any - requires AI to determine proper type
31+
interface UserData {
32+
id: number
33+
name: string
34+
metadata: any // @typescript-eslint/no-explicit-any
35+
settings: any // @typescript-eslint/no-explicit-any
36+
extraData: any // @typescript-eslint/no-explicit-any
37+
}
38+
39+
// Tier 3: Function with any parameters - needs AI to infer types
40+
function processData(input: any, options: any): any {
41+
if (input === null) {
42+
return null
43+
}
44+
const result: any = {
45+
processed: true,
46+
data: input,
47+
opts: options
48+
}
49+
return result
50+
}
51+
52+
// Tier 1: Missing semicolons and trailing commas
53+
const config = {
54+
host: "localhost",
55+
port: 3000,
56+
secure: false,
57+
timeout: 5000
58+
}
59+
60+
// Tier 3: Array with any type - needs AI to determine element type
61+
function filterItems(items: any[]): any[] {
62+
return items.filter((item: any) => item !== null)
63+
}
64+
65+
// Tier 1: Mixed quote styles
66+
const ENDPOINTS = {
67+
users: '/api/users',
68+
posts: "/api/posts",
69+
comments: '/api/comments',
70+
auth: "/api/auth"
71+
}
72+
73+
// Tier 3: Generic function with any - AI needs to add proper generic constraint
74+
function transformArray<T>(arr: T[], transformer: any): any[] {
75+
return arr.map((item: any) => transformer(item))
76+
}
77+
78+
// Tier 1: Missing semicolons in class
79+
class DataProcessor {
80+
private data: any // Tier 3: no-explicit-any
81+
private options: any // Tier 3: no-explicit-any
82+
83+
constructor(data: any, options: any) {
84+
this.data = data
85+
this.options = options
86+
}
87+
88+
// Tier 3: Method returning any
89+
process(): any {
90+
if (this.data === null) {
91+
return null
92+
}
93+
return {
94+
result: this.data,
95+
processed: true
96+
}
97+
}
98+
99+
// Tier 1: Missing semicolons
100+
getOptions(): any {
101+
return this.options
102+
}
103+
104+
// Tier 3: Callback with any parameter
105+
transform(callback: (item: any) => any): any {
106+
return callback(this.data)
107+
}
108+
}
109+
110+
// Tier 1: Inconsistent formatting - missing trailing comma
111+
const SETTINGS = {
112+
theme: "dark",
113+
language: "en",
114+
notifications: true
115+
}
116+
117+
// Tier 3: Handler with any event type
118+
function handleEvent(event: any): void {
119+
console.log("Event received:", event.type)
120+
if (event.data !== undefined) {
121+
processData(event.data, {})
122+
}
123+
}
124+
125+
// Tier 3: Promise returning any
126+
async function fetchData(url: string): Promise<any> {
127+
// Simulated fetch
128+
return { url, data: null }
129+
}
130+
131+
// Tier 1: Mixed semicolons and quote styles
132+
const API_CONFIG = {
133+
baseUrl: "https://api.example.com",
134+
version: 'v1',
135+
headers: {
136+
'Content-Type': "application/json",
137+
"Accept": 'application/json'
138+
}
139+
}
140+
141+
// Tier 3: Object with any values - needs AI analysis
142+
interface ResponseWrapper {
143+
status: number
144+
data: any // Tier 3: no-explicit-any
145+
error: any // Tier 3: no-explicit-any
146+
meta: any // Tier 3: no-explicit-any
147+
}
148+
149+
// Tier 3: Function accepting any callback
150+
function registerHandler(name: string, handler: any): void {
151+
console.log(`Handler ${name} registered`)
152+
if (typeof handler === 'function') {
153+
handler()
154+
}
155+
}
156+
157+
// Tier 1: Missing semicolons in arrow functions
158+
const add = (a: number, b: number): number => a + b
159+
const multiply = (a: number, b: number): number => a * b
160+
const divide = (a: number, b: number): number => a / b
161+
162+
// Tier 3: Reducer with any state
163+
function createReducer(initialState: any) {
164+
return (state: any, action: any): any => {
165+
switch (action.type) {
166+
case 'SET':
167+
return action.payload
168+
case 'RESET':
169+
return initialState
170+
default:
171+
return state
172+
}
173+
}
174+
}
175+
176+
// Tier 1: Object with missing trailing commas
177+
const FEATURE_FLAGS = {
178+
enableCache: true,
179+
enableLogging: DEBUG_MODE,
180+
enableMetrics: false,
181+
maxRetries: 3
182+
}
183+
184+
// Tier 3: Event emitter with any listener
185+
class EventEmitter {
186+
private listeners: Map<string, any[]> = new Map()
187+
188+
on(event: string, listener: any): void {
189+
const existing = this.listeners.get(event) || []
190+
existing.push(listener)
191+
this.listeners.set(event, existing)
192+
}
193+
194+
emit(event: string, data: any): void {
195+
const handlers = this.listeners.get(event)
196+
if (handlers) {
197+
handlers.forEach((handler: any) => handler(data))
198+
}
199+
}
200+
}
201+
202+
// Tier 1: Inconsistent string quotes in array
203+
const ALLOWED_METHODS = ['GET', "POST", 'PUT', "DELETE", 'PATCH']
204+
205+
// Tier 3: Factory function returning any
206+
function createFactory(type: string): any {
207+
switch (type) {
208+
case 'processor':
209+
return new DataProcessor(null, {})
210+
case 'emitter':
211+
return new EventEmitter()
212+
default:
213+
return null
214+
}
215+
}
216+
217+
// Export for testing
218+
export {
219+
APP_NAME,
220+
VERSION,
221+
DEBUG_MODE,
222+
processData,
223+
filterItems,
224+
transformArray,
225+
DataProcessor,
226+
handleEvent,
227+
fetchData,
228+
registerHandler,
229+
createReducer,
230+
EventEmitter,
231+
createFactory
232+
}

rex-progress.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,3 +583,12 @@ Commit: [main 25beddf1] rex(#1): Verify Environment Configuration
583583
create mode 100644 packages/agents/src/fix-agent/__tests__/live-env-check.test.ts
584584
25beddf1
585585

586+
587+
=== Task #2 (2026-01-19 10:38:22) ===
588+
Title: Create Live Test Fixture - Python
589+
Status: COMPLETE
590+
Commit: [main d8b8fed2] rex(#2): Create Live Test Fixture - Python
591+
3 files changed, 155 insertions(+), 4 deletions(-)
592+
create mode 100644 packages/agents/src/fix-agent/__tests__/fixtures/live-test-python.py
593+
d8b8fed2
594+

rex-tasks.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"source": "docs/rex-session-106-live-integration.md",
33
"createdAt": "2026-01-19T18:00:00Z",
44
"maxIterations": 30,
5-
"currentIteration": 2,
5+
"currentIteration": 3,
66
"status": "ready",
77
"validation": {
88
"type": "live-integration",
@@ -48,11 +48,11 @@
4848
"packages/agents/src/fix-agent/__tests__/fixtures/live-test-python.py"
4949
],
5050
"priority": "high",
51-
"passes": false,
51+
"passes": true,
5252
"attempts": 0,
5353
"lastError": null,
54-
"completedAt": null,
55-
"commitHash": null
54+
"completedAt": "2026-01-19T15:38:22Z",
55+
"commitHash": "[main d8b8fed2] rex(#2): Create Live Test Fixture - Python\n 3 files changed, 155 insertions(+), 4 deletions(-)\n create mode 100644 packages/agents/src/fix-agent/__tests__/fixtures/live-test-python.py\nd8b8fed2"
5656
},
5757
{
5858
"id": 3,

0 commit comments

Comments
 (0)