Skip to content

feat(cryptpilot-verity): add label support to format and dump commands#113

Merged
imlk0 merged 12 commits intomasterfrom
verity-metadata-tag
May 8, 2026
Merged

feat(cryptpilot-verity): add label support to format and dump commands#113
imlk0 merged 12 commits intomasterfrom
verity-metadata-tag

Conversation

@imlk0
Copy link
Copy Markdown
Collaborator

@imlk0 imlk0 commented May 7, 2026

Summary

  • Add Docker-style label (key-value pairs) support to the format and dump commands of cryptpilot-verity
  • Labels are stored in the metadata FlatBuffers file but not included in the root hash calculation, ensuring backward compatibility and no impact on integrity verification
  • Add --print-labels option to dump all labels at once
  • Update README and README_zh documentation with new options
  • Add 6 label-related test steps to the Makefile test suite
  • Fix a clippy manual_div_ceil warning in verity-fuse

Changes

FlatBuffers schema

  • Added KeyValue table (key: string, value: string) to metadata.fbs
  • Added optional labels: [KeyValue] field to the Metadata table
  • metadata_hash.fbs unchanged — labels are naturally excluded from root hash

CLI

  • format: new --label key=value (repeatable), e.g. --label env=prod --label owner=team-a
  • dump: new --print-label <key> to get a single label value, --print-labels to list all

Metadata module

  • New MetadataInfo struct with file_infos: Vec<FileVerityInfo> and labels: BTreeMap<String, String>
  • serialize_metadata accepts and serializes labels
  • deserialize_metadata parses labels from metadata
  • Updated open.rs and verify.rs to use the new MetadataInfo return type

Testing

  • make test now includes 6 new steps:
    • Format with labels
    • --print-labels output
    • --print-label value verification
    • Nonexistent key error handling
    • Root hash independence from labels

Test plan

  • make clippy passes
  • cargo fmt --check passes
  • make test passes (all 15 steps including 6 label tests)
  • --print-labels outputs all labels
  • --print-label <key> returns correct value
  • Nonexistent label key returns error with exit code 1
  • Root hash is identical with and without labels

🤖 Generated with Claude Code

imlk0 added 6 commits May 7, 2026 20:21
…ump commands

- Add MetadataInfo struct with labels BTreeMap
- Update serialize_metadata to accept and serialize labels
- Update deserialize_metadata to parse labels from metadata
- Update open.rs and verify.rs to use MetadataInfo return type
- Display labels in dump --print-metadata output
…nt-label handler

- Pass CLI labels from FormatOptions to serialize_metadata
- Add --print-label handler in dump command
- Ignore docs/superpowers/ in .gitignore
- Add --print-labels option to dump command (prints all labels)
- Update README and README_zh with label options documentation
- Add label tests to Makefile test target
- Use div_ceil() instead of manual calculation in verity-fuse
- Format open.rs to satisfy cargo fmt
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

- Commit metadata_generated.rs files so CI cargo fmt --check can resolve modules
- Empty the metadata/.gitignore since generated files are now tracked
- Add .shellcheckrc to exclude SC2155 style warnings in benchmark scripts
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

…cript

Split combined local declarations and command substitutions to avoid
masking return values. Replace sed-based leading-zero fix with bash
parameter expansion. Remove .shellcheckrc workaround.
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

…ility

dh_shlibdeps auto-generates libfuse3-3 on Ubuntu 24.04, but Debian
trixie provides libfuse3-4 with the same SONAME. Exclude libfuse from
auto-detection and rely on the explicit fuse3 dependency in control.
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

… and remove generated FlatBuffers files from git

Add verity-testfiles target to Makefile that generates testfiles in
verity-core/ before running cargo test. This fixes test_testfiles CI
failure where fixtures were never committed due to .gitignore.

Remove metadata_generated.rs and metadata_hash_generated.rs from git
tracking — they are build artifacts generated by flatc. Update
.gitignore to continue ignoring them.

Comment out longfile generation in make_testfiles.py (~192MB) as it is
not used by any test (only referenced in a comment).
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

The -X flag is not a valid dpkg-shlibdeps option. Use -x<package>
instead to exclude the libfuse3 package from auto-generated
dependencies, avoiding libfuse3-3 vs libfuse3-4 cross-distro issues.
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

…rom DEB test matrix

Restore metadata_generated.rs and metadata_hash_generated.rs as
tracked files — they are required by cargo fmt and the Rust module
system. Remove from .gitignore.

Drop debian:trixie from DEB test matrix. Ubuntu 24.04 ships libfuse3
with SONAME .so.3 while Debian trixie ships .so.4. A binary built on
Ubuntu cannot run on trixie due to the incompatible SONAME.
@shankailun-aliyun
Copy link
Copy Markdown

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

@shankailun-aliyun
Copy link
Copy Markdown

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

@imlk0 imlk0 merged commit a407bf3 into master May 8, 2026
33 of 34 checks passed
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