🎙️ task - fix(repo): coerce empty-string homepage/description to null (perpetual UPDATE drift)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- github, typescript
调研方向
从 src/domain.operations/repo/castToDeclaredGithubRepo.ts 中第 47-48 行的 homepage 和 description cast 开始。也检查 setRepo,以确定那里是否同样需要进行规范化。使用报告中的 plan、apply 和 re-plan 场景验证修复,确认 null 值能够收敛,而不会持续产生 UPDATE 漂移。
由索引模型根据 Issue 内容生成。
描述
🦫🎙️ dispatch to foreman
💧 task enqueued
├─ priority = ?
├─ yieldage = ?
└─ leverage = ?
title
fix(repo): coerce empty-string homepage/description to null (perpetual UPDATE drift)
description
.what
castToDeclaredGithubRepo casts an empty-string homepage (and description) from the GitHub API to an empty string, but the natural desired value is null. The two never converge, so every declastruct plan on a DeclaredGithubRepo shows a homepage empty-string to null UPDATE, and every apply is a no-op that re-stores the empty string. The resource is never idempotent.
.where
src/domain.operations/repo/castToDeclaredGithubRepo.ts (main / 1.7.0)
description: input.description ?? null, // line 47
homepage: input.homepage ?? null, // line 48
.root-cause
GitHub's REST API returns homepage and description as an empty string for repos with no homepage/description set — NOT null. the ?? null coalesce only fires on null/undefined, so an empty string stays an empty string.
- remote casts to
homepage= empty string - a natural wish declares
homepage: null(there is no homepage) - empty string is not equal to null, so declastruct decides UPDATE, forever
.repro
- declare a
DeclaredGithubRepowithhomepage: null(repo has no homepage set on github) declastruct plan-> showshomepageempty-string vs null UPDATEdeclastruct apply-> no-op (github stores empty string again)- re-plan -> same UPDATE. never converges.
observed on ahbode/infrastructure provision/github.repo at declastruct-github 1.6.0; confirmed unchanged on main (1.7.0).
.fix
coerce empty string to null in the cast, so remote matches a null wish:
description: input.description || null, // empty string -> null
homepage: input.homepage || null, // empty string -> null
(|| null is safe here — both fields are free-text where empty string and "unset" are equivalent; there is no meaningful empty-string value to preserve.)
alternatively, if you prefer to keep ?? semantics elsewhere, an explicit input.homepage?.trim() || null also handles whitespace-only values.
.also-consider
whichever coercion you choose, apply it symmetrically on the SET side (setRepo) if it sends homepage/description, so a null wish is written consistently and a round-trip get -> cast -> set is stable.
.impact
- breaks idempotency guarantee for
DeclaredGithubRepo(always dirty) - noise in every plan; erodes trust in the KEEP vs UPDATE signal
- forces consumers to declare
homepageas an empty string (matching the buggy cast) as a workaround, which is backwards
- 主要语言
- TypeScript
- 星标
- 0
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ehmpathy/declastruct-github 的其他 Issue
-
难度 5/5 一周以上 新手友好度 38/100
-
难度 5/5 一周以上 新手友好度 42/100
-
难度 2/5 1-3 小时 新手友好度 45/100
查看 ehmpathy/declastruct-github 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
status:approved type:bug
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
stage:4
难度 2/5 1-3 小时 新手友好度 65/100
ilan-pinto/roaring-lions#598 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复