MCPcopy Create free account

hub / github.com/codehamr/codehamr / functions

Functions622 in github.com/codehamr/codehamr

FunctionTestHamrpassRejectsTooShort
TestHamrpassRejectsTooShort: a key under hamrpassMinKeyLen is refused without touching the profile or the active selection.
internal/tui/tui_test.go:3025
FunctionTestHamrpassSetsKeyAndActivates
TestHamrpassSetsKeyAndActivates: a valid key is trimmed, saved on the hamrpass profile, persisted, and active flips to hamrpass. The llm client is reb
internal/tui/tui_test.go:2956
FunctionTestHandleProbeSuccessUpdatesLiveCtxAndPrintsActivation
TestHandleProbeSuccessUpdatesLiveCtxAndPrintsActivation: a successful probeMsg writes the live context window into liveContextSize (per profile) and p
internal/tui/tui_test.go:1210
FunctionTestHandleStreamClosedEndsTurnWithNoPending
TestHandleStreamClosedEndsTurnWithNoPending: handleStreamClosed with an empty pending queue finalizes the turn, returns to idle, and returns no follow
internal/tui/tui_test.go:1158
FunctionTestHandleStreamClosedSkipsAdvanceAfterCancel
TestHandleStreamClosedSkipsAdvanceAfterCancel: after Ctrl+C leaves phase=idle, the deferred streamClosedMsg must not auto-restart a turn (the agent re
internal/tui/tui_test.go:2570
FunctionTestHandleStreamDrainsAfterCancel
TestHandleStreamDrainsAfterCancel: buffered stream events can arrive after Ctrl+C returned phase to idle. Processing them would write ghost tokens, re
internal/tui/tui_test.go:2545
FunctionTestHeadTailBufferKeepsExactHeadAndTail
TestHeadTailBufferKeepsExactHeadAndTail: once the middle is dropped, the reassembly must carry exactly the first head-cap bytes and the last tail-cap
internal/tools/bash_test.go:86
FunctionTestHeadTailBufferSmallOutputUntouched
TestHeadTailBufferSmallOutputUntouched: output under the head cap must come back byte-identical - the bounding must be invisible in the normal case.
internal/tools/bash_test.go:74
FunctionTestHeightOnlyResizeDoesNotClear
TestHeightOnlyResizeDoesNotClear: a height-only change can't induce the soft-wrap that breaks bubbletea's cursor math (no line widens), so the hardeni
internal/tui/resize_test.go:202
FunctionTestHistoryDownRestoresUnsentDraft
TestHistoryDownRestoresUnsentDraft: an unsent draft survives a ↑ into history and is restored when ↓ walks back to the live line.
internal/tui/tui_test.go:524
FunctionTestHistoryPushesOnSubmit
TestHistoryPushesOnSubmit: successful submit appends to promptHistory and resets the walker index to -1.
internal/tui/tui_test.go:542
FunctionTestHistoryUpDownReplayLastSubmission
TestHistoryUpDownReplayLastSubmission: ↑ on first-line replaces textarea with the most recent submitted line; ↓ steps back toward the draft.
internal/tui/tui_test.go:491
FunctionTestHumanIntFormat
TestHumanIntFormat: thin-comma formatting must handle the edge cases the activation line cares about: single digits, exact 4-digit, exact powers, and
internal/tui/tui_test.go:1546
FunctionTestHumanRateFormat
TestHumanRateFormat: throughput as `N tok/s`. Degenerate inputs (zero tokens or zero elapsed) collapse to "" so the banner omits the segment. Sub-10 t
internal/tui/tui_test.go:1630
FunctionTestHumanTokensFormat
TestHumanTokensFormat: the session counter renders compactly: plain int under 1000, then `k`/`M` with a constant single decimal. The decimal is always
internal/tui/tui_test.go:1569
FunctionTestIdleTimeoutFromEnv
TestIdleTimeoutFromEnv pins the CODEHAMR_IDLE_TIMEOUT contract: a Go duration or bare-seconds string wins, anything else (unset, garbage, non-positive
internal/llm/llm_test.go:830
FunctionTestInlineStatusBash
(t *testing.T)
internal/tools/bash_test.go:250
FunctionTestInlineStatusEditFile
(t *testing.T)
internal/tools/edit_test.go:205
FunctionTestInlineStatusGeneric
(t *testing.T)
internal/tools/bash_test.go:258
FunctionTestInlineStatusReadFile
(t *testing.T)
internal/tools/read_test.go:106
FunctionTestInlineStatusRuneBoundaryTruncate
TestInlineStatusRuneBoundaryTruncate: truncating a long non-ASCII command at a fixed byte offset can split a multi-byte rune, leaving an orphan contin
internal/tools/bash_test.go:270
FunctionTestInlineStatusWriteFile
(t *testing.T)
internal/tools/write_test.go:168
FunctionTestIsLocalBuild
TestIsLocalBuild pins the contract: `go run` ("dev"), dirty-tree builds, clean-tree builds past the last tag (git describe shape), and tag-less clones
cmd/codehamr/main_test.go:14
FunctionTestLargePasteBecomesChip
TestLargePasteBecomesChip: a ≥pasteChipMinLines paste collapses to one chip. DisplayValue shows the label, Value expands back to the original.
internal/tui/prompt_test.go:74
FunctionTestLeftArrowAtChipEndJumpsToStart
TestLeftArrowAtChipEndJumpsToStart: ← jumps the cursor across the whole chip in one keystroke; it never lands on interior positions.
internal/tui/prompt_test.go:133
FunctionTestLiveElapsed
TestLiveElapsed: the running wall-clock readout, whole seconds under a minute (no spinning sub-second decimal at the spinner's refresh rate), then `6m
internal/tui/tui_test.go:1600
FunctionTestLongSingleLinePasteChipsByCharCount
TestLongSingleLinePasteChipsByCharCount: a long single-line blob (zero newlines) still collapses: char threshold catches minified JSON and one-line st
internal/tui/prompt_test.go:457
FunctionTestMessageTokensCountsToolCallArguments
TestMessageTokensCountsToolCallArguments pins ToolCall.Arguments accounting in Message.Tokens: it feeds the budget on every tool-using turn, yet no ot
internal/ctx/ctx_test.go:45
FunctionTestModelBracketedPasteCreatesChip
TestModelBracketedPasteCreatesChip checks a bracketed-paste KeyMsg through Model.Update reaches promptInput.Update and yields a chip, guarding against
internal/tui/paste_integration_test.go:14
FunctionTestMultiToolCallRoundExecutesAllBeforeNextChat
TestMultiToolCallRoundExecutesAllBeforeNextChat: when the model emits multiple tool calls in one round, EVERY result must be appended to history BEFOR
internal/tui/tui_test.go:3107
FunctionTestNewHasNoHTTPTimeout
TestNewHasNoHTTPTimeout pins that the streaming Client must NOT set http.Client.Timeout: that field is end-to-end (it covers body reads) and would abo
internal/llm/llm_test.go:819
FunctionTestNewestAssistantEmpty
TestNewestAssistantEmpty pins the anomaly detector behind the empty-reply nudge: only a newest assistant message with neither text nor a structured to
internal/tui/tui_test.go:3202
FunctionTestNonCtrlCKeypressResetsArming
TestNonCtrlCKeypressResetsArming: once arming is live, pressing anything other than Ctrl+C clears the arm so the next idle Ctrl+C re-arms cleanly (no
internal/tui/tui_test.go:215
FunctionTestPackAlwaysKeepsNewest
(t *testing.T)
internal/ctx/ctx_test.go:114
FunctionTestPackAnchorsTaskEvenWithSystemNudge
TestPackAnchorsTaskEvenWithSystemNudge: a long single turn evicts the sole user task, and a nudge (system) is the newest message. The system→user demo
internal/ctx/ctx_test.go:570
FunctionTestPackAnchorsUserTaskOverBudget
TestPackAnchorsUserTaskOverBudget: a long single turn (one small task message, then many large assistant rounds that fill the budget) would let the ne
internal/ctx/ctx_test.go:483
FunctionTestPackDemotesSystemNudgeToUser
TestPackDemotesSystemNudgeToUser: the four soft-nudge backstops append a system-role note to history. buildMessages prepends the embedded system promp
internal/ctx/ctx_test.go:547
FunctionTestPackDropsDanglingAssistantDespiteIDReuse
TestPackDropsDanglingAssistantDespiteIDReuse: pairing is positional, not a global ID lookup. Local backends commonly reuse index-derived IDs ("call_0"
internal/ctx/ctx_test.go:333
FunctionTestPackDropsDanglingAssistantToolCalls
TestPackDropsDanglingAssistantToolCalls: a turn cancelled mid-tool leaves an assistant.tool_calls in history with no answering tool message (the TUI a
internal/ctx/ctx_test.go:285
FunctionTestPackDropsDanglingPartialParallelGroup
TestPackDropsDanglingPartialParallelGroup: cancelling a parallel round after only some results return leaves assistant(c1,c2)+tool(c1). The assistant
internal/ctx/ctx_test.go:308
FunctionTestPackDropsEmptyIDToolMessages
TestPackDropsEmptyIDToolMessages: an empty-ID tool_call must not let subsequent empty-ToolCallID tool messages ride through as "paired". An unidentifi
internal/ctx/ctx_test.go:156
FunctionTestPackDropsOrphanToolMessage
TestPackDropsOrphanToolMessage: if budget-trimming cuts the assistant whose tool_calls spawned a tool message, that orphan must be dropped, else OpenA
internal/ctx/ctx_test.go:132
FunctionTestPackDropsStrayToolResultDespiteIDReuse
TestPackDropsStrayToolResultDespiteIDReuse: dropOrphanTools is positional too. A stray tool result whose own (dangling, dropped) assistant reused an o
internal/ctx/ctx_test.go:435
FunctionTestPackKeepsFullyAnsweredToolCalls
TestPackKeepsFullyAnsweredToolCalls: don't over-reach. An assistant whose every tool_call is answered (including parallel) must survive intact.
internal/ctx/ctx_test.go:463
FunctionTestPackKeepsNewestParallelToolGroupOverBudget
TestPackKeepsNewestParallelToolGroupOverBudget: with parallel tool calls the tail is [assistant(c1,c2), tool(c1), tool(c2)], so the newest tool's owne
internal/ctx/ctx_test.go:224
FunctionTestPackKeepsNewestToolPairOverBudget
TestPackKeepsNewestToolPairOverBudget: when the newest message is a tool result and its owning assistant won't fit the budget, Pack must keep the pair
internal/ctx/ctx_test.go:193
FunctionTestPackKeepsPairedToolMessage
TestPackKeepsPairedToolMessage: a healthy assistant+tool pair that fits the budget stays intact: don't regress into dropping good pairs.
internal/ctx/ctx_test.go:176
FunctionTestPackNewestFirstWhole
(t *testing.T)
internal/ctx/ctx_test.go:93
FunctionTestPackNoStaleAnchorWhenRecentUserSurvives
TestPackNoStaleAnchorWhenRecentUserSurvives: in a normal multi-turn chat a recent user message already survives the walk, so Pack must NOT also drag t
internal/ctx/ctx_test.go:511
FunctionTestPackRecoversNewestToolGroupPastEmptyAssistantTail
TestPackRecoversNewestToolGroupPastEmptyAssistantTail: the stall shape the empty-reply nudge answers appends an EMPTY assistant message, then the nudg
internal/ctx/ctx_test.go:404
FunctionTestPackRecoversNewestToolGroupPastTrailingNudge
TestPackRecoversNewestToolGroupPastTrailingNudge: the over-budget recovery for the newest tool exchange must fire even when a failure/runaway nudge wa
internal/ctx/ctx_test.go:365
FunctionTestPackRecoveryDropsPartialParallelGroup
TestPackRecoveryDropsPartialParallelGroup: the empty-recovery path (newest is a tool result whose owner fell past a tight budget) must not resurrect a
internal/ctx/ctx_test.go:259
FunctionTestPageKeysMoveCursorByHeight
TestPageKeysMoveCursorByHeight: PgUp/PgDn move the cursor by one prompt-height. bubbles/textarea ships an empty viewport keymap, so without our handli
internal/tui/prompt_test.go:373
FunctionTestPasteIntoChipInteriorKeepsBothPastes
TestPasteIntoChipInteriorKeepsBothPastes: a paste while the cursor sits inside an existing chip's label must not splice the new label into the old one
internal/tui/prompt_test.go:491
FunctionTestPasteWithoutFlagButWithNewlineStillChips
TestPasteWithoutFlagButWithNewlineStillChips: some terminals omit the bracketed-paste flag, yet multi-line content in one KeyMsg can't come from typin
internal/tui/prompt_test.go:441
FunctionTestPlaceholderMentionsTab
TestPlaceholderMentionsTab: placeholder names both "/" and "Tab" as entry points into the popover, so new users discover either way.
internal/tui/tui_test.go:129
FunctionTestPopoverArrowKeysMoveSelection
TestPopoverArrowKeysMoveSelection: while popover is open, ↑/↓ move the selection (NOT arrow history), and the textarea is not clobbered.
internal/tui/tui_test.go:397
FunctionTestPopoverClosesWhenPrefixMatchesNothing
TestPopoverClosesWhenPrefixMatchesNothing: typing a prefix that no command satisfies closes the popover automatically (no empty frame).
internal/tui/tui_test.go:268
FunctionTestPopoverEnterAdvancesIntoArgsForArgsCommand
TestPopoverEnterAdvancesIntoArgsForArgsCommand: Enter at command-level on a command that takes args does NOT submit: it opens the arg-level popover, s
internal/tui/tui_test.go:416
FunctionTestPopoverEnterSubmitsNoArgCommand
TestPopoverEnterSubmitsNoArgCommand: Enter at command-level on a command without args still submits immediately (/clear).
internal/tui/tui_test.go:439
FunctionTestPopoverRenderHasNoMarker
TestPopoverRenderHasNoMarker: no row in the rendered popover is prefixed with the old `▸ ` arrow or a 2-space marker. Selection is a colour change, no
internal/tui/tui_test.go:2771
FunctionTestPopoverRenderRightAligns
TestPopoverRenderRightAligns: each row ends flush with the popover width (== m.width after ANSI stripping). The value starts at column 0 and the descr
internal/tui/tui_test.go:2889
FunctionTestPopoverSelectionStaysVisible
TestPopoverSelectionStaysVisible: with more than popoverCap suggestions the popover renders a window; when the selection moves past it, renderPopover
internal/tui/tui_test.go:2785
FunctionTestPopoverShiftTabCyclesUp
TestPopoverShiftTabCyclesUp: Shift+Tab walks the selection backwards, wrapping at the top.
internal/tui/tui_test.go:361
FunctionTestPopoverTabCompletesUniquePrefix
TestPopoverTabCompletesUniquePrefix: with one match, Tab completes the name and, because /models takes args, appends a space that flips the popover in
internal/tui/tui_test.go:328
FunctionTestPopoverTabCyclesSelection
TestPopoverTabCyclesSelection: Tab moves the selection to the next row without touching the textarea, zsh-style cycling.
internal/tui/tui_test.go:278
FunctionTestPopoverTabOnClearCommandHasNoArgSpace
TestPopoverTabOnClearCommandHasNoArgSpace: /clear takes no args, so Tab completes to "/clear" WITHOUT a trailing space.
internal/tui/tui_test.go:347
FunctionTestPopoverTabOnEmptyOpensCommandList
TestPopoverTabOnEmptyOpensCommandList: Tab on an empty textarea is equivalent to typing "/": it opens the popover with the full command list. Subseque
internal/tui/tui_test.go:301
FunctionTestPopoverTriggersOnSlash
TestPopoverTriggersOnSlash: typing / into an empty textarea opens the popover with every command; typing more characters filters by prefix.
internal/tui/tui_test.go:249
FunctionTestPrintHelpListsAllCommands
TestPrintHelpListsAllCommands: tui.PrintHelp formats every command in the central slice. Guards against a command being added to runSlash dispatch but
internal/tui/tui_test.go:581
FunctionTestProbeBudgetExhaustedUpdatesStatusBar
TestProbeBudgetExhaustedUpdatesStatusBar: a 402 probe carries a BudgetStatus{Set:true, Remaining:0} snapshot. handleProbe must apply it to m.budget so
internal/tui/tui_test.go:1301
FunctionTestProbeBudgetSnapshotIgnoredForStaleProfile
TestProbeBudgetSnapshotIgnoredForStaleProfile: a budget snapshot from a probe that lost the /models race (msg.profile != m.cfg.Active) must not overwr
internal/tui/tui_test.go:1323
FunctionTestProbeChatNoReasoningEffortIsRaceFree
TestProbeChatNoReasoningEffortIsRaceFree pins the atomic.Bool guard on Client.noReasoningEffort. The startup probe and the first chat can run on the s
internal/llm/llm_test.go:697
FunctionTestProbeForVanishedProfileLeavesNoOrphanMapEntry
TestProbeForVanishedProfileLeavesNoOrphanMapEntry: probeMsg must check the targeted profile still exists before writing liveContextSize, or rapid /mod
internal/tui/tui_test.go:1233
FunctionTestPromptAutoGrowsWithContent
TestPromptAutoGrowsWithContent: the textarea starts at 1 line, grows with newlines, and clamps to height - minViewport - 2 - popover, so big pastes us
internal/tui/tui_test.go:2388
FunctionTestPromptGrowsOnWrappedLongLine
TestPromptGrowsOnWrappedLongLine: a long paragraph typed without Enter has LineCount()==1, so relying on it sticks the textarea at 1 row while text wr
internal/tui/tui_test.go:2374
FunctionTestPromptHistoryCap
TestPromptHistoryCap: exceeding historyMaxEntries drops the oldest, not the newest, otherwise the file grows unbounded.
internal/tui/history_store_test.go:38
FunctionTestPromptHistoryClear
TestPromptHistoryClear: clearPromptHistory removes the file; a missing file is not an error. Mirrors /clear semantics.
internal/tui/history_store_test.go:73
FunctionTestPromptHistoryConcurrentAppendsKeepBoth
TestPromptHistoryConcurrentAppendsKeepBoth guards the load-then-rewrite race: two instances sharing a project dir would each read N entries and overwr
internal/tui/history_store_test.go:109
FunctionTestPromptHistoryCorruptLineSkipped
TestPromptHistoryCorruptLineSkipped: a malformed line (users may hand-edit the file) must not poison the valid entries around it.
internal/tui/history_store_test.go:92
FunctionTestPromptHistoryQuotedLineStaysLoadable
TestPromptHistoryQuotedLineStaysLoadable guards the quote-expansion gap: strconv.Quote expands each control/invalid byte to \xNN (4× growth), so a val
internal/tui/history_store_test.go:153
FunctionTestPromptHistoryRejectsHugeEntry
TestPromptHistoryRejectsHugeEntry: a multi-MiB paste isn't stored, the load scanner would silently drop it anyway, so declining to write is consistent
internal/tui/history_store_test.go:178
FunctionTestPromptHistoryRoundTrip
TestPromptHistoryRoundTrip: values with newlines/quotes/unicode survive a disk round-trip in append order, the on-disk format must carry any byte the
internal/tui/history_store_test.go:14
FunctionTestPromptHistorySkipEmpty
TestPromptHistorySkipEmpty: empty submits never reach the file, so a stray ↵ can't pollute recall with blanks.
internal/tui/history_store_test.go:58
FunctionTestPromptShrinksAfterSubmit
TestPromptShrinksAfterSubmit: after Enter submits a multi-line prompt the textarea resets to empty and the height snaps back to 1 line.
internal/tui/tui_test.go:2413
FunctionTestPublishedManifestMatchesAssetName
TestPublishedManifestMatchesAssetName is opt-in: point CODEHAMR_CHECK_MANIFEST at a goreleaser checksums file (CI sets it to dist/codehamr_checksums.t
internal/update/drift_test.go:109
FunctionTestQueueAutoFireUnitFromStreamClosed
TestQueueAutoFireUnitFromStreamClosed: a clean, trivial finish with a prompt queued must submit it from handleStreamClosed: phase back to thinking, a
internal/tui/queue_test.go:343
FunctionTestQueueAutoSubmitsAfterTurn
TestQueueAutoSubmitsAfterTurn drives a full turn with a prompt queued mid-flight and asserts the queued prompt auto-fires a second request when the tu
internal/tui/queue_test.go:127
FunctionTestQueueEmptyMidTurnIsNoOp
TestQueueEmptyMidTurnIsNoOp: Enter on a blank prompt mid-turn stays silent, so a reflexive Enter while watching the agent doesn't queue an empty slot.
internal/tui/queue_test.go:48
FunctionTestQueueExpandsChipsOnFire
TestQueueExpandsChipsOnFire: a chip-bearing paste queued mid-turn keeps its expanded content for the LLM (send) while the box echo stays collapsed, th
internal/tui/queue_test.go:316
FunctionTestQueueRefusesSlashMix
TestQueueRefusesSlashMix: a slash command never newline-joins with a queued prompt, in either order. Joined slash-first, the whole slot would fire as
internal/tui/queue_test.go:87
FunctionTestQueueRestoreKeepsExistingDraft
TestQueueRestoreKeepsExistingDraft: if the user was typing a new prompt when they Ctrl+C, that draft wins; the queued prompt is dropped rather than cl
internal/tui/queue_test.go:191
FunctionTestQueueRestoredOnCtrlC
TestQueueRestoredOnCtrlC: a Ctrl+C abort never fires the queued prompt (the user took back control); it returns the text to the textarea as an editabl
internal/tui/queue_test.go:166
FunctionTestQueueSecondEnterAppends
TestQueueSecondEnterAppends: a second mid-turn Enter appends (newline-joined) to the existing slot, so a multi-part instruction builds up in one queue
internal/tui/queue_test.go:63
FunctionTestQueueStoresPromptMidTurn
TestQueueStoresPromptMidTurn: Enter while a turn is running stashes the typed prompt in the queue slot and clears the textarea, instead of the old sil
internal/tui/queue_test.go:20
FunctionTestQueueWaitsForVerifyNudge
TestQueueWaitsForVerifyNudge: a substantial clean finish triggers the verify re-grounding nudge, which continues the turn. The queued prompt must NOT
internal/tui/queue_test.go:214
FunctionTestQueuedPromptRendersInView
TestQueuedPromptRendersInView: while something is queued the prompt area shows a labeled box with the echo text, so the user can see what will auto-su
internal/tui/queue_test.go:294
FunctionTestReachableHitsV1Models
TestReachableHitsV1Models pins the heartbeat path: /v1/models, the OpenAI-standard listing endpoint every backend serves. Probing GET / instead could
internal/cloud/cloud_test.go:14
FunctionTestReachableTreatsNon2xxAsReachable
TestReachableTreatsNon2xxAsReachable: any HTTP response counts as reachable (even 404/401); only transport errors and timeouts mean down.
internal/cloud/cloud_test.go:34
FunctionTestReadFileEmptyPath
(t *testing.T)
internal/tools/read_test.go:26
← previousnext →401–500 of 622, ranked by callers