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
TestReadFileHappy
(t *testing.T)
internal/tools/read_test.go:13
Function
TestReadFileMissingFile
(t *testing.T)
internal/tools/read_test.go:32
Function
TestReadFileRefusesNonRegular
TestReadFileRefusesNonRegular: read_file on a FIFO would block forever in open(2) waiting for a writer, leaking the tool goroutine past Ctrl+C (which
internal/tools/nonregular_unix_test.go:37
Function
TestReadFileSchemaShape
(t *testing.T)
internal/tools/read_test.go:59
Function
TestReadFileTruncatesOversizeContent
TestReadFileTruncatesOversizeContent: ReadFile obeys the same Truncate head+tail cap as every other tool. Oversize content must carry the marker so th
internal/tools/read_test.go:42
Function
TestReasoningChunksAreEmitted
TestReasoningChunksAreEmitted: reasoning models stream chain-of-thought in `delta.reasoning`. The decoder must surface these as EventReasoning (else t
internal/llm/llm_test.go:595
Function
TestRedactSlashHidesHamrpassKey
TestRedactSlashHidesHamrpassKey: with `logging: true`, every prompt (including `/hamrpass <key>`) is written to .codehamr/log.txt. The log is meant to
internal/tui/tui_test.go:621
Function
TestRedundantResizeIsNoOp
TestRedundantResizeIsNoOp: a WindowSizeMsg with unchanged dimensions (some terminals send these on focus) must not fire the hardening path; clearing t
internal/tui/resize_test.go:166
Function
TestReexecGuardOverridesPreexistingValue
TestReexecGuardOverridesPreexistingValue pins the loop-guard env semantics maybeSelfUpdate relies on: the re-exec'd child must see CODEHAMR_NO_UPDATE_
cmd/codehamr/main_test.go:41
Function
TestRepeatedFailureNudgeDifferentTargetResetsStreak
TestRepeatedFailureNudgeDifferentTargetResetsStreak: switching targets between failures resets the streak: exploration across distinct operations must
internal/tui/tui_test.go:1891
Function
TestRepeatedFailureNudgeFiresOnceAfterFiveSameTargetFailures
TestRepeatedFailureNudgeFiresOnceAfterFiveSameTargetFailures drives the repeated-failure backstop end-to-end. Five consecutive failures of the SAME ta
internal/tui/tui_test.go:1807
Function
TestRepeatedFailureNudgeSuccessResetsStreak
TestRepeatedFailureNudgeSuccessResetsStreak: a single success in the middle of a run of failures resets the streak, so the nudge never fires.
internal/tui/tui_test.go:1862
Function
TestResetClearsChips
TestResetClearsChips: Reset empties store and spans, leaving only new text.
internal/tui/prompt_test.go:322
Function
TestResizeKeepsPromptInsideTerminal
TestResizeKeepsPromptInsideTerminal: across a resize sequence View must never claim more rows than the terminal, else the textarea pushes the status b
internal/tui/resize_test.go:17
Function
TestResizeSettleReplaysScrollbackAtNewWidth
TestResizeSettleReplaysScrollbackAtNewWidth: a matching settle returns a tea.Sequence that wipes viewport + scrollback and re-emits splash and the ful
internal/tui/resize_test.go:96
Function
TestResolvedKeyExpandsEnvVar
TestResolvedKeyExpandsEnvVar: `key: ${MY_KEY}` in config.yaml must expand the env var at read time while the raw reference round-trips on Save. This i
internal/config/config_test.go:662
Function
TestResolvedKeyLiteralDollarSurvives
TestResolvedKeyLiteralDollarSurvives: expansion applies ONLY when the whole key is a ${VAR} reference. A literal proxy key containing '$' (llama.cpp -
internal/config/config_test.go:702
Function
TestResolvedKeyPassesLiteralThrough
TestResolvedKeyPassesLiteralThrough: a plaintext key with no $-references must pass through unchanged so existing configs keep working.
internal/config/config_test.go:680
Function
TestResolvedKeyUnsetEnvYieldsEmpty
TestResolvedKeyUnsetEnvYieldsEmpty: ${VAR} with VAR unset expands to "", matching the "no key" branch (keyless local Ollama) without a panic.
internal/config/config_test.go:689
Function
TestResponseReserveScales
TestResponseReserveScales pins the reserve curve: floored until ctxSize/8 crosses 8k, then linear. A divisor tweak lands here loud.
internal/ctx/ctx_test.go:611
Function
TestRightArrowAtChipStartJumpsToEnd
TestRightArrowAtChipStartJumpsToEnd: → skips the whole chip in one keystroke.
internal/tui/prompt_test.go:155
Function
TestRunRawSurfacesTruncatedToolArgs
TestRunRawSurfacesTruncatedToolArgs: the _parse_error sentinel (set by llm.resolve when the server truncates an oversized tool call mid-JSON) must sur
internal/tools/bash_test.go:287
Function
TestRunSlashPicksUpExternalConfigEdits
TestRunSlashPicksUpExternalConfigEdits: runSlash re-reads .codehamr/config.yaml before dispatching, so a profile a user hand-added to the file mid-ses
internal/tui/tui_test.go:939
Function
TestRunSlashWarnsOnBrokenConfig
TestRunSlashWarnsOnBrokenConfig: a typo in config.yaml must not lock the user out of slash commands. The reload prints a one-line warning and keeps th
internal/tui/tui_test.go:974
Function
TestRunToolCallHonorsBashTimeoutBeyondLegacyCap
TestRunToolCallHonorsBashTimeoutBeyondLegacyCap: bash's own timeout is the only ceiling: runToolCall must not wrap the parent context in a shorter cap
internal/tui/tui_test.go:2679
Function
TestRunawayNudgeFiresOnceAtMaxToolRounds
TestRunawayNudgeFiresOnceAtMaxToolRounds: the per-turn tool-call counter trips exactly one soft system note when it reaches maxToolRounds, and never b
internal/tui/tui_test.go:1961
Function
TestRunawayNudgeFiresWhenCounterSkipsCap
TestRunawayNudgeFiresWhenCounterSkipsCap: a multi-tool-call round increments toolRounds per call but the nudge is consulted only when the pending queu
internal/tui/tui_test.go:1992
Function
TestSaveIsAtomicAndLeavesNoTemp
TestSaveIsAtomicAndLeavesNoTemp: writeYAML writes a sibling temp then renames it over config.yaml so a torn write can't brick the next launch. Pin tha
internal/config/config_test.go:376
Function
TestSaveTightensPreexistingLoosePerms
TestSaveTightensPreexistingLoosePerms covers the upgrade path fresh-bootstrap misses: a config.yaml from an older world-readable codehamr (or a hand-e
internal/config/config_test.go:755
Function
TestSendEventUnblocksOnCancel
TestSendEventUnblocksOnCancel pins sendEvent's anti-wedge invariant: once the parent context is cancelled, a send to an undrained channel must abort v
internal/llm/llm_test.go:423
Function
TestSessionTokensAccumulateAcrossTurns
TestSessionTokensAccumulateAcrossTurns: the session counter is separate from the per-turn counter. finalizeTurn resets turnTokens; sessionTokens keeps
internal/tui/tui_test.go:1656
Function
TestSessionTokensSurviveFinalizeTurn
TestSessionTokensSurviveFinalizeTurn: finalizeTurn clears turnTokens but must NOT touch sessionTokens. turnStart must be set or finalizeTurn no-ops.
internal/tui/tui_test.go:1680
Function
TestSetActivePersists
TestSetActivePersists: SetActive flips Active and writes config.yaml.
internal/config/config_test.go:410
Function
TestSetActiveRejectsUnknown
TestSetActiveRejectsUnknown: SetActive returns an error for an unknown name.
internal/config/config_test.go:434
Function
TestSetActiveRevertsOnSaveFailure
TestSetActiveRevertsOnSaveFailure guards in-memory/on-disk drift on Save failure. If SetActive mutates Active before a failed Save, ActiveProfile() re
internal/config/config_test.go:446
Function
TestSetCursorRuneOffsetCrossesSoftWrappedLine
TestSetCursorRuneOffsetCrossesSoftWrappedLine: walking to a target row must traverse a soft-wrapped logical line in between. bubbles' CursorUp inside
internal/tui/prompt_test.go:41
Function
TestSetValueClearsChips
TestSetValueClearsChips: SetValue installs plain text and drops prior chips, used by slash-popover Tab-completion, where chips can't be part of a repl
internal/tui/prompt_test.go:339
Function
TestSlashClearResetsHistory
(t *testing.T)
internal/tui/tui_test.go:841
Function
TestSlashClearSurvivesBrokenConfig
TestSlashClearSurvivesBrokenConfig: with config.yaml unparseable, /clear must still wipe history. The reload warning gets wiped with the rest of scrol
internal/tui/tui_test.go:1001
Function
TestSlashClearWipesTerminalScrollback
TestSlashClearWipesTerminalScrollback: tea.ClearScreen (\x1b[2J) clears only the visible region; the saved-lines buffer needs the DECSED 3 sequence fr
internal/tui/tui_test.go:857
Function
TestSlashModelRejectsUnknown
TestSlashModelRejectsUnknown: unknown name is a quiet warn, not a switch.
internal/tui/tui_test.go:832
Function
TestSlashModelSwitchClearsStaleBudget
TestSlashModelSwitchClearsStaleBudget: after a hamrpass turn leaves m.budget set, switching to a profile that emits no X-Budget-* headers (local Ollam
internal/tui/tui_test.go:815
Function
TestSlashModelSwitchDropsStickyFallbackState
TestSlashModelSwitchDropsStickyFallbackState: llm.Client's noReasoningEffort flag ("this server 400'd on tools+reasoning_effort, stop sending it") is
internal/tui/tui_test.go:791
Function
TestSlashModelSwitchesActive
TestSlashModelSwitchesActive: /models <name> sets Active and rebuilds the llm client's base URL / token / model to the new profile's values.
internal/tui/tui_test.go:593
Function
TestSmallPasteStaysInline
TestSmallPasteStaysInline: a paste below threshold stays raw, no chip.
internal/tui/prompt_test.go:56
Function
TestSplashEmittedOnFirstSize
TestSplashEmittedOnFirstSize: the splash prints once into scrollback on the first WindowSizeMsg, then scrolls up as content arrives. We verify the lin
internal/tui/tui_test.go:2801
Function
TestStalePingForOldBackendDoesNotOverwriteConnectedFlag
TestStalePingForOldBackendDoesNotOverwriteConnectedFlag: a ping launched against the old profile's URL can land after the user /models'd to a new reac
internal/tui/tui_test.go:1251
Function
TestStaleProbeDoesNotPrintActivationBannerForNonActiveProfile
TestStaleProbeDoesNotPrintActivationBannerForNonActiveProfile: a probe for a profile the user has /models'd away from must not print "✓ active: <profi
internal/tui/tui_test.go:3179
Function
TestStaleProbeForOldProfileDoesNotOverwriteConnectedFlag
TestStaleProbeForOldProfileDoesNotOverwriteConnectedFlag mirrors the pingMsg guard for probeMsg: a probe for a no-longer-active profile must not mutat
internal/tui/tui_test.go:1272
Function
TestStaleResizeSettleIsDiscarded
TestStaleResizeSettleIsDiscarded: a settle whose gen no longer matches m.resizeGen (a newer resize bumped it after scheduling) must be a no-op, else t
internal/tui/resize_test.go:137
Function
TestStaleStreamCloseDoesNotKillLiveTurn
TestStaleStreamCloseDoesNotKillLiveTurn: the prior turn's channel closing after a fresh submit must NOT run handleStreamClosed against the live turn.
internal/tui/tui_test.go:2615
Function
TestStaleStreamEventDoesNotMutateLiveTurn
TestStaleStreamEventDoesNotMutateLiveTurn: after Ctrl+C kills turn 1 and the user submits turn 2, turn 1's readEvent Cmd can still fire (buffered chan
internal/tui/tui_test.go:2590
Function
TestStaleToolResultDoesNotEnterLiveHistory
TestStaleToolResultDoesNotEnterLiveHistory: a bash result from cancelled turn N must not append to turn N+1's history (its unmatched tool_call_id woul
internal/tui/tui_test.go:2642
Function
TestStatusBarLiveTimerAndFrozenSummary
TestStatusBarLiveTimerAndFrozenSummary: during an active turn the bar shows the phase label plus a ticking wall-clock; at idle after a clean finish it
internal/tui/tui_test.go:2288
Function
TestStatusBarOmitsBudgetWithoutHeaders
TestStatusBarOmitsBudgetWithoutHeaders: endpoint sends no budget header, no pass segment appears.
internal/tui/tui_test.go:1367
Function
TestStatusBarShowsBudgetFromHeaders
TestStatusBarShowsBudgetFromHeaders: the pass segment renders whenever X-Budget-Remaining arrives: the header is the only signal, no profile gating. T
internal/tui/tui_test.go:1358
Function
TestStatusBarShowsSessionTokens
TestStatusBarShowsSessionTokens: once the counter is non-zero it appears in the status bar; at zero the bar stays quiet.
internal/tui/tui_test.go:2272
Function
TestStatusBarShowsSpinnerWhenWaiting
TestStatusBarShowsSpinnerWhenWaiting verifies the micro-animation text appears in the bottom bar while a request is in flight, and disappears when not
internal/tui/tui_test.go:1397
Function
TestStatusSuffix
(t *testing.T)
internal/cloud/cloud_test.go:102
Function
TestStreamContentShowsLiveInViewport
TestStreamContentShowsLiveInViewport: a mid-turn content event populates the streaming buffer, promotes phase thinking→streaming, and is visible in Vi
internal/tui/tui_test.go:2455
Function
TestStreamingShownInLiveView
TestStreamingShownInLiveView: the streaming buffer is rendered above the prompt by View() while content is in flight, so the user sees tokens immediat
internal/tui/tui_test.go:2832
Function
TestStrictYAMLRejectsUnknownKey
TestStrictYAMLRejectsUnknownKey: unknown top-level keys in config.yaml must fail loud, not be silently ignored: surfaces typos immediately.
internal/config/config_test.go:535
Function
TestSubmitRedactsHamrpassKeyFromHistoryAndScroll
TestSubmitRedactsHamrpassKeyFromHistoryAndScroll: redactSlash keeps the bearer token out of the debug log, but submit must also keep it out of scrollb
internal/tui/tui_test.go:652
Function
TestSubmitResetsFailureStreak
TestSubmitResetsFailureStreak: a fresh user submission is a new goal, so a stale streak from the previous goal must not carry over and trip the nudge
internal/tui/tui_test.go:1918
Function
TestSubmitStreamsUpToDone
(t *testing.T)
internal/tui/tui_test.go:1017
Function
TestSystemPromptFitsFixedSystemReservation
TestSystemPromptFitsFixedSystemReservation pins ctx.FixedSystem against the embedded prompt. Grow the prompt past the reservation and Pack over-alloca
internal/tui/tui_test.go:74
Function
TestSystemPromptIncludesWorkingDirAndInvestigateRule
TestSystemPromptIncludesWorkingDirAndInvestigateRule: the system prompt must (a) tell the model to investigate files itself rather than ask the user t
internal/tui/tui_test.go:56
Function
TestToWireAlwaysSendsContent
TestToWireAlwaysSendsContent: silent tool results (empty stdout) must still serialize "content":"". Ollama's /v1 shim 400s if the field is absent or n
internal/llm/llm_test.go:323
Function
TestToWireParseErrorArgsStayValidJSON
TestToWireParseErrorArgsStayValidJSON: when resolve() stamps _parse_error for a truncated tool call and that assistant message round-trips into the ne
internal/llm/llm_test.go:939
Function
TestTokensHeuristic
(t *testing.T)
internal/ctx/ctx_test.go:26
Function
TestToolArgsStreamBumpsEstimateAndPhase
TestToolArgsStreamBumpsEstimateAndPhase: a tool-call argument fragment (a file streaming into write_file) ticks the live token estimate AND flips the
internal/tui/tui_test.go:1086
Function
TestToolCallFlushesStreamedContent
TestToolCallFlushesStreamedContent: a tool-call event ends the content phase. Whatever streamed before it is rendered and committed *now*, so the user
internal/tui/tui_test.go:2495
Function
TestToolCallLeakWarningDetectsStrandedXML
TestToolCallLeakWarningDetectsStrandedXML: a turn ending with leaked tool-call XML stranded in the newest assistant message warns the user; clean text
internal/tui/tui_test.go:2233
Function
TestToolCallRoundTripExecutesBash
(t *testing.T)
internal/tui/tui_test.go:1030
Function
TestToolResultFailed
TestToolResultFailed pins the failure classifier the nudge keys on: a "(cancelled)" result (user Ctrl+C) is never a failure; write/edit fail iff the t
internal/tui/tui_test.go:1765
Function
TestToolTargetKey
TestToolTargetKey pins the identity the repeated-failure nudge keys on: file tools key on tool+path, bash on tool + the trimmed first command line, el
internal/tui/tui_test.go:1727
Function
TestTruncateLargeCollapses
(t *testing.T)
internal/ctx/ctx_test.go:63
Function
TestTruncateSmallUntouched
(t *testing.T)
internal/ctx/ctx_test.go:56
Function
TestTruncateSnapsToRuneBoundary
TestTruncateSnapsToRuneBoundary: Truncate's byte-offset cut must not slice multi-byte runes mid-sequence: output stays valid UTF-8.
internal/ctx/ctx_test.go:82
Function
TestTurnEndsWhenAssistantEmitsNoToolCalls
TestTurnEndsWhenAssistantEmitsNoToolCalls pins the turn-end contract: a final assistant message with no tool calls returns to phaseIdle and hands cont
internal/tui/tui_test.go:1124
Function
TestTwoChipsTrackedIndependently
TestTwoChipsTrackedIndependently: two pastes make two chips; deleting the first leaves the second intact with its span shifted left.
internal/tui/prompt_test.go:174
Function
TestTypingIntoChipInteriorKeepsContent
TestTypingIntoChipInteriorKeepsContent: typing a rune while the cursor sits inside a chip label, when two chips share an identical label, must not spl
internal/tui/prompt_test.go:518
Function
TestTypingOverflowKeepsCursorVisible
TestTypingOverflowKeepsCursorVisible: once content overflows maxTextareaHeight, pre-grow must NOT pin the viewport to the top: that would scroll the c
internal/tui/prompt_typing_test.go:49
Function
TestTypingPreservesEarlyContent
TestTypingPreservesEarlyContent: a marker at the START of a line that wraps to many rows must stay visible in the textarea View. Guards a scroll bug:
internal/tui/prompt_typing_test.go:33
Function
TestTypingShiftsSpans
TestTypingShiftsSpans: typing before a chip shifts its span right by one; reconcile tracks it automatically.
internal/tui/prompt_test.go:274
Function
TestURLOverrideDoesNotPersist
TestURLOverrideDoesNotPersist: a CODEHAMR_URL override lives in cfg.URLOverride and ActiveURL reflects it, but Save writes only the stored URL, so re-
internal/config/config_test.go:721
Function
TestUnqueueOnlyWhenTextareaEmpty
TestUnqueueOnlyWhenTextareaEmpty: with a draft already in the textarea, Backspace must delete a character as usual and leave the queued slot untouched
internal/tui/queue_test.go:263
Function
TestUnqueueRestoresToTextarea
TestUnqueueRestoresToTextarea: Backspace on an empty prompt while a turn runs pulls the queued prompt back into the textarea and clears the slot, a re
internal/tui/queue_test.go:244
Function
TestValueExpandsAllChips
TestValueExpandsAllChips: Value() interleaves surrounding text with full paste contents in order.
internal/tui/prompt_test.go:256
Function
TestVerboseLogCapturesTurnRecords
TestVerboseLogCapturesTurnRecords drives a realistic two-round turn (reasoning → bash tool call → final answer) with logging on, and asserts the verbo
internal/tui/tui_test.go:701
Function
TestVerifyNudgeEndToEndRePromptsThenFinishes
TestVerifyNudgeEndToEndRePromptsThenFinishes drives a full turn that does real work (8 bash rounds) then "finishes" with a confident summary. The fini
internal/tui/tui_test.go:2179
Function
TestVerifyNudgeFiresOnceAtMinRounds
TestVerifyNudgeFiresOnceAtMinRounds: the finish re-grounding nudge trips one soft system note only once a turn has done real work (toolRounds >= verif
internal/tui/tui_test.go:2024
Function
TestVerifyNudgeRePromptsSubstantialCleanFinish
TestVerifyNudgeRePromptsSubstantialCleanFinish: a substantial turn ending with a clean, non-empty summary must be re-prompted once (phase back to thin
internal/tui/tui_test.go:2071
Function
TestVerifyNudgeSkipsHonestUnverifiedFinish
TestVerifyNudgeSkipsHonestUnverifiedFinish: a substantial turn whose summary already marks something `unverified` has done the honest self-assessment
internal/tui/tui_test.go:2150
Function
TestVerifyNudgeSkipsTrivialTurn
TestVerifyNudgeSkipsTrivialTurn: a turn that did little work (toolRounds below the gate) must finish normally (finalized, no re-prompt, no system note
internal/tui/tui_test.go:2099
Function
TestVerifyNudgeYieldsToEmptyReply
TestVerifyNudgeYieldsToEmptyReply: an empty newest assistant message is the empty-reply nudge's domain even on a substantial turn: the verify nudge mu
internal/tui/tui_test.go:2124
Function
TestViewHandlesZeroWidth
TestViewHandlesZeroWidth reproduces the "shrunk UI" startup flash: before WindowSizeMsg arrives, View must not panic or emit garbled layout.
internal/tui/tui_test.go:1380
Function
TestVisualPromptLinesSumsAcrossLogicalLines
TestVisualPromptLinesSumsAcrossLogicalLines: visualPromptLines splits on newlines and sums wrapRows for each segment: the prompt field grows to hold t
internal/tui/tui_test.go:2357
Function
TestWidenResizeAlsoSuppresses
TestWidenResizeAlsoSuppresses: widening changes the splash layout (text→art at the wordmark threshold) and leaves narrow rows misplaced, so it takes t
internal/tui/resize_test.go:182
Function
TestWidthChangeSuppressesView
TestWidthChangeSuppressesView: any width change (narrow OR widen) flips suppressView so nothing commits between SIGWINCH and the settle. View() return
internal/tui/resize_test.go:60
← previous
next →
501–600 of 622, ranked by callers