ci: add typechecking, fail fast in CI, and patch typechecking errors (#63)

This commit is contained in:
Charles Packer
2025-11-04 11:50:07 -08:00
committed by GitHub
parent 42eb671bf4
commit cf73f3a11f
27 changed files with 183 additions and 69 deletions

View File

@@ -281,7 +281,9 @@ export function AdvancedDiffRenderer(
let newNo = h.newStart;
let lastRemovalNo: number | null = null;
for (let i = 0; i < h.lines.length; i++) {
const raw = h.lines[i].raw || "";
const line = h.lines[i];
if (!line) continue;
const raw = line.raw || "";
const ch = raw.charAt(0);
const body = raw.slice(1);
// Skip meta lines (e.g., "\ No newline at end of file"): do not display, do not advance counters,
@@ -291,7 +293,9 @@ export function AdvancedDiffRenderer(
// Helper to find next non-meta '+' index
const findNextPlus = (start: number): string | undefined => {
for (let j = start + 1; j < h.lines.length; j++) {
const r = h.lines[j].raw || "";
const nextLine = h.lines[j];
if (!nextLine) continue;
const r = nextLine.raw || "";
if (r.charAt(0) === "\\") continue; // skip meta
if (r.startsWith("+")) return r.slice(1);
break; // stop at first non-meta non-plus
@@ -301,7 +305,9 @@ export function AdvancedDiffRenderer(
// Helper to find previous non-meta '-' index
const findPrevMinus = (start: number): string | undefined => {
for (let k = start - 1; k >= 0; k--) {
const r = h.lines[k].raw || "";
const prevLine = h.lines[k];
if (!prevLine) continue;
const r = prevLine.raw || "";
if (r.charAt(0) === "\\") continue; // skip meta
if (r.startsWith("-")) return r.slice(1);
break; // stop at first non-meta non-minus

View File

@@ -77,7 +77,7 @@ export const MarkdownDisplay: React.FC<MarkdownDisplayProps> = ({
// Check for headers
const headerMatch = line.match(headerRegex);
if (headerMatch) {
if (headerMatch?.[1] && headerMatch[2] !== undefined) {
const level = headerMatch[1].length;
const content = headerMatch[2];
@@ -119,7 +119,12 @@ export const MarkdownDisplay: React.FC<MarkdownDisplayProps> = ({
// Check for list items
const listMatch = line.match(listItemRegex);
if (listMatch) {
if (
listMatch &&
listMatch[1] !== undefined &&
listMatch[2] &&
listMatch[3] !== undefined
) {
const indent = listMatch[1].length;
const marker = listMatch[2];
const content = listMatch[3];
@@ -146,7 +151,7 @@ export const MarkdownDisplay: React.FC<MarkdownDisplayProps> = ({
// Check for blockquotes
const blockquoteMatch = line.match(blockquoteRegex);
if (blockquoteMatch) {
if (blockquoteMatch && blockquoteMatch[1] !== undefined) {
contentBlocks.push(
<Box key={key} paddingLeft={2}>
<Text dimColor> </Text>

View File

@@ -60,6 +60,8 @@ export function PasteAwareTextInput({
onSubmit?: (value: string) => void;
placeholder?: string;
focus?: boolean;
externalCursorOffset?: number;
onCursorOffsetChange?: (n: number) => void;
}>;
// Sync external value changes (treat incoming value as DISPLAY value)

View File

@@ -123,6 +123,9 @@ export function backfillBuffers(
if (toolCalls.length > 0 && toolCalls[0]?.tool_call_id) {
const toolCall = toolCalls[0];
const toolCallId = toolCall.tool_call_id;
// Skip if any required fields are missing
if (!toolCallId || !toolCall.name || !toolCall.arguments) break;
const exists = buffers.byId.has(lineId);
buffers.byId.set(lineId, {

View File

@@ -23,11 +23,13 @@ export function formatArgsDisplay(argsJson: string): {
if ("request_heartbeat" in clone) delete clone.request_heartbeat;
parsed = clone;
const keys = Object.keys(parsed);
const firstKey = keys[0];
if (
keys.length === 1 &&
["query", "path", "file_path", "command", "label"].includes(keys[0])
firstKey &&
["query", "path", "file_path", "command", "label"].includes(firstKey)
) {
const v = parsed[keys[0]];
const v = parsed[firstKey];
display = typeof v === "string" ? v : String(v);
} else {
display = Object.entries(parsed)

View File

@@ -191,7 +191,7 @@ export async function drainStreamWithResume(
// Use the resume result (should have proper stop_reason now)
result = resumeResult;
} catch (e) {
} catch (_e) {
// Resume failed - stick with the error stop_reason
// The original error result will be returned
}