Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

bregctl: project lock adds a missing digest after the entry's trailing blank line

未关闭 适合新手
#2,231 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
tooling

调研方向

从 crates/registry-bregctl/src/module_lock_patch.rs 开始,重点查看 patch_module_locks 和 key_value_end,然后阅读该文件中的单元测试。检查最后一个条目以及后面跟着空行的条目中,item.end 位于何处。为这两种情况添加测试;当 digest 仍与其条目关联,并且下一个顶层键前的空行得到保留时,工作就完成了。

由索引模型根据 Issue 内容生成。

描述

area:breg bug

When a modules[] entry has no digest yet, bregctl project lock adds one at the end of the
entry. If the entry ends with a blank line (the usual spacing before the next top-level key),
the digest goes after the blank line, so the entry is split by a blank line. The YAML is still
valid and check accepts it, so this is cosmetic, but the lock is meant to be a minimal patch that
leaves the author's layout alone.

Minimal repro, a registry.yaml with:

modules:
  - id: inspections
    version: 0.1.0

evidenceProviders:
  # ...

After bregctl project lock <project>:

modules:
  - id: inspections
    version: 0.1.0

    digest: "sha256:..."
evidenceProviders:
  # ...

Expected:

modules:
  - id: inspections
    version: 0.1.0
    digest: "sha256:..."

evidenceProviders:
  # ...

Likely fix: in crates/registry-bregctl/src/module_lock_patch.rs, patch_module_locks inserts a
missing digest at item.end (around line 131). For the last entry that is the end of the
modules block, which key_value_end (line 230) places after blank lines; for an earlier entry
it is the next entry's first line, so a blank line between entries has the same effect. Inserting
after the last non-blank line of the item fixes both.

Tests: unit tests in the same file (mod tests, line 249): one for the last entry followed by a
blank line and a top-level key, one for a blank line between two entries.

主要语言
Rust
星标
2
派生
0
平均合并
10 小时 32 分钟
30 天内合并 PR
269

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

registrystack/registry-stack 的其他 Issue

查看 registrystack/registry-stack 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。