Skip to content

fix: restore typed emit() on ClassifierSdk; update smoke test comments#151

Merged
corpo-iwillspeak merged 7 commits into
mainfrom
feature/no-explicit-auth-scopes
Apr 10, 2026
Merged

fix: restore typed emit() on ClassifierSdk; update smoke test comments#151
corpo-iwillspeak merged 7 commits into
mainfrom
feature/no-explicit-auth-scopes

Conversation

@corpo-iwillspeak

@corpo-iwillspeak corpo-iwillspeak commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Switching ClassifierSdk from TypedEventEmitter<ClassifierEvents> to plain EventEmitter left emit() untyped (emit(string | symbol, ...any[])), while on/once/off already had typed overrides. Smoke test comments still hardcoded localhost:50051 after grpcAddress was made configurable via VITE_ATHENA_GRPC_ADDRESS.

Changes

  • src/index.ts — adds a typed emit override matching the existing on/once/off pattern, restoring full public API type-safety without reintroducing the TypedEventEmitter cast that broke the release build:
public override emit<U extends keyof ClassifierEvents>(
  event: U,
  ...args: Parameters<ClassifierEvents[U]>
): boolean {
  return super.emit(event, ...args);
}
  • __tests__/functional/main.functional.test.ts — replaces hardcoded localhost:50051 references in smoke test setup comments with accurate guidance: address comes from VITE_ATHENA_GRPC_ADDRESS, falling back to the SDK default.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the test suite to stop requesting explicit OAuth scope values, switching functional tests to pass an audience parsed via parseAudience, and extends functional tests to configure the SDK’s gRPC endpoint via grpcAddress.

Changes:

  • Remove scope from unit and functional test authentication configurations; update the auth manager unit test mock expectation accordingly.
  • Update functional tests to set audience: parseAudience(process.env.VITE_ATHENA_AUDIENCE) and pass grpcAddress from VITE_ATHENA_GRPC_ADDRESS.
  • Fix a functional test assertion to correctly verify response.classifications is an array.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/module-import.test.ts Removes scope from the SDK instantiation used for import/creation verification.
tests/unit/main.test.ts Removes scope from several ClassifierSdk constructor tests.
tests/unit/authenticationManager.test.ts Removes scope from options and updates the clientCredentialsGrant expectation to match the no-scope call shape.
tests/functional/main.functional.test.ts Switches functional tests to audience via parseAudience, adds grpcAddress, and fixes an assertion on classifications.
tests/functional/e2e.functional.test.ts Removes scope from E2E test authentication config (audience remains).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread __tests__/functional/main.functional.test.ts Outdated
Comment thread __tests__/functional/main.functional.test.ts Outdated
snus-kin
snus-kin previously approved these changes Apr 7, 2026
@snus-kin

snus-kin commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Dunno what yo udid the break the build but it seems unrelated to the changes in this PR.

@corpo-iwillspeak

Copy link
Copy Markdown
Contributor Author

@copilot apply changes based on the comments in this thread

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

Updated all three smoke test comments in main.functional.test.ts to replace the hardcoded localhost:50051 reference with a description that the gRPC address comes from VITE_ATHENA_GRPC_ADDRESS, falling back to the SDK default if not set. Commit: 266838c

Copilot AI changed the title test: stop requesting explicit auth scopes test: update smoke test comments to reflect dynamic gRPC address Apr 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts
Comment thread samples/e2e-testcases/index.ts
Comment thread __tests__/functional/main.functional.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
auto-merge was automatically disabled April 8, 2026 11:44

Head branch was pushed to by a user without write access

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • node-precompiled-binaries.grpc.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/athena-nodejs-client/athena-nodejs-client/node_modules/.bin/node-pre-gyp install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title test: update smoke test comments to reflect dynamic gRPC address fix: restore typed emit() on ClassifierSdk; update smoke test comments Apr 8, 2026
@corpo-iwillspeak corpo-iwillspeak enabled auto-merge (squash) April 8, 2026 12:26
@corpo-iwillspeak corpo-iwillspeak merged commit c4dde55 into main Apr 10, 2026
10 checks passed
@corpo-iwillspeak corpo-iwillspeak deleted the feature/no-explicit-auth-scopes branch April 10, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants