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

Decide: one hosted `redirect` JSON block for disk scan and the in-memory engine (today {mode, rewrittenFiles} vs a seven-key block)

未关闭
#1,881 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

Read crates/socket-patch-cli/src/commands/scan/hosted.rs and crates/socket-patch-core/src/hosted/render.rs to compare the disk and in-memory redirect JSON blocks, then review CLI_CONTRACT and tests/hosted_memory_parity.rs. Decide which proposed shape should be shared, update the corresponding implementation and documentation, and fix the stale comment and repeated sentence. Done means disk and memory emit matching key sets, or the docs accurately describe both shapes, with the parity test covering the chosen contract.

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

描述

agent:needs-human agent:triaged arch-audit priority:p3 refactor

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: decision. Register ID: T29.

Question

The hosted --json envelope's nested redirect block has two shapes. Which one should both paths emit?

  • Option A (recommended): both paths emit core's seven-key block. Disk scan gains redirected, skipped, patches, warnings and dryRun; it already has mode and rewrittenFiles. This is additive for disk consumers. The per-patch pinned/would_pin/unpinned rows then also exist on disk, beside the envelope events[].
  • Option B: both paths emit the disk shape {mode, rewrittenFiles}, with per-patch outcomes only in events[] and warnings only in the top-level warnings[]. This removes keys from in-memory (napi/hosted-bundle) consumers.
  • Option C: keep both shapes, but correct the docs so neither claims to be the only one.

Problem

  • Disk: scan/hosted.rs redirect_block L95-L99 emits { "mode": "hosted", "rewrittenFiles": [...] }. Its per-patch outcomes are envelope events (applied/verified/skipped).
  • In-memory: core hosted/render.rs redirect_json_block L22-L77 emits mode, redirected, rewrittenFiles, skipped, patches, warnings and dryRun. Only hosted/memory/mod.rs calls it (L1289, L1571).
  • Its doc says this is "the ONE spelling of its key set … shared by every hosted path (disk scan, its zero-discovery arm, and the in-memory engine), so the two cannot drift by convention". That is false on main.
  • A comment at scan/hosted.rs L1900-L1904 refers to redirect.patches[], which the disk path never emits.
  • The sentence "no lockfile entry pinning it could be rewritten" is written 3 times (hosted.rs L150, L2444, render.rs L61).

Proposed change (after the decision)

  • A: disk calls redirect_json_block and redirect_block is deleted.
  • B: the memory path drops the extra keys.
  • C: both docs are corrected.

In every case, fix the stale comment and keep the sentence once.

Size

2 to 3 files plus CLI_CONTRACT text. Under 100 lines.

Acceptance criteria

  • One function builds the block for both paths, or the docs stop claiming that.
  • tests/hosted_memory_parity.rs (or a new test) asserts the disk and memory redirect key sets are equal.
主要语言
Rust
星标
8
派生
2
平均合并
19 小时 19 分钟
30 天内合并 PR
697

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

SocketDev/socket-patch 的其他 Issue

查看 SocketDev/socket-patch 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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