MCPcopy Create free account

hub / github.com/codehamr/codehamr / functions

Functions622 in github.com/codehamr/codehamr

FunctionTestBudget
(t *testing.T)
internal/ctx/ctx_test.go:593
FunctionTestBuildToolsExposesExactlyFourTools
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
FunctionTestCRLFLineEndings
TestCRLFLineEndings: Windows \r\n counts each line once, not twice.
internal/tui/prompt_test.go:423
FunctionTestCancelMidStreamPreservesStreamedText
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
FunctionTestCarriageReturnLineEndings
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
FunctionTestChat401
TestChat401: maps to typed ErrUnauthorized.
internal/llm/llm_test.go:446
FunctionTestChat401DrainsBodyForConnReuse
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
FunctionTestChat402
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
FunctionTestChatDispatchesToolCallsOnFinishStop
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
FunctionTestChatDoesNotFallBackOnUnrelatedThinking
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
FunctionTestChatFallsBackWhenOllamaRejectsThinking
TestChatFallsBackWhenOllamaRejectsThinking: Ollama rejects reasoning_effort on non-thinking models with a 400 saying `<model> does not support thinkin
internal/llm/llm_test.go:735
FunctionTestChatFallsBackWhenReasoningEffortRejected
TestChatFallsBackWhenReasoningEffortRejected: newer OpenAI models reject tools + reasoning_effort on /v1/chat/completions with a 400. postChat must dr
internal/llm/llm_test.go:638
FunctionTestChatIdleTimeoutAbortsStalledStream
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
FunctionTestChatIdleWatchdogResetByFrames
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
FunctionTestChatMidStreamErrorFrameSurfacesAsError
TestChatMidStreamErrorFrameSurfacesAsError: OpenAI-compatible backends (and OpenRouter-style proxies like the hosted endpoint) report a post-200 provi
internal/llm/llm_test.go:366
FunctionTestChatOtherHTTPError
TestChatOtherHTTPError: non-2xx (not 401/402) surfaces as a generic error carrying only the first body line.
internal/llm/llm_test.go:523
FunctionTestChatReadsUsageTokens
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
FunctionTestChatSendsStreamIncludeUsage
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
FunctionTestChatStreamsContent
TestChatStreamsContent: content deltas merge into one final string.
internal/llm/llm_test.go:41
FunctionTestChatStructuredErrorFallsBackToMessage
TestChatStructuredErrorFallsBackToMessage: with only `error.message` (no provider_hint), surface that, not the raw JSON envelope.
internal/llm/llm_test.go:571
FunctionTestChatStructuredErrorPrefersProviderHint
TestChatStructuredErrorPrefersProviderHint: the hamrpass proxy wraps upstream errors as `{"error":{"message":...,"provider_hint":...}}`. The client mu
internal/llm/llm_test.go:547
FunctionTestChatToolArgsStreamLive
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
FunctionTestChatToolCall
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
FunctionTestChatToolCallFragmentedArgs
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
FunctionTestChatToolCallLateIDPreserved
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
FunctionTestChatToolCallMalformedArgsPreservesMarker
TestChatToolCallMalformedArgsPreservesMarker: on invalid `arguments` JSON (provider bug), the client surfaces a sentinel key rather than an empty args
internal/llm/llm_test.go:298
FunctionTestChatToolCallMultipleByIndex
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
FunctionTestChatUnreachable
TestChatUnreachable: transport failure surfaces as ErrUnreachable.
internal/llm/llm_test.go:509
FunctionTestCheckHonoursEnvDisableFlag
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
FunctionTestCheckReportsStale
TestCheckReportsStale: published hash differs from local → Check returns true (update available), driving the maybeSelfUpdate trigger.
internal/update/update_test.go:371
FunctionTestCheckReportsUpToDate
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
FunctionTestCleanupOldNoopWhenMissing
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
FunctionTestCleanupOldRemovesStaleFile
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
FunctionTestCleanupOldSweepsOrphanedTempFiles
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
FunctionTestClearResetsFailureStreak
TestClearResetsFailureStreak: /clear starts the conversation over, including the repeated-failure backstop's counters.
internal/tui/tui_test.go:1935
FunctionTestClearResetsSessionTokens
TestClearResetsSessionTokens: /clear wipes the conversation AND the session counter: starting over from zero is the whole point.
internal/tui/tui_test.go:2317
FunctionTestClearWipesQueue
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
FunctionTestConfigFilePermissionsAreOwnerOnly
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
FunctionTestContextWindowFromHeaders
(t *testing.T)
internal/cloud/cloud_test.go:123
FunctionTestCtrlCCancelsInflightOp
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
FunctionTestCtrlCIdleArmsThenQuits
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
FunctionTestCtrlCPopoverClosesInsteadOfQuitting
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
FunctionTestCtrlDEmptyQuits
TestCtrlDEmptyQuits: Ctrl+D on empty textarea returns a Quit command.
internal/tui/tui_test.go:86
FunctionTestCtrlDMidTurnDoesNotQuit
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
FunctionTestCtrlDNonEmptyNoOp
TestCtrlDNonEmptyNoOp: Ctrl+D with text in the textarea is a no-op: no quit and no character deletion.
internal/tui/tui_test.go:99
FunctionTestCtrlLClearsPromptNotScrollback
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
FunctionTestCtrlLClosesPopover
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
FunctionTestCtxPressureTripwire
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
FunctionTestDamagedLabelAmongIdenticalChipsDropsWholeGroup
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
FunctionTestDamagedLabelUniqueChipDropsOnlyItself
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
FunctionTestDebugLogFilePermsAreOwnerOnly
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
FunctionTestDeleteAtChipStartRemovesWholeChip
TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right before the label removes the whole chip.
internal/tui/prompt_test.go:114
FunctionTestEditFileDelete
(t *testing.T)
internal/tools/edit_test.go:144
FunctionTestEditFileEmptyOldString
(t *testing.T)
internal/tools/edit_test.go:128
FunctionTestEditFileEmptyPath
(t *testing.T)
internal/tools/edit_test.go:32
FunctionTestEditFileHappy
(t *testing.T)
internal/tools/edit_test.go:13
FunctionTestEditFileMissingFile
(t *testing.T)
internal/tools/edit_test.go:38
FunctionTestEditFileMultilineOldString
(t *testing.T)
internal/tools/edit_test.go:160
FunctionTestEditFileNoOp
(t *testing.T)
internal/tools/edit_test.go:116
FunctionTestEditFileOldNotFound
(t *testing.T)
internal/tools/edit_test.go:45
FunctionTestEditFileOldNotUnique
(t *testing.T)
internal/tools/edit_test.go:81
FunctionTestEditFileOverlappingOldString
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
FunctionTestEditFileRefusesNonRegular
TestEditFileRefusesNonRegular: edit_file reads the target first, so it needs the same guard as read_file.
internal/tools/nonregular_unix_test.go:69
FunctionTestEditFileSchemaShape
(t *testing.T)
internal/tools/edit_test.go:219
FunctionTestEditFileWhitespaceNearMissHint
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
FunctionTestEmbeddedPromptFitsFixedSystem
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
FunctionTestEmptyReplyNudgeFiresOnceThenSurfaces
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
FunctionTestEmptyReplyNudgeReArmsAfterProgress
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
FunctionTestEmptyReplyNudgeRePromptsThenRecovers
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
FunctionTestEmptyRunesKeyIsDropped
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
FunctionTestEndTurnResetsPendingSoStaleCallsDoNotLeakIntoNextTurn
TestEndTurnResetsPendingSoStaleCallsDoNotLeakIntoNextTurn: a turn can end with calls still in m.pending. Without resetting pending in endTurn, the nex
internal/tui/tui_test.go:3162
FunctionTestEndTurnResetsToolRounds
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
FunctionTestEndTurnResetsVerifyNudged
TestEndTurnResetsVerifyNudged: the latch is per-turn, so endTurn must clear it or a later turn never re-grounds.
internal/tui/tui_test.go:2220
FunctionTestEnsureHamrpassLazyCreates
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
FunctionTestEntryRestoreRoundTrip
TestEntryRestoreRoundTrip: Entry()+Restore() fully recovers chip state: display text, spans, expanded Value(). Backs ↑/↓ history replay.
internal/tui/prompt_test.go:296
FunctionTestErrorMessageBudgetExhausted
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
FunctionTestErrorMessageUnauthorized
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
FunctionTestErrorMessageUnreachable
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
FunctionTestEscFromCommandLevelClosesAndClears
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
FunctionTestEventDoneFlushesStreamingThroughGlamour
TestEventDoneFlushesStreamingThroughGlamour: EventDone moves raw streamed text into the committed scroll via the Markdown renderer and empties the str
internal/tui/tui_test.go:2478
FunctionTestEventErrorPreservesStreamedText
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
FunctionTestExecuteBashWrapsResult
(t *testing.T)
internal/tools/bash_test.go:228
FunctionTestExecuteEditFileRefusesMissingNewString
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
FunctionTestExecuteEditFileWrapsResult
(t *testing.T)
internal/tools/edit_test.go:177
FunctionTestExecuteReadFileWrapsResult
(t *testing.T)
internal/tools/read_test.go:85
FunctionTestExecuteUnknownTool
(t *testing.T)
internal/tools/bash_test.go:242
FunctionTestExecuteWriteFileRefusesMissingContent
TestExecuteWriteFileRefusesMissingContent: valid-JSON args with no string "content" ({"path": ...} alone, or "content": null) must not decode to "" an
internal/tools/write_test.go:108
FunctionTestExecuteWriteFileWrapsResult
(t *testing.T)
internal/tools/write_test.go:80
FunctionTestFetchHashHandlesCorruptManifest
TestFetchHashHandlesCorruptManifest: a manifest not in `<hash> <name>` form must not crash fetchHash; it just yields an empty hash.
internal/update/update_test.go:276
FunctionTestFinalizeFoldsInFlightEstimate
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
FunctionTestFirstResizeDoesNotClearScreen
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
FunctionTestFocusBlurMsgsAreInert
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
FunctionTestFromHeadersClampsAndParses
(t *testing.T)
internal/cloud/cloud_test.go:53
FunctionTestFromHeadersMissing
(t *testing.T)
internal/cloud/cloud_test.go:47
FunctionTestFromHeadersRejectsNaNAndInf
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
FunctionTestHamrpassLazyCreatesProfile
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
FunctionTestHamrpassNoArgsShowsExplainerWhenUnset
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
FunctionTestHamrpassNoArgsShowsSetWhenKeyPresent
TestHamrpassNoArgsShowsSetWhenKeyPresent: status line flips to `set` when the hamrpass profile already has a key.
internal/tui/tui_test.go:2940
FunctionTestHamrpassRejectsControlChars
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
FunctionTestHamrpassRejectsMultipleArgs
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
← previousnext →301–400 of 622, ranked by callers