feat: 5-layer defense against worktree isolation type divergence#18
feat: 5-layer defense against worktree isolation type divergence#18andyzengmath merged 61 commits intomasterfrom
Conversation
…nership fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ontracts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation # Conflicts: # skills/ql-plan/SKILL.md
…ns() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation # Conflicts: # lib/materialize.sh # tests/test_materialize.sh
…baseline Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… feedback loop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ion_file() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d typecheck gate Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation # Conflicts: # lib/materialize.sh # tests/test_merge_escalation.sh # tests/test_typecheck_gate.sh
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation # Conflicts: # tests/test_materialize.sh
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… Python patterns - C-1: Add @DataClass pattern to grep_duplicate_definitions() for Python support - C-2: audit_wave_types() accepts base_sha parameter instead of hardcoded HEAD~1 - I-1: Language-aware error counting in post_merge_typecheck() (TS/Py/Go patterns) - I-2: generate_definition_file() falls back to infer_shared_types_dir() when no definitionFile - I-3: Python typecheck auto-detect checks config files before command availability - I-4: update_contracts_for_next_wave() includes consumers field for L5→L2 feedback - S-2: Go code generation infers package name from definitionFile path - S-5: Step 4C pseudocode uses dict assignment (shared_types is object, not array) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e, shell quality - CRITICAL: Sanitize typecheckCommand against shell metacharacters before bash -c - Spec (US-006): Add definitionFile extension hint to detect_language() for multi-config repos - Spec (US-010): Fix skip log message format to match PRD specification - Important: generate_definition_file() outputs written path so inferred files get committed - Important: Check git revert exit code, log CRITICAL on failure instead of || true - Important: Use stashed=false pattern for revert stash logic (matches merge_worktree_branch) - Important: Replace unquoted for-loops with while-read for safe whitespace handling - Important: Use write_quantum_json() from json-atomic.sh instead of manual tmp+mv All 191 tests pass (73 materialize + 14 merge + 21 typecheck + 83 type-audit). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Critical fixes from Soliton PR review: - Replace typecheckCommand denylist with allowlist + array execution (no bash -c) - Add path traversal validation for definitionFile (reject ".." patterns) - Add --no-ff to merge_worktree_branch() + verify merge commit before revert Important fixes: - Baseline write uses write_quantum_json() instead of manual tmp+mv - Check write_quantum_json() return value in materialize_contracts() - Python error count: head -1 → tail -1 (use final summary, not per-file) - printf '%b' → '%s' for definition content (no escape interpretation) - Initialize tc_exit=0 explicitly - Add json-atomic.sh to monitor.sh Requires header Test additions: - 6 injection tests for typecheckCommand (semicolon, pipe, redirect, backtick, newline, valid) - 2 path traversal tests for definitionFile All 206 tests pass (76 + 14 + 33 + 83). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Soliton PR Review — ql/progressive-materializationRisk Score: 53/100 (MEDIUM) | 16 files | 6,533 additions | AI-Authored: HIGH Agents Dispatchedcorrectness, security, consistency, test-quality (4/4 completed) Findings Summary14 findings: 3 critical, 8 improvements, 3 nitpicks Critical Issues (all fixed in 07704f2)
Important Fixes (also in 07704f2)
Test Results After Fixes
Notable Outside-PR-Scope Findings
Strengths
🤖 Reviewed by Soliton PR Review (correctness + security + consistency + test-quality) |
Summary
as anybypasses (10%) because isolated agents cannot see each other's work. Documented in the March 18 post-mortem.The 5 Layers
ql-plangenerates type shapes + definitions, not just namesskills/ql-plan/SKILL.md,references/contract-shapes.mdlib/materialize.sh(new, 541 lines)lib/monitor.sh(enhanced)lib/monitor.sh(new function)lib/type-audit.sh(new, 365 lines),agents/type-auditor.md(new)Key Design Decisions
Test plan
lib/materialize.sh(detect_language, infer_shared_types_dir, generate_definition_file, materialize_contracts)lib/monitor.sh)lib/monitor.sh)lib/type-audit.sh)🤖 Generated with Claude Code