Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(site): updateuseAgentLogs to make it more testable and add more tests#19126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Parkreiner merged 62 commits intomainfrommes/logs-flake
Sep 17, 2025

Conversation

Parkreiner
Copy link
Member

@ParkreinerParkreiner commentedAug 2, 2025
edited
Loading

Take 2
Closescoder/internal#644

Changes made

  • Updated howuseAgentLogs was defined to make it easier to inject specific data dependencies (basically making the hook more unit-testable)
  • Simplified the hook API to limit the amount of scope of data it needs to work
  • Added more test cases, and re-enabled the one test case we had previously disabled
  • Extracted our mock websocket code into a separate file, and added more methods to it
  • Updated all runtime code to accommodate new changes

@ParkreinerParkreiner self-assigned thisAug 2, 2025
@@ -1,60 +1,147 @@
import{renderHook,waitFor}from"@testing-library/react";
Copy link
MemberAuthor

@ParkreinerParkreinerAug 2, 2025
edited
Loading

Choose a reason for hiding this comment

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

Enough changed with the test file that it honestly might not even be worth looking at the old version of the code

@ParkreinerParkreiner changed the titlefix: updateuseAgentLogs to make it more testable and add more testsfix(site): updateuseAgentLogs to make it more testable and add more testsAug 4, 2025
publishError:(event:Event)=>void;
publishClose:(event:CloseEvent)=>void;
publishOpen:(event:Event)=>void;
readonlyisConnectionOpen:boolean;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Setup is 99% the same from the old file, just with the addition of this getter method

Copy link
Member

@aslilacaslilac left a comment

Choose a reason for hiding this comment

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

I think this mock WebSocket implementation needs some tests of its own, and is probably worth its own PR as well.@jaaydenh has been working on a similar refactor of some other tests that I think uses a copy of this WebSocket mock. It'd be nice to sync on that so that we don't duplicate effort, andthen we can get everyones tests reviewed. 😄

@ParkreinerParkreiner removed the staleThis issue is like stale bread. labelSep 10, 2025
Comment on lines +24 to +40
exportconstDestructive:Story={
args:{
variant:"destructive",
},
};

exportconstInfo:Story={
args:{
variant:"info",
},
};

exportconstGreen:Story={
args:{
variant:"green",
},
};
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Some of our styling for theBadge component was jacked, and we just never caught it because we never made stories for the variants

Comment on lines 36 to 39
<spanclassName="ml-auto">
<spanclassName="sr-only">{notAvailableText}</span>
<CircleHelpIconclassName="size-icon-sm"style={{ color}}/>
</span>
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Biome kept hitting me with a linter violation that this fragment was useless, even though it's needed for the MUI types. The fix script also refused to run. Figured splitting things up like this was a decent compromise


<CircleHelpIconclassName="ml-auto size-icon-sm"style={{ color}}/>
</>
<spanclassName="ml-auto">
Copy link
Member

Choose a reason for hiding this comment

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

why does it needmargin-left: auto?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I had it because the previous icon had it. Let me see if it's safe to remove

Copy link
MemberAuthor

@ParkreinerParkreinerSep 16, 2025
edited
Loading

Choose a reason for hiding this comment

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

Okay, it wasn't a drop-in replacement, but I updated the component and where it was used, and added an extra story. The margin values never should've been baked into the component, but now it's fully gone

The component itself is still a bit janky, but (1) this PR has already ballooned in scope from just trying to fix a simple flake, and (2) I'm legitimately running out of time to squeeze a bunch of stuff in before vacation. It's already midnight – I'm not done for today yet

I fully understand if you still have problems with the component, but what we have now should still be an improvement. We can take care of the rest of the problems in a separate PR

Comment on lines -62 to -63
width={14}
height={14}
Copy link
Member

Choose a reason for hiding this comment

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

why remove these?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

They're not removed – they got turned into thesize-3.5 class. This is a native HTML element – width andheight aren't special props, so we can afford to just turn them into normal Tailwind

Comment on lines 41 to 43
return()=>{
socket.close();
};
Copy link
Member

Choose a reason for hiding this comment

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

can we revert this? it's clearer that the longer form doesn't return anything meaningful, whereas the second version returns whateverclose() returns.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I prefer the changed version aesthetically (and the type signature for useEffect ensures that there won't ever be any problems), but I just reverted it

aslilac reacted with heart emoji
@ParkreinerParkreiner merged commit759746c intomainSep 17, 2025
32 checks passed
@ParkreinerParkreiner deleted the mes/logs-flake branchSeptember 17, 2025 23:58
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 17, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@aslilacaslilacaslilac approved these changes

Assignees

@ParkreinerParkreiner

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

flake: useAgentLogs

2 participants

@Parkreiner@aslilac

[8]ページ先頭

©2009-2025 Movatter.jp