Skip to content

Commit 10e16c6

Browse files
fix: correct typo in property name resopnseTimeMs → responseTimeMsfix: correct typo in property name resopnseTimeMs → responseTimeMs (#2954)
# Fix: Correct typo in property name `resopnseTimeMs` → `responseTimeMs` ## Summary of Changes This PR fixes a widespread typo in the codebase where the property name `resopnseTimeMs` (misspelled) was used instead of the correct `responseTimeMs` throughout the request handling system. ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue) - [x] Code quality improvement ## The Problem The property `resopnseTimeMs` in the `GraphQLResponseData` interface and its implementations contained a typo - "resopnse" instead of "response". This typo was propagated across: - **Type definition**: `GraphQLResponseData` interface in `types.ts` - **Implementation files**: 4 request handler files (`http.ts`, `action-cable.ts`, `utils.ts`) and 1 service file (`gql.service.ts`) - **Test files**: 3 test specification files with 25 test expectations - **Total occurrences**: 30 instances across 9 files While this typo didn't cause functional issues (the property worked as intended), it affects: - Code readability and professionalism - Maintainability - Potential confusion for contributors ## The Solution The fix systematically renames all occurrences of `resopnseTimeMs` to the correctly spelled `responseTimeMs`: ### Files Modified **Core Package (`altair-core`):** - `src/request/types.ts` - Type definition - `src/request/utils.ts` - Response observer implementation - `src/request/handlers/http.ts` - HTTP request handler - `src/request/handlers/action-cable.ts` - Action Cable handler - `src/request/adapters.spec.ts` - Adapter tests (4 occurrences) - `src/request/handlers/http.spec.ts` - HTTP handler tests (16 occurrences) **App Package (`altair-app`):** - `src/app/modules/altair/services/gql/gql.service.ts` - GQL service - `src/app/modules/altair/services/gql/gql.service.spec.ts` - GQL service tests (5 occurrences) ### Changes Summary - 8 files changed - 30 insertions(+) - 30 deletions(-) ## Testing All existing tests have been updated to use the corrected property name. The fix is purely a rename operation with no logic changes, so: - ✅ All existing test cases continue to validate the same functionality - ✅ Type checking passes with the updated interface - ✅ No breaking changes to the API (internal property only) ### Verification Commands ```bash # Verify no instances of the typo remain grep -r "resopnseTimeMs" packages/altair-core packages/altair-app --include="*.ts" # Should return 0 results # Verify correct spelling is used grep -r "responseTimeMs" packages/altair-core packages/altair-app --include="*.ts" # Should return 30 results # Run tests cd packages/altair-core && pnpm test cd packages/altair-app && pnpm test ``` ## Additional Notes This is a simple typo fix that improves code quality without any functional changes. The property is internal to the response handling system and not exposed in the public API, so there are no breaking changes for users of the library.Fixed widespread typo where 'resopnseTimeMs' was misspelled throughout the codebase. The correct spelling 'responseTimeMs' is now used consistently across all type definitions, implementations, and tests. Changes: - Updated GraphQLResponseData interface in types.ts - Fixed property assignments in request handlers (http, action-cable, utils) - Updated gql.service.ts property access - Corrected all test expectations (30 total occurrences across 9 files) This is a code quality improvement with no functional changes. ### Fixes # <!-- Mention the issues this PR addresses --> ### Checks - [ ] Ran `yarn test-build` - [ ] Updated relevant documentations - [ ] Updated matching config options in altair-static ### Changes proposed in this pull request: <!-- Describe the changes being introduced in this PR --> ## Summary by Sourcery Correct the misspelled response time property across request handling and related services to use a consistently named responseTimeMs field. Bug Fixes: - Fix inconsistent response timing field name by renaming resopnseTimeMs to responseTimeMs in request handlers and related services. Enhancements: - Improve code readability and maintainability by standardizing the GraphQL response timing property name in core types and utilities. Tests: - Update HTTP handler, adapter, and GqlService tests to assert the corrected responseTimeMs property name. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Corrected a property name in GraphQL response data returned by request handlers and adapters, ensuring consistent and accurate response metadata across all request types. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Samuel <samuelimolo4real@gmail.com>
1 parent 115a8a5 commit 10e16c6

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

packages/altair-app/src/app/modules/altair/services/gql/gql.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ describe('GqlService', () => {
152152
url: 'http://test.com',
153153
requestStartTimestamp: 1,
154154
requestEndTimestamp: 2,
155-
resopnseTimeMs: 1.5,
155+
responseTimeMs: 1,
156156
});
157157
}
158158
default:
@@ -167,7 +167,7 @@ describe('GqlService', () => {
167167
url: 'http://test.com',
168168
requestStartTimestamp: 1,
169169
requestEndTimestamp: 2,
170-
resopnseTimeMs: 1.5,
170+
responseTimeMs: 1,
171171
});
172172
}
173173
};
@@ -216,7 +216,7 @@ describe('GqlService', () => {
216216
url: 'http://test.com',
217217
requestStartTimestamp: 1,
218218
requestEndTimestamp: 2,
219-
resopnseTimeMs: 1.5,
219+
responseTimeMs: 1,
220220
});
221221
}
222222
default:
@@ -231,7 +231,7 @@ describe('GqlService', () => {
231231
url: 'http://test.com',
232232
requestStartTimestamp: 1,
233233
requestEndTimestamp: 2,
234-
resopnseTimeMs: 1.5,
234+
responseTimeMs: 1,
235235
});
236236
}
237237
});
@@ -283,7 +283,7 @@ describe('GqlService', () => {
283283
url: 'http://test.com',
284284
requestStartTimestamp: 1,
285285
requestEndTimestamp: 2,
286-
resopnseTimeMs: 1.5,
286+
responseTimeMs: 1,
287287
});
288288
}
289289
};

packages/altair-app/src/app/modules/altair/services/gql/gql.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ export class GqlService {
690690
url: response.url,
691691
requestStartTime: response.requestStartTimestamp,
692692
requestEndTime: response.requestEndTimestamp,
693-
responseTime: response.resopnseTimeMs,
693+
responseTime: response.responseTimeMs,
694694
};
695695
})
696696
);

packages/altair-core/src/request/adapters.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('SubscriptionProviderRequestHandlerAdapter', () => {
5656
ok: true,
5757
requestEndTimestamp: expect.any(Number),
5858
requestStartTimestamp: expect.any(Number),
59-
resopnseTimeMs: expect.any(Number),
59+
responseTimeMs: expect.any(Number),
6060
status: 200,
6161
statusText: 'OK',
6262
url: 'http://localhost:3000/graphql',
@@ -100,7 +100,7 @@ describe('SubscriptionProviderRequestHandlerAdapter', () => {
100100
ok: true,
101101
requestEndTimestamp: expect.any(Number),
102102
requestStartTimestamp: expect.any(Number),
103-
resopnseTimeMs: expect.any(Number),
103+
responseTimeMs: expect.any(Number),
104104
status: 200,
105105
statusText: 'OK',
106106
url: 'http://localhost:3000/graphql',
@@ -111,7 +111,7 @@ describe('SubscriptionProviderRequestHandlerAdapter', () => {
111111
ok: true,
112112
requestEndTimestamp: expect.any(Number),
113113
requestStartTimestamp: expect.any(Number),
114-
resopnseTimeMs: expect.any(Number),
114+
responseTimeMs: expect.any(Number),
115115
status: 200,
116116
statusText: 'OK',
117117
url: 'http://localhost:3000/graphql',
@@ -158,7 +158,7 @@ describe('SubscriptionProviderRequestHandlerAdapter', () => {
158158
ok: true,
159159
requestEndTimestamp: expect.any(Number),
160160
requestStartTimestamp: expect.any(Number),
161-
resopnseTimeMs: expect.any(Number),
161+
responseTimeMs: expect.any(Number),
162162
status: 200,
163163
statusText: 'OK',
164164
url: 'http://localhost:3000/graphql',

packages/altair-core/src/request/handlers/action-cable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ActionCableRequestHandler implements GraphQLRequestHandler {
3838
url: request.url,
3939
requestStartTimestamp,
4040
requestEndTimestamp,
41-
resopnseTimeMs: requestEndTimestamp - requestStartTimestamp,
41+
responseTimeMs: requestEndTimestamp - requestStartTimestamp,
4242
});
4343
}
4444

packages/altair-core/src/request/handlers/http.spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('HTTP handler', () => {
8181
url: 'http://localhost:3000/graphql',
8282
requestStartTimestamp: expect.any(Number),
8383
requestEndTimestamp: expect.any(Number),
84-
resopnseTimeMs: expect.any(Number),
84+
responseTimeMs: expect.any(Number),
8585
}),
8686
]);
8787
});
@@ -129,7 +129,7 @@ describe('HTTP handler', () => {
129129
url: 'http://localhost:3000/graphql?query=query+%7B+hello+%7D&variables=%7B%7D&operationName=hello',
130130
requestStartTimestamp: expect.any(Number),
131131
requestEndTimestamp: expect.any(Number),
132-
resopnseTimeMs: expect.any(Number),
132+
responseTimeMs: expect.any(Number),
133133
}),
134134
]);
135135
});
@@ -193,7 +193,7 @@ describe('HTTP handler', () => {
193193
url: 'http://localhost:3000/graphql',
194194
requestStartTimestamp: expect.any(Number),
195195
requestEndTimestamp: expect.any(Number),
196-
resopnseTimeMs: expect.any(Number),
196+
responseTimeMs: expect.any(Number),
197197
}),
198198
]);
199199
});
@@ -255,7 +255,7 @@ describe('HTTP handler', () => {
255255
url: 'http://localhost:3000/graphql',
256256
requestStartTimestamp: expect.any(Number),
257257
requestEndTimestamp: expect.any(Number),
258-
resopnseTimeMs: expect.any(Number),
258+
responseTimeMs: expect.any(Number),
259259
}),
260260
]);
261261
});
@@ -290,7 +290,7 @@ describe('HTTP handler', () => {
290290
url: 'http://localhost:3000/graphql',
291291
requestStartTimestamp: expect.any(Number),
292292
requestEndTimestamp: expect.any(Number),
293-
resopnseTimeMs: expect.any(Number),
293+
responseTimeMs: expect.any(Number),
294294
}),
295295
]);
296296
});
@@ -340,7 +340,7 @@ describe('HTTP handler', () => {
340340
url: 'http://localhost:3000/graphql?query=query+%7B+hello+%7D&variables=%7B%7D&operationName=hello',
341341
requestStartTimestamp: expect.any(Number),
342342
requestEndTimestamp: expect.any(Number),
343-
resopnseTimeMs: expect.any(Number),
343+
responseTimeMs: expect.any(Number),
344344
}),
345345
]);
346346
});
@@ -459,7 +459,7 @@ describe('HTTP handler', () => {
459459
url: 'http://localhost:3000/simple-stream',
460460
requestStartTimestamp: expect.any(Number),
461461
requestEndTimestamp: expect.any(Number),
462-
resopnseTimeMs: expect.any(Number),
462+
responseTimeMs: expect.any(Number),
463463
}),
464464
expect.objectContaining({
465465
ok: true,
@@ -469,7 +469,7 @@ describe('HTTP handler', () => {
469469
url: 'http://localhost:3000/simple-stream',
470470
requestStartTimestamp: expect.any(Number),
471471
requestEndTimestamp: expect.any(Number),
472-
resopnseTimeMs: expect.any(Number),
472+
responseTimeMs: expect.any(Number),
473473
}),
474474
expect.objectContaining({
475475
ok: true,
@@ -479,7 +479,7 @@ describe('HTTP handler', () => {
479479
url: 'http://localhost:3000/simple-stream',
480480
requestStartTimestamp: expect.any(Number),
481481
requestEndTimestamp: expect.any(Number),
482-
resopnseTimeMs: expect.any(Number),
482+
responseTimeMs: expect.any(Number),
483483
}),
484484
]);
485485
});
@@ -607,7 +607,7 @@ describe('HTTP handler', () => {
607607
url: 'http://localhost:3000/multipart-stream',
608608
requestStartTimestamp: expect.any(Number),
609609
requestEndTimestamp: expect.any(Number),
610-
resopnseTimeMs: expect.any(Number),
610+
responseTimeMs: expect.any(Number),
611611
}),
612612
expect.objectContaining({
613613
ok: true,
@@ -617,7 +617,7 @@ describe('HTTP handler', () => {
617617
url: 'http://localhost:3000/multipart-stream',
618618
requestStartTimestamp: expect.any(Number),
619619
requestEndTimestamp: expect.any(Number),
620-
resopnseTimeMs: expect.any(Number),
620+
responseTimeMs: expect.any(Number),
621621
}),
622622
expect.objectContaining({
623623
ok: true,
@@ -627,7 +627,7 @@ describe('HTTP handler', () => {
627627
url: 'http://localhost:3000/multipart-stream',
628628
requestStartTimestamp: expect.any(Number),
629629
requestEndTimestamp: expect.any(Number),
630-
resopnseTimeMs: expect.any(Number),
630+
responseTimeMs: expect.any(Number),
631631
}),
632632
expect.objectContaining({
633633
ok: true,
@@ -637,7 +637,7 @@ describe('HTTP handler', () => {
637637
url: 'http://localhost:3000/multipart-stream',
638638
requestStartTimestamp: expect.any(Number),
639639
requestEndTimestamp: expect.any(Number),
640-
resopnseTimeMs: expect.any(Number),
640+
responseTimeMs: expect.any(Number),
641641
}),
642642
expect.objectContaining({
643643
ok: true,
@@ -647,7 +647,7 @@ describe('HTTP handler', () => {
647647
url: 'http://localhost:3000/multipart-stream',
648648
requestStartTimestamp: expect.any(Number),
649649
requestEndTimestamp: expect.any(Number),
650-
resopnseTimeMs: expect.any(Number),
650+
responseTimeMs: expect.any(Number),
651651
}),
652652
]);
653653
});
@@ -720,7 +720,7 @@ describe('HTTP handler', () => {
720720
url: 'http://localhost:3000/multipart-stream-2',
721721
requestStartTimestamp: expect.any(Number),
722722
requestEndTimestamp: expect.any(Number),
723-
resopnseTimeMs: expect.any(Number),
723+
responseTimeMs: expect.any(Number),
724724
}),
725725
expect.objectContaining({
726726
ok: true,
@@ -730,7 +730,7 @@ describe('HTTP handler', () => {
730730
url: 'http://localhost:3000/multipart-stream-2',
731731
requestStartTimestamp: expect.any(Number),
732732
requestEndTimestamp: expect.any(Number),
733-
resopnseTimeMs: expect.any(Number),
733+
responseTimeMs: expect.any(Number),
734734
}),
735735
]);
736736
});

packages/altair-core/src/request/handlers/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class HttpRequestHandler implements GraphQLRequestHandler {
147147
requestStartTimestamp: requestStartTime,
148148
requestEndTimestamp: requestEndTime,
149149
// this is redundant data
150-
resopnseTimeMs: requestEndTime - requestStartTime,
150+
responseTimeMs: requestEndTime - requestStartTime,
151151
};
152152

153153
// Send the data to the observer

packages/altair-core/src/request/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface GraphQLResponseData {
4040
/**
4141
* The time taken to get the response in milliseconds
4242
*/
43-
resopnseTimeMs: number;
43+
responseTimeMs: number;
4444
}
4545

4646
export interface GraphQLRequestHandler {

packages/altair-core/src/request/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const simpleResponseObserver = (
1919
url: url,
2020
requestStartTimestamp,
2121
requestEndTimestamp,
22-
resopnseTimeMs: requestEndTimestamp - requestStartTimestamp,
22+
responseTimeMs: requestEndTimestamp - requestStartTimestamp,
2323
});
2424
},
2525
error: (...args) => subscriber.error(...args),

0 commit comments

Comments
 (0)