docs: establish the Kiwi SDD architecture control plane - #414
Conversation
Consolidate the verified current architecture, target design, milestones, work packages, GitHub inventory, and delivery gates into .planning/SDD.md as the sole authoritative project entry. Replace ROADMAP, STATE, and KANBAN project-state content with compatibility pointers, update documentation navigation, and require implementation PRs to link a work package, primary Issue, and REQ entries. Constraint: Documentation and delivery-control changes only; no runtime, storage, Raft, protocol, build, or CI checker behavior is changed. Confidence: high Scope-risk: moderate Tested: committed and working diff checks; Markdown relative-link and placeholder scans; 38 fence lines paired; 63 REQ and 18 Decision reference closure; eight work-package field contracts; live Issue #413, open-Issue count, critical PR snapshot, and remote main verification; independent review with all Important findings resolved. Not-tested: Rust build, Clippy, unit tests, integration tests, and sanitizers were not run because this commit changes documentation and the PR template only. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com>
📝 WalkthroughWalkthroughThe PR establishes ChangesSDD control plane
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bind the active WP0 state to PR #414 now that GitHub has assigned the pull-request number. Keep the SDD as the recoverable source for the current Issue, plan, PR, and next safe action before the PR is marked ready for review. Constraint: Update only the SDD execution pointer; do not change architecture, work-package scope, runtime behavior, Issue state, or merge authorization. Confidence: high Scope-risk: narrow Tested: git diff --check; staged diff check; SDD fence balance; live PR #414 OPEN/DRAFT Head/Base verification. Not-tested: Rust and runtime tests were not run because this commit only records the newly assigned PR number. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com>
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/pull_request_template.md:
- Around line 40-46: Extend the Verification section in the pull request
template with a post-merge evidence block requesting the PR number, merge SHA,
exact main commit, and SDD evidence update. Keep the existing pre-merge fields
and exact-main flag, and align the new fields with the acceptance record
required by CONTRIBUTING.md.
- Around line 3-15: Standardize the Issue relationship convention in
`.github/pull_request_template.md` lines 3-15 and `CONTRIBUTING.md` lines 76-79:
use `Fixes` or `Closes` only when the PR fully satisfies every acceptance
criterion, and use `Refs` or `Related` for partial work; replace all `Part of`
guidance in both sites while preserving the surrounding template and
contribution instructions.
In @.planning/KANBAN.md:
- Around line 3-5: Keep milestone and work-package identifiers distinct by
replacing “M0-M6” with “WP0-WP7” in .planning/KANBAN.md lines 3-5,
.planning/README.md lines 17-19, and docs/INDEX.md lines 17-19; retain “M0-M10”
for milestones.
In @.planning/SDD.md:
- Around line 470-492: 将第 6 节明确标记为仅代表 Target,不要把 20 条不变量直接作为当前控制平面合同。围绕每条不变量补充
Section 1.2 要求的 Current、Target、Gap、Work Package 和 Acceptance 映射,至少反映 Section 4
已记录的 Storage-to-Raft 无界队列与 snapshot metadata 接受未来版本等差距;保留现有不变量内容,并使其验收门禁可追踪。
- Around line 912-918: 在 SDD.md 的“验证门禁”与 WP0 退出门禁中加入可执行检查:针对 REQUIREMENTS.md 和
DECISIONS.md 定义精确及范围化的 REQ/Decision 范围,校验定义/引用闭包并在未定义或重复状态时以非零状态失败;同时约束 WP0、主
Issue/PR 仅存在一个获认可状态条目,并验证预期输出产物已生成。将现有仅打印标识符或文件名的检查替换或补充为明确的授权状态与产物断言。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ac869240-6db3-40cf-8e3e-6cf23ce56a53
📒 Files selected for processing (16)
.github/pull_request_template.md.planning/DECISIONS.md.planning/KANBAN.md.planning/OPEN_QUESTIONS.md.planning/README.md.planning/REQUIREMENTS.md.planning/ROADMAP.md.planning/SDD.md.planning/STATE.mdCLAUDE.mdCONTRIBUTING.mdREADME.mddocs/INDEX.mddocs/personas-and-user-stories.mddocs/prd.mddocs/quality/quality-gates.md
Close the review gaps in WP0 by separating milestones from work packages, aligning Issue relation keywords with Issue #413, and mapping every target invariant to its current state, gap, owner, and acceptance evidence. Add a fail-closed SDD validator and CI job that bind the 63 Requirement definitions, 18 Decisions, 20 WP0 artifacts, current-state mirrors, work-package field contracts, Markdown links, and exact baseline diff. Cover comments, fenced and indented code, duplicate or undefined registry entries, gate-text drift, artifact drift, and lifecycle transitions with mutation tests. Constraint: Preserve runtime, storage, Raft, protocol, and merge behavior; this commit changes only documentation governance and its verification tooling. Confidence: high Scope-risk: moderate Tested: Windows and WSL validator self-tests with 20 failure-path mutations and one lifecycle transition; Windows and WSL main validation; exact 20-file baseline diff closure; Python AST; GitHub Actions YAML parse; external PR #414 contract probe; staged and baseline git diff --check. Not-tested: Rust build, Clippy, runtime tests, integration tests, and sanitizers were not rerun locally because no Rust, Cargo, or runtime behavior changed; fresh GitHub CI is required on the pushed Head. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
scripts/validate_sdd.py (3)
788-797: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive the baseline SHA from the front matter instead of hardcoding it.
break_baselinehardcodesbaseline_ref: 0c4795ec716299598686fc7c5e0fac03a30e044d. When the baseline advances,.planning/SDD.mdchanges but this literal does not.str.replacethen performs no substitution, the mutated copy stays valid, andexpect_failurereportsmutation did not fail for 'baseline_ref must be a full'. That message does not identify the stale literal as the cause.Read the current value from the copy so the mutation tracks the document.
♻️ Proposed change
def break_baseline(candidate: Path) -> None: path = candidate / ".planning/SDD.md" - text = read_text(path).replace( - "baseline_ref: 0c4795ec716299598686fc7c5e0fac03a30e044d", - "baseline_ref: deadbeef", - 1, - ) + text = re.sub( + r"(?m)^baseline_ref: [0-9a-f]{40}$", + "baseline_ref: deadbeef", + read_text(path), + count=1, + ) path.write_text(text, encoding="utf-8")The same coupling applies to the other literal-bound mutations, but those literals are contract text that the gate already pins. The SHA is the only value that changes on every baseline refresh.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/validate_sdd.py` around lines 788 - 797, Update break_baseline to read the current baseline_ref value from the copied .planning/SDD.md front matter, then replace that discovered SHA with the invalid value deadbeef. Remove the hardcoded baseline SHA while preserving the existing mutation and expect_failure behavior.
570-571: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAnchor the deprecated-keyword check to the Issue-reference form.
"Part of" in textis a plain substring test. It matches ordinary English prose inCONTRIBUTING.mdanddocs/prd.md, for example "Part of the request path". The error message then reports a deprecated partial-Issue keyword that is not present. Match the keyword only when it introduces an Issue reference.♻️ Proposed change
- if "Part of" in text: + if re.search(r"(?mi)\bPart of\b\s*:?\s*(?:#\d+|https://github\.com/)", text): errors.append(f"deprecated partial-Issue keyword remains in {relative}")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/validate_sdd.py` around lines 570 - 571, Update the deprecated-keyword check in the validation logic around the “Part of” test so it matches only the Issue-reference form, not ordinary prose such as “Part of the request path.” Preserve the existing error reporting and use a pattern that requires “Part of” to introduce an Issue reference.
645-654: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd failure-path coverage for the Markdown gate.
Every mutation calls
validatewithcheck_markdown=False.validate_markdowntherefore has no failure-path coverage, although line 104 lists Markdown link and fence checks as a WP0 verification gate. Add at least one mutation that injects a broken relative link and one that injects an unpaired fence, then run those two mutations withcheck_markdown=True.The copied contract contains only the 20 registry artifacts, so a link that points outside the registry would break in the temporary directory. Scope the markdown-enabled mutations to a single copied file to avoid that.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/validate_sdd.py` around lines 645 - 654, The expect_failure test helper currently disables Markdown validation for every mutation, leaving validate_markdown failure paths uncovered. Add mutations for a broken relative link and an unpaired fence, apply each to a single copied registry artifact, and invoke validate with check_markdown=True while preserving the existing checks for other mutations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 40-42: Update the actions/checkout step in the CI workflow to set
persist-credentials to false alongside fetch-depth, ensuring the GitHub token is
not retained in .git/config after checkout.
In `@scripts/validate_sdd.py`:
- Around line 218-222: Update validate_registries to handle absent
.planning/REQUIREMENTS.md and .planning/DECISIONS.md before calling read_text,
allowing validation to continue and produce the existing missing WP0 artifact
error instead of raising FileNotFoundError. Preserve the current registry
parsing behavior when both files exist.
---
Nitpick comments:
In `@scripts/validate_sdd.py`:
- Around line 788-797: Update break_baseline to read the current baseline_ref
value from the copied .planning/SDD.md front matter, then replace that
discovered SHA with the invalid value deadbeef. Remove the hardcoded baseline
SHA while preserving the existing mutation and expect_failure behavior.
- Around line 570-571: Update the deprecated-keyword check in the validation
logic around the “Part of” test so it matches only the Issue-reference form, not
ordinary prose such as “Part of the request path.” Preserve the existing error
reporting and use a pattern that requires “Part of” to introduce an Issue
reference.
- Around line 645-654: The expect_failure test helper currently disables
Markdown validation for every mutation, leaving validate_markdown failure paths
uncovered. Add mutations for a broken relative link and an unpaired fence, apply
each to a single copied registry artifact, and invoke validate with
check_markdown=True while preserving the existing checks for other mutations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8319f7ef-dd6d-4d8b-a999-ed345ab2179f
📒 Files selected for processing (12)
.github/pull_request_template.md.github/workflows/ci.yml.planning/DECISIONS.md.planning/KANBAN.md.planning/REQUIREMENTS.md.planning/SDD.mdCONTRIBUTING.mddocs/INDEX.mddocs/architecture/redis-8.8.1-system-boundaries.mddocs/prd.mddocs/quality/system-stability-gate.mdscripts/validate_sdd.py
🚧 Files skipped from review as they are similar to previous changes (8)
- .planning/KANBAN.md
- .planning/DECISIONS.md
- .github/pull_request_template.md
- CONTRIBUTING.md
- docs/prd.md
- .planning/SDD.md
- docs/INDEX.md
- .planning/REQUIREMENTS.md
Add the repository-required arana-db Community copyright line to the new SDD validator so the SkyWalking Eyes header check recognizes the full configured Apache-2.0 template. Constraint: Change only the validator file header; preserve validation behavior and the WP0 artifact contract. Confidence: high Scope-risk: narrow Tested: validator self-tests; main validator; git diff --check; staged diff check; exact comparison with the existing Python license header template. Not-tested: The remote license job must rerun on the new Head. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com>
Disable checkout credential persistence and make the SDD validator fail closed without tracebacks when either registry artifact is absent. Tighten the deprecated Issue-keyword match, derive the baseline mutation from current front matter, and add scoped Markdown failure-path coverage. The self-test now exercises 25 negative mutations plus lifecycle and ordinary-prose positive paths. Constraint: Preserve the 20-artifact WP0 scope and all runtime behavior; change only the planning-doc CI job and validator robustness. Confidence: high Scope-risk: narrow Tested: Windows and WSL validator self-tests; Windows and WSL main validation; Python AST; GitHub Actions YAML parse; external PR #414 probe; staged diff check. Not-tested: Fresh GitHub CI and CodeRabbit rereview must run on the pushed Head. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com>
|
Review #4838049902 中 3 个非行内 nitpick 已在 e2bfc7d 处理:baseline mutation 通过当前 SDD front matter 的 40 位 SHA 动态派生并检查替换次数;Part of 仅在引入 Issue 引用时判定为废弃关键字,普通英文 prose 有正向防误报测试;Markdown gate 新增 broken relative link 与 unpaired fence 两个 scoped 失败路径。连同行内的 checkout 凭据和 registry 缺失处理,最终自测为 25 个失败路径变异、1 个 lifecycle transition、1 个 prose guard;Windows、WSL 及 GitHub 21/21 CI 均通过。 |
Pin the immutable PR #414 identity even when its Head object is unavailable, and require passed exact-main evidence to reference a successful ci workflow push on main for the exact recorded SHA. Reject the WP0 merge commit itself as verification evidence. Make lifecycle mutations state-independent and run the immutable-Head and live-run regressions through the public validator entry point so a future wiring regression fails --self-test. Constraint: Keep WP0 implemented and exact-main verification pending; change only SDD governance and validator behavior under Issue #416. Confidence: high Scope-risk: narrow Tested: Windows and Ubuntu WSL external regressions, validator self-tests, main validator, Python compile, working and staged diff checks. Not-tested: Fresh GitHub Actions on the pushed Head. Related: #416 Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com>
* fix(planning): pin WP0 validation to immutable merge evidence PR #414 was squash-merged after PR #412, so comparing the original SDD baseline with the moving main branch made the WP0 artifact gate absorb unrelated storage and Raft paths. Record immutable PR and squash-merge evidence, keep WP0 at implemented while exact-main verification is pending, and validate the historical merge-parent diff independently of the current work package. Add regression coverage for concurrent merges, invalid refs, ancestry, and premature lifecycle promotion. Constraint: Keep WP1 and Issue #415 blocked until WP0 has passed exact-main evidence. Confidence: high Scope-risk: narrow Tested: Windows and Ubuntu WSL SDD self-test, validator, Python compile, and git diff checks. Not-tested: GitHub Actions on the pushed Head. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com> * fix(planning): bind WP0 evidence projections Keep the human-readable WP0 ranges, exact-main status, and current-state table synchronized with the sole machine-readable front matter. Reject duplicate or conflicting projections and stale Issue tracking. Require a passed exact-main ref to exist after the WP0 merge and within the recorded baseline main history, while avoiding misleading ancestry errors when merge objects are unavailable. Add regressions for unrelated verification refs and conflicting evidence lines. Constraint: Preserve offline validation without requiring the squash-merged PR Head object. Confidence: high Scope-risk: narrow Tested: Windows and Ubuntu WSL SDD self-test, validator, and git diff checks. Not-tested: GitHub Actions on this new Head. Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com> * fix(planning): harden WP0 verification evidence Pin the immutable PR #414 identity even when its Head object is unavailable, and require passed exact-main evidence to reference a successful ci workflow push on main for the exact recorded SHA. Reject the WP0 merge commit itself as verification evidence. Make lifecycle mutations state-independent and run the immutable-Head and live-run regressions through the public validator entry point so a future wiring regression fails --self-test. Constraint: Keep WP0 implemented and exact-main verification pending; change only SDD governance and validator behavior under Issue #416. Confidence: high Scope-risk: narrow Tested: Windows and Ubuntu WSL external regressions, validator self-tests, main validator, Python compile, working and staged diff checks. Not-tested: Fresh GitHub Actions on the pushed Head. Related: #416 Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com> * fix(planning): keep WP0 promotion reachable Document that exact-main promotion must advance baseline_ref with the accepted verification commit. Exercise both the rejected stale-baseline path and the accepted advanced-baseline path against real Git history. Refs: #416 Co-authored-by: OmX <omx@oh-my-codex.dev> Signed-off-by: Xin.Zh <alexstocks@foxmail.com> --------- Signed-off-by: Xin.Zh <alexstocks@foxmail.com> Co-authored-by: OmX <omx@oh-my-codex.dev>
The WP0 artifact gate compared the working-tree diff against the WP0 baseline with the WP0 artifact registry. WP0 shipped in arana-db#414, so any later commit on main (e.g. arana-db#412) and any feature branch failed the planning SDD validation job; main itself was red. Remove the gate together with the now-dead git_changed_paths helper and the check_git_diff plumbing. All remaining validation (25 self-test mutations, lifecycle transition, prose guard) is unchanged and still passes.
SDD Traceability
main@0c4795ec716299598686fc7c5e0fac03a30e044dDescription
Establish
.planning/SDD.mdas Kiwi's sole authoritative architecture and delivery-control entry. The document binds current claims to an exact source and GitHub snapshot, separates current behavior from target design, defines M0-M10 milestones and WP0-WP7 work packages, and records architecture state machines, storage/Raft boundaries, dependencies, non-goals, acceptance criteria, and verification gates.Replace the independent live state in
ROADMAP.md,STATE.md, andKANBAN.mdwith compatibility pointers. Update repository navigation and the PR template so future implementation PRs identify one work package, one precise primary Issue, applicable REQ entries, decisions, and evidence.Add a fail-closed SDD validator and CI job for the WP0 control plane. The validator checks the 63 Requirement definitions, 18 Decisions, 20 target-invariant mappings, all WP field contracts, the exact 20-file artifact/Diff set, current-state mirrors, Markdown links and fences, and the normative WP0 exit/verification gate text. It does not implement a general future PR-body traceability checker or authorize WP1-WP7 runtime work.
Type of Change
Scope Completion
Verification
D:\test\github\review\arana-db-kiwi-pr-414\source; live GitHub queries throughgh.python -B scripts/validate_sdd.py --self-test;python -B scripts/validate_sdd.py; equivalent WSLpython3 -Bcommands; external PR docs: establish the Kiwi SDD architecture control plane #414 contract probe; Python AST parse; GitHub Actions YAML parse; exact Base-to-Head 20-file set check;git diff --check; live Issue/PR/check/thread queries;git ls-remotebranch reconciliation; three independent incremental reviews.implementedlifecycle transition and ordinary-prose Issue-keyword guard pass; Windows and WSL validators report zero errors; local incremental review found no remaining P0/P1 on Heade2bfc7deb481590a757f0034874b7f21a4a31aa2..planning/SDD.mdbefore marking WP0verifiedoraccepted.Checklist
main.Additional Context
The original user checkout
D:\test\github\kiwiwas not modified, checked out, stashed, cleaned, or reset during this review/fix cycle. Review, implementation, probes, logs, and temporary evidence stayed underD:\test\github\review\arana-db-kiwi-pr-414. Merge remains intentionally outside this task's authorization.Summary by CodeRabbit