WEB-4809: Go rewrite of unbound-hook (scaffold + shared core + claude-code port)#134
Draft
pugazhendhi-m wants to merge 1 commit into
Draft
WEB-4809: Go rewrite of unbound-hook (scaffold + shared core + claude-code port)#134pugazhendhi-m wants to merge 1 commit into
pugazhendhi-m wants to merge 1 commit into
Conversation
…code port
- go/ module (stdlib-only): CLI dispatcher mirroring binary/src/unbound_hook
(hook|setup|backfill|clear|--version), fail-open {} semantics preserved
- shared core: pyjson (byte-parity json.dumps), config, httpc (curl subprocess),
report, audit, locks, transcript — each doc-commented with mirrored python lines
- claude-code hook fully ported: all 6 events, policy cache, approval retry,
discovery/mcp-scan dispatch (local binary only), device serial, identity
- selfupdate package stubbed (full binary-swap port is next phase)
- build.sh: 2x go build + lipo -create universal2, smoke
- parity harness: opt-in via UNBOUND_GO_BINARY in binary/tests; 26/30 green
(4 codex cases pending — codex still stub); python suite zero regression
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Executes E7-2 from WEB-4799: PyInstaller binaries structurally look like packers (bootloader unpacking an embedded interpreter + bytecode at runtime) — the exact pattern EDR behavioral engines hunt. A Go binary is plain statically-linked machine code: it never exhibits the packed-loader behavior, so it clears EDRs without Team-ID allowlist babysitting. Bonus: ~5ms startup vs ~100ms PyInstaller warm.
Does NOT touch the Salesloft PyInstaller v1 rollout — strictly additive (
go/dir + opt-in test param). Ships later asruntime-v2.x.Linear: WEB-4809
Guiding rule
Mimic exactly what
unbound.py/setup.pydo. Python is the golden reference; quirks copied verbatim. Parity is CI-enforceable:UNBOUND_GO_BINARY=<path> pytest binary/tests/test_hook_cli.py -k go_binarycompares stdout + exit code againstpython3 <tool>/unbound.pyfor every tool × event.What's in this PR
go/module (stdlib-only, zero deps): CLI dispatcher mirroringbinary/src/unbound_hook—hook <tool> [<event>]|setup|backfill|clear|--version; fail-open dispatch ({"suppressOutput": true}+ exit 0 on any fault)go/internal/):pyjson(byte-parityjson.dumps— separators, ensure_ascii, float repr, ordered keys; verified against real python on edge-case corpora),config,httpc(curl-subprocess, Zscaler house rule),report,audit,locks,transcript— each doc-commented with the python lines it mirrorsSetsidspawn), device-serial/identity cache, account identityselfupdatepackage stubbed — full python-mimic binary-swap port (2h cadence,.self_update_check/.self_update.lock, managed-location skip) is the next phasego/build.sh: 2×go build+lipo -createuniversal2 + smoke, mirroringbinary/build.shgatesVerification
go test ./...— all packages green; gofmt + go vet clean./build.sh— universal2 assert + smoke passRemaining (next phases, tracked in WEB-4809)
runtime-v2.0.0🤖 Generated with Claude Code