Skip to content

Conversation

@VincentMolinie
Copy link
Member

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

@VincentMolinie
Copy link
Member Author

CU-86c6ur5gj

@qltysh
Copy link

qltysh bot commented Dec 3, 2025

2 new issues

Tool Category Rule Count
qlty Structure Function with many returns (count = 4): setupSuperagentMock 1
qlty Structure Function with many parameters (count = 4): handleSuperagentRequest 1

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@qltysh
Copy link

qltysh bot commented Dec 3, 2025

Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@VincentMolinie VincentMolinie changed the base branch from main to feat/forest-mcp/main December 3, 2025 10:08
Comment on lines +29 to +31
/**
* Setup superagent mocking to intercept HTTP requests made by forestadmin-client
*/
Copy link
Member

Choose a reason for hiding this comment

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

why do you want to mock inside the forestadmin-client ? just mock the forestadmin-client itself, we don't need to test its inside behaviour

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to make sure the call was properly made

Copy link
Member Author

Choose a reason for hiding this comment

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

By doing so I'm making sure that even when upgrading the forestadmin-client, nothing is broken 😉

Copy link
Member

Choose a reason for hiding this comment

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

that seems a bit overengineered for a small improvement... we don't need to test the forestadmin-client behavior in these tests, that's a completely different package

Copy link
Member

Choose a reason for hiding this comment

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

mocking a dependency of a dependency to ensure the first one is doing what it should do isn't a very good pattern, I think

Copy link
Member Author

Choose a reason for hiding this comment

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

An integration test must test as much as possible everything, without mock

Copy link
Member

Choose a reason for hiding this comment

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

yeah, but testing an other package doesn't make sense. If we want to actually test everything, we'll do end-to-end tests that mount a real forest agent and look at its responses.
Integration tests should test the whole package, but not its dependencies

Comment on lines +17 to +22
// Handle ESM/CJS interop: the module may be double-wrapped with default exports
const createForestAdminClient =
typeof forestAdminClientModule === 'function'
? forestAdminClientModule
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
((forestAdminClientModule as any).default as typeof forestAdminClientModule);
Copy link
Member

Choose a reason for hiding this comment

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

i'm pretty sure we don't need that, you can import '@forestadmin/forestadmin-client' directly

Copy link
Member Author

Choose a reason for hiding this comment

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

No I do need it 😅. try without it, it was my first attempt but because of one of the πackages we use (mcp/sdk if I remember well) all the packages are imported as ESM. It's not the same standard

Copy link
Member

Choose a reason for hiding this comment

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

isn't it a tsconfig issue ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No it is not as far as I know 😉

);

const token = jsonwebtoken.sign(
{ ...user, serverToken: forestServerAccessToken },
Copy link
Member

Choose a reason for hiding this comment

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

why repeating the userInfo that already are in the serverToken ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No user is a call to the forest server 😉

Copy link
Member

Choose a reason for hiding this comment

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

I mean you can decode the token payload and get the userData from there. You know it is valid because that's the server that issued the token directly

@VincentMolinie VincentMolinie merged commit ad11a6d into feat/forest-mcp/main Dec 8, 2025
40 of 59 checks passed
@VincentMolinie VincentMolinie deleted the feat/forest-mcp/token branch December 8, 2025 15:45
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.

3 participants