Lint Fix all + Ask AI actions in the Problems panel (#2710)#674
Merged
Conversation
* feat(open-knowledge): lint Fix all and Ask AI actions in Problems panel Problems panel gains a Fix all button in both tabs: doc scope applies every fixable diagnostic client-side in one undoable transaction (applyLintFixes is now overlap-safe, mirroring upstream applyFixes skip semantics); project scope sweeps fixable files sequentially through POST /api/lint/fix with progress, partial-failure toasts, and an audit refresh. handleLintFix now resolves identity via extractActorIdentity: MCP agent callers keep agent attribution, bare UI bodies land as the principal (no phantom presence badge), and the anonymous edge proceeds without a contributor record. Desktop rows also get Ask AI: composeLintFixPrompt grounds one diagnostic (doc mention, rule, line, column, message, offending line) and types it into the live agent terminal via requestActiveTerminalInput, or launches Claude when none is open. Web hosts hide the button. * feat(open-knowledge): show fixable count on the Fix all button Both Problems scopes label the button with how many problems carry a deterministic auto-fix, e.g. Fix all (3), so the click's effect is sized before it happens. Counts problems, not files, in both tabs. * fix(open-knowledge): audit skips hidden paths; fix-all toast names the failure The project lint audit walked into hidden directories, so a dirty .ok/skills/*/SKILL.md surfaced as an unfixable, unnavigable row and made the Fix all sweep report a failure: the fix endpoint refuses docNames with hidden segments. The walk and the scoped targetPath now apply the same hidden-segment rule as validateDocName, keeping audit scope symmetric with write addressability (precedent #55). The partial-failure toast also names the first failing file and the server reason instead of only a count. * fix(open-knowledge): ok lint walk skips hidden paths like the audit Same .ok exclusion the project audit gained: the CLI sweep no longer walks into hidden directories. An explicitly named hidden file still lints. * fix(open-knowledge): lint audit reads live CRDT source for loaded docs The audit linted disk files while /api/lint/fix lints the live CRDT. When the two diverge (persistence debounce, or a historically lost flush), the project Fix all sweep wedges: the audit keeps reporting problems the live doc no longer has, every fix is a clean no-op, and the count never moves. lintDoc and auditProject now accept a liveSourceFor overlay; the lint and audit handlers feed it from the loaded-documents map, so lint reads agree with the editor and the fix endpoint by construction. Disk remains authoritative for unloaded docs. * fix(open-knowledge): doc-scope Problems row uses full-width message, actions bottom-right The Fix / Ask AI buttons sat in the row's horizontal flex, so their (invisible-until-hover) width squeezed the diagnostic message even at rest. Pull them out of flow into an absolute bottom-right overlay revealed on hover/focus; the message now spans the full row and wraps like the project scope. A bg-muted matching the row hover cleanly occludes the subline. * fix(open-knowledge): guard project sweep against unmount; a11y polish Review follow-ups on the Problems panel: - The project Fix all sweep is fire-and-forget; guard it with a mounted ref so it stops posting fixes (and skips setState) if the panel unmounts mid-sweep, and wrap the trailing re-audit in try/catch so a failure surfaces the Try-again state instead of an unhandled rejection. - Drop the static Fix all aria-label during a sweep so the visible Fixing N/M progress is the accessible name instead of a frozen count. - Add aria-hidden to the RefreshCw icon (matches every other icon in the file). - Test the null-errorDetail toast path (filename only, no dash suffix). * fix(open-knowledge): second lint-review round + rebase test resolution Re-review polish on the Problems panel: - fixLintDoc logs a schema-drift console.warn on parse failure, matching the sibling fetchLintConfig/runLintAudit diagnostics. - loadAudit guards its post-await setAudit with the mounted ref, so the success path matches the sweep's already-guarded catch. - The action overlay's transition-opacity gets motion-reduce:transition-none. - A visually-hidden role=status live region announces sweep progress to screen readers (the disabled button can't be focused), rendered only while sweeping so it never collides with the loading skeleton's status role. Also reconciles prompt-composer.test.ts after rebasing onto main's terminal transport work: both the new terminal-transport tests and the composeLintFixPrompt tests are retained. GitOrigin-RevId: 79cd346ff4158b6c9284b68ca094403d7fdaa399
|
|
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.
Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.