Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/codehamr/codehamr
/ functions
Functions
622 in github.com/codehamr/codehamr
⨍
Functions
622
◇
Types & classes
43
Function
TestBudget
(t *testing.T)
internal/ctx/ctx_test.go:593
Function
TestBuildToolsExposesExactlyFourTools
TestBuildToolsExposesExactlyFourTools pins the tool roster: bash, read_file, write_file, edit_file, in that order, with no loop/control tool. Order is
internal/tui/tui_test.go:1102
Function
TestCRLFLineEndings
TestCRLFLineEndings: Windows \r\n counts each line once, not twice.
internal/tui/prompt_test.go:423
Function
TestCancelMidStreamPreservesStreamedText
TestCancelMidStreamPreservesStreamedText: Ctrl+C while content is streaming keeps the partial response visible (flushed to scroll) and appends the can
internal/tui/tui_test.go:2516
Function
TestCarriageReturnLineEndings
TestCarriageReturnLineEndings: lone-\r separators (old-mac-style, some VS Code TERM setups) must still yield a correct chip line count. bubbles/textar
internal/tui/prompt_test.go:406
Function
TestChat401
TestChat401: maps to typed ErrUnauthorized.
internal/llm/llm_test.go:446
Function
TestChat401DrainsBodyForConnReuse
TestChat401DrainsBodyForConnReuse: a 401 carrying a body must have that body drained before close, or Go's transport discards the TCP connection inste
internal/llm/llm_test.go:463
Function
TestChat402
TestChat402: budget exhaustion surfaces as a typed error with the snapshot reporting zero remaining, so the UI paints the depleted state immediately.
internal/llm/llm_test.go:494
Function
TestChatDispatchesToolCallsOnFinishStop
TestChatDispatchesToolCallsOnFinishStop: Ollama's /v1 shim sometimes emits finish_reason="stop" even after streaming tool_calls. The client must still
internal/llm/llm_test.go:237
Function
TestChatDoesNotFallBackOnUnrelatedThinking
TestChatDoesNotFallBackOnUnrelatedThinking: a 400 that is NOT about reasoning but happens to contain both "not support" and the word "thinking" must n
internal/llm/llm_test.go:790
Function
TestChatFallsBackWhenOllamaRejectsThinking
TestChatFallsBackWhenOllamaRejectsThinking: Ollama rejects reasoning_effort on non-thinking models with a 400 saying `<model> does not support thinkin
internal/llm/llm_test.go:735
Function
TestChatFallsBackWhenReasoningEffortRejected
TestChatFallsBackWhenReasoningEffortRejected: newer OpenAI models reject tools + reasoning_effort on /v1/chat/completions with a 400. postChat must dr
internal/llm/llm_test.go:638
Function
TestChatIdleTimeoutAbortsStalledStream
TestChatIdleTimeoutAbortsStalledStream reproduces the exact hang: the server returns 200 OK then sends nothing. Without the idle watchdog scanner.Scan
internal/llm/llm_test.go:866
Function
TestChatIdleWatchdogResetByFrames
TestChatIdleWatchdogResetByFrames pins that an alive-but-slow stream is NOT aborted: frames spaced under the idle window each reset the watchdog, so a
internal/llm/llm_test.go:900
Function
TestChatMidStreamErrorFrameSurfacesAsError
TestChatMidStreamErrorFrameSurfacesAsError: OpenAI-compatible backends (and OpenRouter-style proxies like the hosted endpoint) report a post-200 provi
internal/llm/llm_test.go:366
Function
TestChatOtherHTTPError
TestChatOtherHTTPError: non-2xx (not 401/402) surfaces as a generic error carrying only the first body line.
internal/llm/llm_test.go:523
Function
TestChatReadsUsageTokens
TestChatReadsUsageTokens: tokens come from `usage.completion_tokens` (and prompt_tokens rides along for the debug-log calibration), not content length
internal/llm/llm_test.go:395
Function
TestChatSendsStreamIncludeUsage
TestChatSendsStreamIncludeUsage: servers emit the usage block only when `stream_options.include_usage:true` is in the request; without it the per-turn
internal/llm/llm_test.go:346
Function
TestChatStreamsContent
TestChatStreamsContent: content deltas merge into one final string.
internal/llm/llm_test.go:41
Function
TestChatStructuredErrorFallsBackToMessage
TestChatStructuredErrorFallsBackToMessage: with only `error.message` (no provider_hint), surface that, not the raw JSON envelope.
internal/llm/llm_test.go:571
Function
TestChatStructuredErrorPrefersProviderHint
TestChatStructuredErrorPrefersProviderHint: the hamrpass proxy wraps upstream errors as `{"error":{"message":...,"provider_hint":...}}`. The client mu
internal/llm/llm_test.go:547
Function
TestChatToolArgsStreamLive
TestChatToolArgsStreamLive: each tool-call arguments fragment is forwarded as an EventToolArgs as it arrives, so the UI can tick its live token estima
internal/llm/llm_test.go:162
Function
TestChatToolCall
TestChatToolCall: tool_calls in a delta emit EventToolCall and ride along in EventDone.Final.ToolCalls so the next turn can replay the assistant messa
internal/llm/llm_test.go:97
Function
TestChatToolCallFragmentedArgs
TestChatToolCallFragmentedArgs: `arguments` arrives as JSON fragments, each invalid alone. The client must accumulate raw and parse once at finish_rea
internal/llm/llm_test.go:129
Function
TestChatToolCallLateIDPreserved
TestChatToolCallLateIDPreserved: spec ships the tool_call `id` in the first fragment, but a sloppy provider may delay it. The client must update slot.
internal/llm/llm_test.go:271
Function
TestChatToolCallMalformedArgsPreservesMarker
TestChatToolCallMalformedArgsPreservesMarker: on invalid `arguments` JSON (provider bug), the client surfaces a sentinel key rather than an empty args
internal/llm/llm_test.go:298
Function
TestChatToolCallMultipleByIndex
TestChatToolCallMultipleByIndex: two tool calls interleaved across chunks. Each fragment must route to its slot by `index`, not by slice position.
internal/llm/llm_test.go:201
Function
TestChatUnreachable
TestChatUnreachable: transport failure surfaces as ErrUnreachable.
internal/llm/llm_test.go:509
Function
TestCheckHonoursEnvDisableFlag
TestCheckHonoursEnvDisableFlag: CODEHAMR_NO_UPDATE_CHECK=1 must short-circuit Check before any HTTP work, sparing CI/offline launches the fetch deadli
internal/update/update_test.go:296
Function
TestCheckReportsStale
TestCheckReportsStale: published hash differs from local → Check returns true (update available), driving the maybeSelfUpdate trigger.
internal/update/update_test.go:371
Function
TestCheckReportsUpToDate
TestCheckReportsUpToDate: local hash matches the manifest → Check returns false. The steady-state path that keeps the spinner quiet after a release.
internal/update/update_test.go:352
Function
TestCleanupOldNoopWhenMissing
TestCleanupOldNoopWhenMissing: cleanup must be silent (no error/log/panic) when there is no .old file, the steady state once an update has settled.
internal/update/update_test.go:444
Function
TestCleanupOldRemovesStaleFile
TestCleanupOldRemovesStaleFile: the previous Apply's .old must be removed at the next launch so it doesn't accumulate. On Windows .old stays locked un
internal/update/update_test.go:429
Function
TestCleanupOldSweepsOrphanedTempFiles
TestCleanupOldSweepsOrphanedTempFiles: a Ctrl+C mid-download kills the process before Apply's deferred Remove runs (no signal handler exists that earl
internal/update/update_test.go:456
Function
TestClearResetsFailureStreak
TestClearResetsFailureStreak: /clear starts the conversation over, including the repeated-failure backstop's counters.
internal/tui/tui_test.go:1935
Function
TestClearResetsSessionTokens
TestClearResetsSessionTokens: /clear wipes the conversation AND the session counter: starting over from zero is the whole point.
internal/tui/tui_test.go:2317
Function
TestClearWipesQueue
TestClearWipesQueue: /clear resets the conversation, so a queued follow-up must go with it (it would target a conversation that no longer exists).
internal/tui/queue_test.go:282
Function
TestConfigFilePermissionsAreOwnerOnly
TestConfigFilePermissionsAreOwnerOnly is the regression for a world-readable hamrpass key: /hamrpass stores the bearer token in plaintext, so any loca
internal/config/config_test.go:308
Function
TestContextWindowFromHeaders
(t *testing.T)
internal/cloud/cloud_test.go:123
Function
TestCtrlCCancelsInflightOp
TestCtrlCCancelsInflightOp: with a turn in flight, Ctrl+C cancels, clears pending tool calls, and leaves a "✗ cancelled" line in scrollback.
internal/tui/tui_test.go:181
Function
TestCtrlCIdleArmsThenQuits
TestCtrlCIdleArmsThenQuits: first Ctrl+C in idle arms the status bar and returns a Tick cmd; second Ctrl+C before the window expires returns Quit.
internal/tui/tui_test.go:142
Function
TestCtrlCPopoverClosesInsteadOfQuitting
TestCtrlCPopoverClosesInsteadOfQuitting: with the popover open and no in-flight op, Ctrl+C dismisses the popover and does not arm quit.
internal/tui/tui_test.go:163
Function
TestCtrlDEmptyQuits
TestCtrlDEmptyQuits: Ctrl+D on empty textarea returns a Quit command.
internal/tui/tui_test.go:86
Function
TestCtrlDMidTurnDoesNotQuit
TestCtrlDMidTurnDoesNotQuit: the textarea is empty during a running turn (submit resets it), so without the phase gate a reflexive Ctrl+D would quit i
internal/tui/tui_test.go:115
Function
TestCtrlDNonEmptyNoOp
TestCtrlDNonEmptyNoOp: Ctrl+D with text in the textarea is a no-op: no quit and no character deletion.
internal/tui/tui_test.go:99
Function
TestCtrlLClearsPromptNotScrollback
TestCtrlLClearsPromptNotScrollback: Ctrl+L matches Claude Code: it clears the typed input and forces a terminal redraw, but conversation scrollback st
internal/tui/tui_test.go:1485
Function
TestCtrlLClosesPopover
TestCtrlLClosesPopover: Ctrl+L clears the popover along with the prompt. Left open on stale suggestions, the next Enter would take the has-selection p
internal/tui/tui_test.go:1507
Function
TestCtxPressureTripwire
TestCtxPressureTripwire: the round_done companion warning fires only when the server-counted prompt reaches 95% of the active window. The char/4 packe
internal/tui/tui_test.go:761
Function
TestDamagedLabelAmongIdenticalChipsDropsWholeGroup
TestDamagedLabelAmongIdenticalChipsDropsWholeGroup: two pastes with the same line count render identical labels. A word-delete at the boundary (Ctrl+W
internal/tui/prompt_test.go:210
Function
TestDamagedLabelUniqueChipDropsOnlyItself
TestDamagedLabelUniqueChipDropsOnlyItself: the group-drop above must not over-trigger; a damaged label with no twin drops alone and the other chip kee
internal/tui/prompt_test.go:239
Function
TestDebugLogFilePermsAreOwnerOnly
TestDebugLogFilePermsAreOwnerOnly: the log captures every prompt and tool-call payload: bash args can carry heredoc secrets, so a world-readable log l
internal/tui/tui_test.go:681
Function
TestDeleteAtChipStartRemovesWholeChip
TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right before the label removes the whole chip.
internal/tui/prompt_test.go:114
Function
TestEditFileDelete
(t *testing.T)
internal/tools/edit_test.go:144
Function
TestEditFileEmptyOldString
(t *testing.T)
internal/tools/edit_test.go:128
Function
TestEditFileEmptyPath
(t *testing.T)
internal/tools/edit_test.go:32
Function
TestEditFileHappy
(t *testing.T)
internal/tools/edit_test.go:13
Function
TestEditFileMissingFile
(t *testing.T)
internal/tools/edit_test.go:38
Function
TestEditFileMultilineOldString
(t *testing.T)
internal/tools/edit_test.go:160
Function
TestEditFileNoOp
(t *testing.T)
internal/tools/edit_test.go:116
Function
TestEditFileOldNotFound
(t *testing.T)
internal/tools/edit_test.go:45
Function
TestEditFileOldNotUnique
(t *testing.T)
internal/tools/edit_test.go:81
Function
TestEditFileOverlappingOldString
TestEditFileOverlappingOldString: strings.Count sees only one non-overlapping "==" in "a === b", but it matches at two positions with different result
internal/tools/edit_test.go:100
Function
TestEditFileRefusesNonRegular
TestEditFileRefusesNonRegular: edit_file reads the target first, so it needs the same guard as read_file.
internal/tools/nonregular_unix_test.go:69
Function
TestEditFileSchemaShape
(t *testing.T)
internal/tools/edit_test.go:219
Function
TestEditFileWhitespaceNearMissHint
TestEditFileWhitespaceNearMissHint: a miss whose only difference is indentation gets the diagnostic hint, and the file is left untouched (the hint is
internal/tools/edit_test.go:65
Function
TestEmbeddedPromptFitsFixedSystem
TestEmbeddedPromptFitsFixedSystem guards the invariant the packer relies on: FixedSystem must reserve enough budget for the embedded system prompt PLU
internal/ctx/ctx_test.go:17
Function
TestEmptyReplyNudgeFiresOnceThenSurfaces
TestEmptyReplyNudgeFiresOnceThenSurfaces: if the model stays empty even after the re-prompt (e.g. a server that deterministically swallows the call),
internal/tui/tui_test.go:3288
Function
TestEmptyReplyNudgeReArmsAfterProgress
TestEmptyReplyNudgeReArmsAfterProgress pins the galaxy1 fix: once an empty reply has nudged this turn, a round that issues a real tool call is genuine
internal/tui/tui_test.go:3319
Function
TestEmptyReplyNudgeRePromptsThenRecovers
TestEmptyReplyNudgeRePromptsThenRecovers: a turn whose first round comes back with no content and no tool call (the dominant silent-death: a thinking
internal/tui/tui_test.go:3241
Function
TestEmptyRunesKeyIsDropped
TestEmptyRunesKeyIsDropped: KeyMsg{Type: KeyRunes, Runes: nil} arises when bubbletea's parser chokes on a partial escape sequence. Falling through ins
internal/tui/tui_test.go:2876
Function
TestEndTurnResetsPendingSoStaleCallsDoNotLeakIntoNextTurn
TestEndTurnResetsPendingSoStaleCallsDoNotLeakIntoNextTurn: a turn can end with calls still in m.pending. Without resetting pending in endTurn, the nex
internal/tui/tui_test.go:3162
Function
TestEndTurnResetsToolRounds
TestEndTurnResetsToolRounds: the runaway counter is per-turn, so endTurn must zero it or the next turn inherits a head start toward the cap.
internal/tui/tui_test.go:2011
Function
TestEndTurnResetsVerifyNudged
TestEndTurnResetsVerifyNudged: the latch is per-turn, so endTurn must clear it or a later turn never re-grounds.
internal/tui/tui_test.go:2220
Function
TestEnsureHamrpassLazyCreates
TestEnsureHamrpassLazyCreates: with hamrpass hidden from config.yaml, EnsureHamrpass returns a profile from the canonical seed values, and is idempote
internal/config/config_test.go:202
Function
TestEntryRestoreRoundTrip
TestEntryRestoreRoundTrip: Entry()+Restore() fully recovers chip state: display text, spans, expanded Value(). Backs ↑/↓ history replay.
internal/tui/prompt_test.go:296
Function
TestErrorMessageBudgetExhausted
TestErrorMessageBudgetExhausted: 402 produces the depleted hint pointing users at the top-up page rather than a stack-trace style wrap.
internal/tui/tui_test.go:1471
Function
TestErrorMessageUnauthorized
TestErrorMessageUnauthorized: 401 names the rejected key and the exact config path so the user can fix it without guessing.
internal/tui/tui_test.go:1458
Function
TestErrorMessageUnreachable
TestErrorMessageUnreachable verifies the unreachable hint names the active profile's URL and steers the user toward /models to switch profiles.
internal/tui/tui_test.go:1437
Function
TestEscFromCommandLevelClosesAndClears
TestEscFromCommandLevelClosesAndClears: Esc at command-level closes the popover AND clears the textarea, so the user returns to a blank prompt. Typing
internal/tui/tui_test.go:377
Function
TestEventDoneFlushesStreamingThroughGlamour
TestEventDoneFlushesStreamingThroughGlamour: EventDone moves raw streamed text into the committed scroll via the Markdown renderer and empties the str
internal/tui/tui_test.go:2478
Function
TestEventErrorPreservesStreamedText
TestEventErrorPreservesStreamedText: a stream error mid-content flushes the partial text before appending the error line, same principle as cancel, us
internal/tui/tui_test.go:2713
Function
TestExecuteBashWrapsResult
(t *testing.T)
internal/tools/bash_test.go:228
Function
TestExecuteEditFileRefusesMissingNewString
TestExecuteEditFileRefusesMissingNewString: same guard as write_file's content - a dropped new_string must not decode to "" and silently delete the ma
internal/tools/write_test.go:139
Function
TestExecuteEditFileWrapsResult
(t *testing.T)
internal/tools/edit_test.go:177
Function
TestExecuteReadFileWrapsResult
(t *testing.T)
internal/tools/read_test.go:85
Function
TestExecuteUnknownTool
(t *testing.T)
internal/tools/bash_test.go:242
Function
TestExecuteWriteFileRefusesMissingContent
TestExecuteWriteFileRefusesMissingContent: valid-JSON args with no string "content" ({"path": ...} alone, or "content": null) must not decode to "" an
internal/tools/write_test.go:108
Function
TestExecuteWriteFileWrapsResult
(t *testing.T)
internal/tools/write_test.go:80
Function
TestFetchHashHandlesCorruptManifest
TestFetchHashHandlesCorruptManifest: a manifest not in `<hash> <name>` form must not crash fetchHash; it just yields an empty hash.
internal/update/update_test.go:276
Function
TestFinalizeFoldsInFlightEstimate
TestFinalizeFoldsInFlightEstimate: a turn aborted mid-stream (Ctrl+C, error) has no EventDone to fold the current round's tokens into turnTokens; they
internal/tui/tui_test.go:1702
Function
TestFirstResizeDoesNotClearScreen
TestFirstResizeDoesNotClearScreen: the first WindowSizeMsg must not ClearScreen; the terminal still holds the user's pre-launch shell output; wiping i
internal/tui/resize_test.go:45
Function
TestFocusBlurMsgsAreInert
TestFocusBlurMsgsAreInert: terminal focus reports arrive as tea.FocusMsg / tea.BlurMsg under tea.WithReportFocus. They must never touch the textarea (
internal/tui/tui_test.go:2844
Function
TestFromHeadersClampsAndParses
(t *testing.T)
internal/cloud/cloud_test.go:53
Function
TestFromHeadersMissing
(t *testing.T)
internal/cloud/cloud_test.go:47
Function
TestFromHeadersRejectsNaNAndInf
TestFromHeadersRejectsNaNAndInf: ParseFloat accepts NaN/±Inf without error and the [0,1] clamp is a no-op against NaN, so they'd render as int(NaN*100
internal/cloud/cloud_test.go:88
Function
TestHamrpassLazyCreatesProfile
TestHamrpassLazyCreatesProfile: a user who hid hamrpass from config.yaml can still activate it by pasting a key. /hamrpass <key> creates the profile f
internal/tui/tui_test.go:2991
Function
TestHamrpassNoArgsShowsExplainerWhenUnset
TestHamrpassNoArgsShowsExplainerWhenUnset: `/hamrpass` with no key set prints the guided block, including the unset status line and the purchase URL.
internal/tui/tui_test.go:2910
Function
TestHamrpassNoArgsShowsSetWhenKeyPresent
TestHamrpassNoArgsShowsSetWhenKeyPresent: status line flips to `set` when the hamrpass profile already has a key.
internal/tui/tui_test.go:2940
Function
TestHamrpassRejectsControlChars
TestHamrpassRejectsControlChars: a key with an embedded escape / NUL / DEL must be rejected by hamrpassValidate, not persisted, else every dial-out er
internal/tui/tui_test.go:3049
Function
TestHamrpassRejectsMultipleArgs
TestHamrpassRejectsMultipleArgs: a paste with embedded whitespace splits into multiple args via strings.Fields. The handler refuses with a dedicated m
internal/tui/tui_test.go:3084
← previous
next →
301–400 of 622, ranked by callers