Skip to content

feat(lint): add machine fixes - #7

Merged
pocky merged 1 commit into
mainfrom
feature/F003-lint---fix-apply-machine-applicable-lint
Jun 23, 2026
Merged

feat(lint): add machine fixes#7
pocky merged 1 commit into
mainfrom
feature/F003-lint---fix-apply-machine-applicable-lint

Conversation

@pocky

@pocky pocky commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add CAS-guarded workspace/applyEdits support so sidecar extensions can request safe, host-owned text mutations with dry-run previews and conflict reporting.
  • Extend the lint extension with tower_lint_fix, including structured fix extraction, dry-run/apply behavior, skip reasons, and stable tool error responses.
  • Wire apply-edits through daemon state, extension discovery, sidecar dispatch, and extension event delivery while avoiding reentrant file-change deadlocks.
  • Document lint fix usage and update project memory for the F003 implementation and review rules.

Changes

Project Memory

  • .zpm/kb/feedback/journal.wal: Add F003 review, testing, protocol, and apply-edits architecture rules.
  • .zpm/kb/pr_feature_f003_lint_fix_apply_machine_applicable_lin/journal.wal: Add PR tracking journal entries for resolved implementation scan items.
  • .zpm/kb/pr_feature_f003_lint_fix_apply_machine_applicable_lin/knowledge.pl: Add PR tracking schema and readiness predicates for this branch.
  • .zpm/mounts.json: Mount the F003 PR memory segment.

Core Apply-Edits Domain

  • crates/core_engine/src/domain/error.rs: Add UnsupportedOperation for unavailable public contracts.
  • crates/core_engine/src/domain/mutation/file_mutation.rs: Implement CAS and dry-run multi-edit application with UTF-8 validation, conflict filtering, previews, and indexed commits.
  • crates/core_engine/src/domain/mutation/mod.rs: Register apply-edits domain tests.
  • crates/core_engine/src/domain/mutation/apply_edits_tests.rs: Add focused tests for contracts, CAS rejection, dry-run previews, conflicts, UTF-8 boundaries, and commit behavior.
  • crates/core_engine/src/ports/inbound.rs: Add apply-edits DTOs and FileMutationUseCase methods.

Extension Host Wiring

  • crates/core_engine/src/adapters/daemon/engine.rs: Wire EngineApplyEditsHost into daemon state and defer extension notifications until locks are released.
  • crates/core_engine/src/adapters/extension/discovery.rs: Add shared-registry loading so eager extensions can use host calls during initialization.
  • crates/core_engine/src/adapters/extension/host_deps.rs: Add ApplyEditsHostPort and unsupported fallback dependency.
  • crates/core_engine/src/adapters/extension/mod.rs: Export new extension discovery helpers.
  • crates/core_engine/src/adapters/extension/sidecar.rs: Dispatch workspace/applyEdits, validate params, enforce capability declaration, and map CAS/range errors.
  • crates/core_engine/src/adapters/extension/supervisor.rs: Clone the apply-edits dependency during respawn.
  • crates/core_engine/src/domain/extension_host/mod.rs: Queue deferred events when an extension instance is busy to avoid reentrant deadlocks.
  • crates/core_engine/src/adapters/mcp/native_tools.rs: Expose the current extension host from engine state.

Lint Fix Extension

  • extensions/lint/extension.toml: Declare the fix tool and request_apply_edits capability.
  • extensions/lint/src/fixes.rs: Add lint fix model types.
  • extensions/lint/src/lib.rs: Export fix support.
  • extensions/lint/src/main.rs: Add fix orchestration, CAS hashing, dry-run handling, apply-edits host calls, and structured tool results.
  • extensions/lint/src/parsers.rs: Extract structured fixes from supported linter output formats.
  • extensions/lint/src/protocol.rs: Add fix request/result DTOs, preview DTOs, skip reasons, and stable error response types.
  • extensions/lint/src/runner.rs: Preserve fix metadata through linter execution.
  • extensions/lint/tests/protocol_tests.rs: Cover lint fix protocol serialization and manifest behavior.

Tests

  • crates/core_engine/src/adapters/extension/supervisor_tests.rs: Add apply-edits fallback dependency to host fixture setup.
  • crates/core_engine/src/adapters/extension/tests.rs: Add apply-edits fallback dependency to sidecar tests.
  • crates/core_engine/tests/extension_ast_e2e.rs: Add apply-edits fallback dependency to AST extension fixtures.
  • crates/core_engine/tests/extension_fmt_e2e.rs: Add apply-edits fallback dependency to formatting extension fixtures.
  • crates/core_engine/tests/extension_lint_e2e.rs: Add apply-edits runtime, reentrancy, manifest, protocol, parser, dry-run, conflict, and lint fix orchestration coverage.
  • crates/core_engine/tests/extension_lsp_process_e2e.rs: Add apply-edits fallback dependency to LSP process fixtures.
  • crates/core_engine/tests/extension_lsp_protocol_e2e.rs: Add apply-edits fallback dependency to LSP protocol fixtures.
  • crates/core_engine/tests/functional_lint_fix_mcp.rs: Add MCP-level lint fix coverage.
  • crates/core_engine/tests/functional_lint_mcp.rs: Update lint MCP expectations for the added fix capability/tool surface.
  • crates/core_engine/tests/lint_support.rs: Add lint fix manifests, apply-edits-capable test host dependencies, and fixture helpers.
  • crates/extension_protocol/tests/protocol_tests.rs: Add protocol tests for request-apply-edits host calls and manifest capability stability.

Protocol

  • crates/extension_protocol/src/manifest.rs: Add request_apply_edits capability support.
  • crates/extension_protocol/src/messages.rs: Add RequestApplyEdits host call wire DTOs.

Documentation

  • README.md: Describe lint fixes and add a dry-run example.
  • docs/README.md: Link lint fix user documentation.
  • docs/architecture.md: Document apply-edits flow in the host architecture.
  • docs/extensions.md: Document the request_apply_edits capability for extensions.
  • docs/getting-started.md: Add lint fix usage to onboarding flow.
  • docs/mcp-tools.md: Document tower_lint_fix, arguments, results, and errors.
  • docs/user-guide/lint-fixes.md: Add user guide for previewing and applying structured lint fixes safely.

Test plan

  • Run cargo fmt --check
  • Run cargo clippy --workspace --all-targets -- -D warnings
  • Run cargo build --workspace --bins
  • Run cargo test --workspace

Closes #6


Generated with awf commit workflow

- `.zpm/kb/feedback/journal.wal`: Record feedback memory for lint fix implementation
- `.zpm/kb/pr_feature_f003_lint_fix_apply_machine_applicable_lin/journal.wal`: Add PR memory journal for F003 lint fixes
- `.zpm/kb/pr_feature_f003_lint_fix_apply_machine_applicable_lin/knowledge.pl`: Add PR knowledge base for F003 lint fixes
- `.zpm/mounts.json`: Register PR memory mount for lint fix work
- `README.md`: Document lint fix capability
- `crates/core_engine/src/adapters/daemon/engine.rs`: Wire apply-edits host dependency into daemon engine
- `crates/core_engine/src/adapters/extension/discovery.rs`: Load apply-edits capability from extension manifests
- `crates/core_engine/src/adapters/extension/host_deps.rs`: Add apply-edits host dependency
- `crates/core_engine/src/adapters/extension/mod.rs`: Export apply-edits extension support
- `crates/core_engine/src/adapters/extension/sidecar.rs`: Route apply-edits host calls through sidecar
- `crates/core_engine/src/adapters/extension/supervisor.rs`: Supervise apply-edits host call dispatch
- `crates/core_engine/src/adapters/extension/supervisor_tests.rs`: Cover apply-edits supervisor behavior
- `crates/core_engine/src/adapters/extension/tests.rs`: Add extension apply-edits adapter coverage
- `crates/core_engine/src/adapters/mcp/native_tools.rs`: Expose lint fix behavior through MCP tools
- `crates/core_engine/src/domain/error.rs`: Add mutation error handling for edit application
- `crates/core_engine/src/domain/extension_host/mod.rs`: Add apply-edits host capability contract
- `crates/core_engine/src/domain/mutation/apply_edits_tests.rs`: Add apply-edits mutation contract tests
- `crates/core_engine/src/domain/mutation/file_mutation.rs`: Implement CAS-guarded multi-edit application
- `crates/core_engine/src/domain/mutation/mod.rs`: Export apply-edits mutation module
- `crates/core_engine/src/ports/inbound.rs`: Add inbound apply-edits use case API
- `crates/core_engine/tests/extension_ast_e2e.rs`: Update extension host fixtures for apply-edits deps
- `crates/core_engine/tests/extension_fmt_e2e.rs`: Update format extension fixtures for apply-edits deps
- `crates/core_engine/tests/extension_lint_e2e.rs`: Add lint fix e2e coverage
- `crates/core_engine/tests/extension_lsp_process_e2e.rs`: Update LSP process fixtures for apply-edits deps
- `crates/core_engine/tests/extension_lsp_protocol_e2e.rs`: Update LSP protocol fixtures for apply-edits deps
- `crates/core_engine/tests/functional_lint_fix_mcp.rs`: Add MCP functional tests for lint fixes
- `crates/core_engine/tests/functional_lint_mcp.rs`: Update lint MCP tests for fix support
- `crates/core_engine/tests/lint_support.rs`: Add lint fix test support helpers
- `crates/extension_protocol/src/manifest.rs`: Add apply-edits capability manifest schema
- `crates/extension_protocol/src/messages.rs`: Add apply-edits protocol messages
- `crates/extension_protocol/tests/protocol_tests.rs`: Cover apply-edits protocol serialization
- `docs/README.md`: Link lint fix user documentation
- `docs/architecture.md`: Document apply-edits architecture flow
- `docs/extensions.md`: Document extension apply-edits capability
- `docs/getting-started.md`: Add lint fix usage guidance
- `docs/mcp-tools.md`: Document lint fix MCP tool behavior
- `docs/user-guide/lint-fixes.md`: Add lint fix user guide
- `extensions/lint/extension.toml`: Declare apply-edits capability
- `extensions/lint/src/fixes.rs`: Add lint fix planning and orchestration
- `extensions/lint/src/lib.rs`: Export lint fix functionality
- `extensions/lint/src/main.rs`: Wire lint fix tool into extension runtime
- `extensions/lint/src/parsers.rs`: Extract structured fixes from linter output
- `extensions/lint/src/protocol.rs`: Add lint fix request and response types
- `extensions/lint/src/runner.rs`: Add fix-aware linter runner flow
- `extensions/lint/tests/protocol_tests.rs`: Cover lint fix protocol behavior

Closes #6
@pocky
pocky marked this pull request as ready for review June 23, 2026 20:39
@pocky
pocky merged commit 8543c17 into main Jun 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F003: lint --fix: Apply Machine-Applicable Linter Fixes

1 participant