* feat(go): recover bounded Go string literals from (ptr, len) headers * fix(go): deduplicate header scan spans, bound rejected cache, and reject Cf * fix(go): allow U+200C ZWNJ and U+200D ZWJ in Go string literal recovery * fix(go): index Mach-O load regions, validate MCP schema, and add feature specs * test(go): cover Mach-O region-index cancellation and load-region boundaries
2.2 KiB
Implementation plan
Boundary and contract
Extend goBinarySchema in src/domain/go/goBinary.ts with optional
string_literals (evidence_kind: "inferred", items, discovered_count,
aggregate_bytes, max_items, truncated), plus include_string_literals and
max_string_literals on src/contracts/go/goToolContracts.ts and
src/cli/goCommands.ts. Add the string_literals view projection to
src/domain/analysisView/goBinaryView.ts so callers can page recovered literals
from retained Evidence without repeating file parsing.
Implement recoverGoStringLiterals in src/go/GoStringLiterals.ts on top of
BinaryContainer and createFileMappingIndex. Pre-index readable LoadRegion
intervals once in O(R log R) so Mach-O section eligibility runs in O(log R)
with periodic checkActive cancellation checks. Normalize header-scan spans by
pointer alignment phase, merge overlaps, and sort by ascending file offset so
reference_count counts each physical header once and first_header_offset is
minimal. Deduplicate target slices in memory with bounded candidate and rejection
caches before sorting deterministically by (location.offset, location.bytes).
Incremental work and validation
- Define domain/MCP/CLI schemas, limitation notes and
string_literalsanalysis view behavior while preserving default omission when not requested. - Implement
recoverGoStringLiteralsand wireGoBinaryImage,GoBinaryProviderandGoBinaryServicewith cooperative cancellation. - Add unit fixtures across ELF/PE/Mach-O, Unicode format-control filtering, budget/cap truncation, overlapping ELF spans, bounded negative caching and 25,000-section Mach-O indexing/cancellation.
- Extend
scripts/verify-go-binary.mjsviaartifactMcpCallso real compiled Go targets verify both CLI and advertised MCPoutputSchemaparity. - Update the Go binary guide, skill guidance, generated catalogs and documentation route checks.
Effects and compatibility
Default inspect_go_binary calls omit string_literals and preserve historical
Evidence compatibility. No external tool or target execution is introduced; only
bounded offline byte slicing over the already read 64 MiB image buffer runs.