mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 00:03:20 +00:00
fix(review): trim comments to AGENTS.md's one/two-line why-only rule
Comments in mobile-diff-image-preview.ts and mobile-file-tab-doc.ts ran 3-6 lines and narrated mechanism instead of stating only the non-obvious reason, per AGENTS.md's "Code Comments: Document the Why, Briefly" rule. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import { buildImageDataUri } from '../../../src/shared/image-data-uri'
|
||||
|
||||
// A git.diff result for a binary file. The host (git.diff) already sends base64
|
||||
// image bytes plus isImage/mimeType for previewable formats, so mobile can render
|
||||
// image diffs instead of falling back to "Binary preview unavailable". The
|
||||
// originalIsBinary/modifiedIsBinary flags tell a deletion (modified side absent)
|
||||
// apart from a modify whose bytes the host couldn't inline (relay/size-capped).
|
||||
// originalIsBinary/modifiedIsBinary distinguish a genuine deletion from a modify
|
||||
// whose bytes the host couldn't inline (relay/size-capped).
|
||||
export type MobileBinaryDiffResult = {
|
||||
kind: 'binary'
|
||||
originalContent?: string
|
||||
@@ -15,12 +12,8 @@ export type MobileBinaryDiffResult = {
|
||||
mimeType?: string
|
||||
}
|
||||
|
||||
// Builds a data URI for a binary image diff, preferring the modified (post-change)
|
||||
// bytes. Only falls back to the original for a genuine deletion — when the modified
|
||||
// side is absent (not binary). Returns null for non-previewable binaries and when
|
||||
// the modified side IS a binary image but arrives empty (e.g. a relay working-tree
|
||||
// read or a >size-cap file), since showing the pre-change image there would be
|
||||
// silently stale rather than the current content.
|
||||
// Falls back to the original bytes only for a genuine deletion; a size-capped/relay
|
||||
// modify returns null instead of the stale pre-change image.
|
||||
export function mobileDiffImageDataUri(result: MobileBinaryDiffResult): string | null {
|
||||
if (result.isImage !== true) {
|
||||
return null
|
||||
|
||||
@@ -21,9 +21,8 @@ export type MobileFileTabDocRequest = {
|
||||
diffSource?: 'staged' | 'unstaged' | 'branch' | 'commit'
|
||||
}
|
||||
|
||||
// Loads the previewable doc for a session file tab: git diffs (text or image),
|
||||
// previewable images, HTML source, or plain text. Throws 'binary_file',
|
||||
// 'file_too_large', or the RPC error message; callers map those to error docs.
|
||||
// Throws 'binary_file'/'file_too_large'/the RPC error message; callers map those
|
||||
// to error docs.
|
||||
export async function resolveMobileFileTabDoc(
|
||||
client: FileTabDocClient,
|
||||
request: MobileFileTabDocRequest
|
||||
|
||||
Reference in New Issue
Block a user