feat(cli): enhance folder trust with configuration discovery and security warnings (#19492)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Gal Zahavi
2026-02-20 10:21:03 -08:00
committed by GitHub
parent d54702185b
commit d24f10b087
14 changed files with 994 additions and 49 deletions

View File

@@ -108,7 +108,27 @@ describe('<Scrollable />', () => {
throw new Error('capturedEntry is undefined');
}
// Initial state (starts at bottom because of auto-scroll logic)
// Initial state (starts at top by default)
expect(capturedEntry.getScrollState().scrollTop).toBe(0);
// Initial state with scrollToBottom={true}
unmount();
const { waitUntilReady: waitUntilReady2, unmount: unmount2 } =
renderWithProviders(
<Scrollable hasFocus={true} height={5} scrollToBottom={true}>
<Text>Line 1</Text>
<Text>Line 2</Text>
<Text>Line 3</Text>
<Text>Line 4</Text>
<Text>Line 5</Text>
<Text>Line 6</Text>
<Text>Line 7</Text>
<Text>Line 8</Text>
<Text>Line 9</Text>
<Text>Line 10</Text>
</Scrollable>,
);
await waitUntilReady2();
expect(capturedEntry.getScrollState().scrollTop).toBe(5);
// Call scrollBy multiple times (upwards) in the same tick
@@ -116,14 +136,14 @@ describe('<Scrollable />', () => {
capturedEntry!.scrollBy(-1);
capturedEntry!.scrollBy(-1);
});
// Should have moved up by 2
// Should have moved up by 2 (5 -> 3)
expect(capturedEntry.getScrollState().scrollTop).toBe(3);
await act(async () => {
capturedEntry!.scrollBy(-2);
});
expect(capturedEntry.getScrollState().scrollTop).toBe(1);
unmount();
unmount2();
});
describe('keypress handling', () => {

View File

@@ -54,8 +54,7 @@ export const Scrollable: React.FC<ScrollableProps> = ({
const childrenCountRef = useRef(0);
// This effect needs to run on every render to correctly measure the container
// and scroll to the bottom if new children are added. The if conditions
// prevent infinite loops.
// and scroll to the bottom if new children are added.
// eslint-disable-next-line react-hooks/exhaustive-deps
useLayoutEffect(() => {
if (!ref.current) {
@@ -64,7 +63,8 @@ export const Scrollable: React.FC<ScrollableProps> = ({
const innerHeight = Math.round(getInnerHeight(ref.current));
const scrollHeight = Math.round(getScrollHeight(ref.current));
const isAtBottom = scrollTop >= size.scrollHeight - size.innerHeight - 1;
const isAtBottom =
scrollHeight > innerHeight && scrollTop >= scrollHeight - innerHeight - 1;
if (
size.innerHeight !== innerHeight ||