feat(lint): warn on seed values outside the declared state machine (#3433 follow-up)#3471
Merged
Merged
Conversation
…3433 follow-up) Follow-ups to the #3433 seed / state-machine exemption: - lint: `validateSeedStateMachine` — an author-time `os validate` / `os lint` warning when a seed record's `state_machine`-governed field carries a value the machine does not declare (initialStates ∪ transition keys ∪ targets). #3433 exempts seeds from the FSM at write time, so this re-adds the "is this even a known state?" safety net a typo would otherwise slip past. Advisory, symmetric with the #3434 replay-safety rule. Rule id `seed-value-outside-state-machine`. - test(cloud-connection): a marketplace-install integration test that drives the real install handler → runInlineSeed → SeedLoaderService against an engine stub reproducing the #3165 initialStates guard, proving a template whose seed spans the whole pipeline (prospecting → closed_won) lands every row on install. Red without the #3433 exemption (verified). - docs: note the seed exemption in the state-machine, validation, and seed-data guides — seeds are established facts, not lifecycle events; every other validation still runs; `os lint` catches an unknown-state typo before boot. The remaining #3433 follow-up — #3434 (mode:'insert' seeds duplicate on replay) — was already closed by #3442 (composite externalId) + #3460 (replay-safety lint), so it needs no change here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 19 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#3433 的三项 follow-up(用户明确要求 1+2+3+4)。
背景
#3433 让种子写入豁免
state_machine校验。这带来一个"无声后门":FSM 层的"这是不是我认识的态?"检查对种子不再运行。本 PR 把这层以 author-time 形式补回来,并把 marketplace 链路与文档收尾。改动
① lint 门(task 2) —
validateSeedStateMachine:纯(stack) => Finding[]规则,os validate/os lint跑。种子记录的state_machine字段值若 ∉ 机器声明态集(initialStates ∪ transition 键 ∪ transition 值)→ warning。字段级select仍在运行时拒非法 option,但自由文本状态字段、或"合法 option 但非 FSM 声明态"会静默漏过——这个门抓它。Advisory(与 #3434 的 replay-safety 门对称)。规则 idseed-value-outside-state-machine`。8 个单测(含 typo 验红);os lint showcase 实测 0 误报。② marketplace 实测(task 1) — cloud-connection 集成测试:驱动真实 install handler → runInlineSeed → 真 SeedLoaderService,引擎 stub 复现 #3165 的 initialStates 强制。一个种子铺满 pipeline(prospecting→negotiation→closed_won→closed_lost)的模板包 install 后全量入库。已验红(关闭 stub 豁免立即红 3/4 丢行),坐实 #3433 在 marketplace seam 真绿。
③ 文档同步(task 4) — state-machine / validation / seed-data 三处 narrative 补种子豁免说明(种子是既成事实非生命周期事件;其他校验照跑;
os lint抓 typo)。references/ 生成物不动。④ #3434(task 3) — mode:'insert' 种子重放翻倍,已被 #3442(组合 externalId)+ #3460(replay-safety 门)修复合并,本 PR 无需改代码。
验证
🤖 Generated with Claude Code