Skip to content

feat(verity-go): add Go fs-verity implementation and metadata package#117

Open
imlk0 wants to merge 14 commits into
masterfrom
write-in-go
Open

feat(verity-go): add Go fs-verity implementation and metadata package#117
imlk0 wants to merge 14 commits into
masterfrom
write-in-go

Conversation

@imlk0
Copy link
Copy Markdown
Collaborator

@imlk0 imlk0 commented May 12, 2026

Summary

  • Scaffold the verity-go/ Go module with fs-verity core types (FsVerityDescriptor, HashAlgorithm, FsVerityDigest, MerkleTree)
  • Add metadata package: FlatBuffers serialization/deserialization of directory integrity metadata, including CalculateMetadataHash, SerializeMetadata, DeserializeMetadata, and per-file VerifySelf
  • Add metadata hash module (metadata_hash.fbs / CalculateMetadataHash) matching the Rust schema
  • Regenerate FlatBuffers code from updated schema via symlinked .fbs files
  • Rewrite tests into two clean categories:
    • Algorithm-level (verity/golden_test.go): exec make_testfiles.py, compare Go-computed descriptor hashes against 13 hardcoded Rust reference values
    • Interop (metadata/interop_test.go): load testdata/rust.metadata.fb fixture generated by Rust CLI, verify deserialization, labels, hashes, and per-file block-level recalculation
  • Add CI go-test job (race detector, all packages) with fixture drift detection step
  • Add interop-test Makefile target
  • Add bilingual README (README.md / README_CN.md) with usage examples
  • Add testfiles/ to .gitignore

Test plan

  • cd verity-go && go test -race -v ./...
  • make interop-test (requires Rust + Go)
  • make check-fbs (FlatBuffers schema sync)
  • CI go-test job passes (including fixture verification step)

🤖 Generated with Claude Code

imlk0 added 14 commits May 12, 2026 15:10
These methods are needed by the metadata package to calculate
descriptor hashes and rebuild root hashes.
Implements SerializeMetadata, DeserializeMetadata, VerifySelf,
CalculateFsVerityHash, and CalculateMetadataHash. Includes:
- Round-trip and tamper detection tests
- Cross-language fixture tests for Rust interop
- Interop tests using Rust CLI format/verify commands
- Golden fixture tests with Rust-generated expected hashes
- Shared .fbs schema files via symlips to Rust source
Add test_cross_deserialize_go_metadata and test_cross_serialize_rust_metadata
to verify Rust can consume Go's FlatBuffers output and vice versa.
Add go-test job to CI with race detection, schema sync check,
cross-language tests, and interop tests. Add Makefile targets
for check-fbs, go-test, cross-test, interop-rust-produces,
interop-go-produces, interop-test, and check-all.
- Move interop tests to a dedicated CI job running in a RHEL container
  (was failing on ubuntu-latest due to yum-builddep)
- Populate rustFixtureBase64 in cross_test.go with Rust-serialized output
- Add skip guard to TestInterop_RustProducesGoVerifies when interop
  data directory is missing
- Move cleanup of interop temp dirs from interop-go-produces to
  interop-test parent target
- verity algorithm tests: exec call to make_testfiles.py to generate
  test files, compare against reference values from digest.rs
- Rust/Go interop tests: load file-based metadata fixture generated
  by Rust CLI, verify Go deserialization and descriptor hashes

Changes:
- Delete golden_fixtures.json (no longer needed, values inlined)
- Delete cross_test.go (merged into interop_test.go)
- Add testdata/rust.metadata.fb fixture and gen_fixture.sh
- Add fixture staleness check to CI (regenerate + diff)
- Add gen-interop-fixture Makefile target
- Remove cross_lang_test.sh and cross-test Makefile target
Add English and Chinese README files documenting package usage and
installation. Also fix the CI go-test job to install Rust toolchain
before the interop fixture verification step that calls cargo, and
add testfiles/ to .gitignore.
Split Usage into two parts: (1) Serialize directory metadata with
Rust CLI (recommended) and Go implementation options, and (2)
Deserialize and verify with three levels — metadata root hash
comparison, per-file self-verification, and per-block verification.
@shankailun-aliyun
Copy link
Copy Markdown

@imlk0 ,您好,您的请求已接收,请耐心等待结果。

@shankailun-aliyun
Copy link
Copy Markdown

@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants