Skip to content

feat(ai): op-design-lint — pen-ai-skills S1 detector layer Rust port#131

Open
finiking wants to merge 2 commits into
v0.8.0-newfrom
s1-op-design-lint
Open

feat(ai): op-design-lint — pen-ai-skills S1 detector layer Rust port#131
finiking wants to merge 2 commits into
v0.8.0-newfrom
s1-op-design-lint

Conversation

@finiking
Copy link
Copy Markdown
Collaborator

Summary

Sub-project S1 of the pen-ai-skills Rust-ification — ports the TS design-diagnostics layer to a new pure-Rust crate op-design-lint, and restores the debug_validation_report MCP tool on the Rust side.

  • crates/op-design-lint — wasm-clean pure crate: Issue/FixProperty/FixReport model, WCAG color, node_util/node_mut, all 14 detectors + detect_all, apply_fixes/detect_and_fix (verbatim port of TS applyFixes).
  • TS-parity harness — 13 hand-authored PenDocument fixtures + tools/dump-diagnostics-golden.ts + tests/parity.rs (structural parity vs the TS oracle) + a CI drift-guard job in rust-check.yml.
  • op-mcp — new read-only debug_validation_report tool, gated by OPENPENCIL_DEBUG_TOOLS=1.

Detectors are a verbatim TS port (parity-tested). detectTextCornerRadius / detectTextStroke are structural no-ops on jian docs — jian's typed TextNode cannot carry stroke/cornerRadius (T0 schema audit decision a). apply_fixes is history-agnostic (the production caller + history-snapshot wrapper belong to S3).

Spec / plans / audit: openpencil-docs/superpowers/{specs,plans,notes}/2026-05-1*-pen-ai-skills-s1-* and 2026-05-18-s1-gate-complete.md.

Test Plan

  • cargo test -p op-design-lint — 149 pass (136 lib + 13 parity)
  • cargo test -p op-mcp — 139 pass
  • cargo clippy -p op-design-lint -p op-mcp --all-targets -- -D warnings — clean
  • cargo build -p op-design-lint --target wasm32-unknown-unknown — wasm-clean invariant holds
  • CI green on s1-op-design-lint: Rust Check (incl. golden drift guard) + WASM bundle check + Rust multi-platform build
  • debug_validation_report verified end-to-end via openpencil-desktop --mcp with OPENPENCIL_DEBUG_TOOLS=1

@finiking finiking force-pushed the s1-op-design-lint branch from 685570b to c554a8b Compare May 18, 2026 02:04
Port the pen-ai-skills diagnostics layer to a new pure Rust crate
`op-design-lint`: 14 design-lint detectors, the detect_all aggregator,
apply_fixes / detect_and_fix, and golden parity tests against the TS
oracle. Wire it into op-mcp as the read-only debug_validation_report
tool, gated by OPENPENCIL_DEBUG_TOOLS=1.

Detectors: empty_paths, unexpected_rotation, excessive_frame_effects,
invisible_containers, text_explicit_heights, text_effect,
text_corner_radius, text_stroke, text_bg_contrast, edge_section_padding,
stacked_horizontal_padding, sibling_inconsistencies (+ check_consistency),
detect_all.

Also includes: node_util shared helpers + pen-core color/visibility
ports, node_mut field accessors, set_property issue->node mutation
dispatch, golden fixture corpus + TS dump script, structural-parity
test, a CI golden-drift guard, and the gitignore fix so the fixture
docs/ dir is tracked.

This branch's per-commit history was squashed: the original 28 commits
carried fabricated timestamps and could not be honestly reconstructed,
so the work is recorded as a single commit at its real completion time.
@finiking finiking force-pushed the s1-op-design-lint branch from c554a8b to 91f0485 Compare May 18, 2026 16:35
debug_validation_report was registered in rebuild_registry and listed
in tools/list unconditionally — only call() consulted
OPENPENCIL_DEBUG_TOOLS. A production client (flag unset) still saw the
debug tool in its catalog and could invoke it, getting a bare
ToolFailed. That leaks the debug surface into the production catalog.

Gate it everywhere instead of only at call time: rebuild_registry
registers the tool only when debug_tools_enabled(), and
tools_list_response appends the debug schema — now a separate
DEBUG_TOOL_SCHEMAS const, removed from TOOL_SCHEMAS — only when the
flag is set. A client without the flag never sees the tool at all,
matching the TS design where debug tools ship only in a debug build.

debug_tools_enabled() is promoted to pub and re-exported from op-mcp.
The tools/list catalog test now exercises both gate states (82 tools
flag-off, debug tool present flag-on).
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.

1 participant