sc_router: Missing pre-push hook for BLAKE3 LFS uploads
Summary
sc_router's LFS implementation uses BLAKE3 hashing instead of SHA-256 for performance. However, the standard git lfs push command cannot recognize BLAKE3 OIDs (blake3:... instead of sha256:...), which means LFS objects are never uploaded to S3.
Root Cause
- sc_router's clean filter creates LFS pointers with
oid blake3:... - Standard git-lfs client only recognizes
oid sha256:... - When
git lfs pushscans commits for LFS objects, it finds nothing to upload - The transfer agent is never invoked for uploads
Required Solution
Implement a custom pre-push hook (sc_router-pre-push) that:
- Scans the commits being pushed for BLAKE3 LFS pointers
- Collects OIDs that need to be uploaded
- Calls the LFS server batch API to get presigned upload URLs
- Invokes the transfer agent (or uploads directly) to S3
Architecture Reference
From docs/lfs_spec_v4.md:
- "The standard Git LFS pre-push hook (installed via
git lfs install) is mandatory for all Git LFS implementations" - "It triggers the LFS client during uploads, which then utilizes the custom transfer agent's multiplexed pipe for parallel data transfer"
Since sc_router uses BLAKE3, we cannot rely on the standard git-lfs pre-push hook - we need our own.
Files to Create
cmd/sc_router-pre-push/main.go- Pre-push hook binaryinternal/filters/prepush/prepush.go- Core implementationinternal/filters/prepush/prepush_test.go- Unit tests
Integration with repo_setup
The sc_router repo_setup command must install the pre-push hook alongside the existing post-checkout hook:
.git/hooks/pre-push -> /path/to/sc_router-pre-push
Testing
The S3 integration test (internal/integration/s3/s3_integration_test.go) currently fails because git lfs push doesn't upload BLAKE3 objects. Once the pre-push hook is implemented, git push will trigger it automatically.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗