feat(open-knowledge): WYSIWYG ⇄ source toggle for JSON markdownlint config files (#2723)#719
Merged
Merged
Conversation
…onfig files (#2723) * [US-001] Add core markdownlint JSON config-file predicate Core now owns the markdownlint native config filename list and a isMarkdownlintJsonConfig(basename) predicate so the browser editor can decide, without a server round-trip, when to offer the rule-editing toggle. Scope is JSON/JSONC only, matching the format-preserving writer. The server keeps its own discovery copy for now. * [US-002] Add lint-config view-mode persistence hook * [US-003] Add JSONC round-trip guard test for markdownlint writer * [US-004] Add LintConfigEditor Source/Rules toggle component * [US-005] Dispatch markdownlint config files to LintConfigEditor * [qa] Add lint-config toggle E2E coverage * fixup! local-review: address findings (pass 1) * [US-004] Fix lint-config Rules view: add padding, vertical scroll, max-width The rule browser has no scroll/padding of its own — in Settings it inherits both from the dialog body. Mounted standalone it rendered edge-to-edge and clipped vertically. Give the Rules view its own scroll container + content gutter; Source stays full-bleed (CodeMirror owns its scroll). * chore(open-knowledge): add changeset for lint-config WYSIWYG toggle * chore(open-knowledge): regenerate ng-anchors catalog for new core/markdown file The lint-config predicate adds a file under packages/core/src/markdown/**, which the md-audit ng-anchors catalog enumerates (productionFileCount 99 -> 100). Refresh the committed catalog so the freshness gate passes. * fix(open-knowledge): announce disabled lint-config toggle reason via aria-describedby aria-description is an ARIA 1.3 draft attribute with uneven screen-reader support. Point aria-describedby at a visually-hidden element carrying the reason instead, so the disabled Rules segment's unavailability is announced by mainstream screen readers. * fix(open-knowledge): carry NotInSidebarIndicator in the lint-config editor AssetPreview renders NotInSidebarIndicator on every asset surface so a file opened outside the sidebar (a hidden config dotfile is exactly this case) advertises the reveal affordance. LintConfigEditor replaced AssetPreview for configs and dropped it; add it back with the same placement. Self-gates to null when the file is visible. * test(open-knowledge): drop e2e waitForTimeout for a deterministic config check waitForTimeout is a Playwright anti-pattern. Replace the fixed 500ms 'stays disabled' guard with a deterministic GET /api/lint/config assertion (server reports the gating input), then re-assert disabled — the pattern the null-config case already used. * test(open-knowledge): pin the Source-segment tooltip sourceLabel override Symmetric with the existing Rules-tooltip test — guards against a refactor that drops the sourceLabel ternary and silently shows 'Markdown' for the config editor. * feat(open-knowledge): hide the rule-browser config source note in the lint-config editor When the rule browser is opened on the config file itself, the 'these rules come from <file>' note is redundant — the user is already looking at the file. Add an optional hideConfigSourceNote prop (default off, so Settings is unchanged) and set it from LintConfigEditor. The Modified-badge legend stays. * ci(open-knowledge): raise integration-shard budget to 25 min Main-added integration suites (CmdPalette/Timeline/crash-detection/ rendered-diff) pushed test:integration:shard1 past the shared 15-min cap — cancelled at ~15:17 on every attempt across branches (this PR and fix-pr-cla alike) while shard2 finishes ~9 min. Same remedy as the unit and DOM tiers: per-task matrix timeout of 25. * test(open-knowledge): RED pin for byte-preserving rename in timeline no-op filter The existing rename-history unit tests perform a byte-CHANGING rename (`# A v1` -> `# B v1`), so the rename commit's blob differs from its predecessor and never reaches the byte-identical no-op filter added in #2607. A real managed rename (`/api/rename-path`) preserves the doc's bytes and only changes the path, so the rename commit's blob is byte-identical to the pre-rename version — and `dropByteIdenticalRows` drops it, silently losing the rename event from the timeline. This adds a unit-tier RED pin using a byte-preserving rename, matching the invariant the two failing integration tests in rename-history.test.ts encode. * fix(open-knowledge): timeline no-op filter drops managed-rename commits Root cause: `dropByteIdenticalRows` in timeline-query.ts (added in #2607) drops any non-checkpoint timeline row whose document blob OID equals the adjacent-older visible version. A managed rename changes the doc's PATH, not its bytes, so a rename commit's blob is byte-identical to the pre-rename version — the filter dropped it, silently removing the rename event from the timeline. This broke the rename-history invariant (the timeline must span file renames): the destination doc's timeline lost the rename commit SHA, so `getDocumentHistory` no longer surfaced the name epoch boundary. Fix: treat managed-rename commits as name-epoch landmarks, exactly like checkpoints — never dropped, never a byte baseline. The rename commit SHAs are already available on the `chain` passed to the function (`chain[i].renameCommit`, set from the rename-log entry's commitSha in rename-log.ts). A shared `isLandmark` predicate replaces the two checkpoint-only skip checks. Fixes the two failing integration tests in rename-history.test.ts (`file rename round-trip` and `chained A->B->C`) and is pinned at the unit tier by the byte-preserving-rename test added in the prior commit. * test(open-knowledge): migrate PR-touched tests off the bun:test shim PR #2757 added a diff-scoped CI guard (scripts/check-no-new-bun-test-imports.mjs) that fails any file a change adds or modifies if it still imports the `bun:test` compat shim; the ~1,900 untouched files stay grandfathered. These 7 test files are touched by this PR, so they must import from `vitest` directly. Migration per the guard/shim guidance: - `from 'bun:test'` -> `from 'vitest'` (all 7 files). - `test.if(cond)` -> `test.runIf(cond)` (markdownlint-write). - `mock()` -> `vi.fn()`, `spyOn` -> `vi.spyOn` (useLintConfigViewMode). - `mock.module(path, factory)` -> `vi.doMock(path, factory)` in the three DOM tests, which already register mocks before a dynamic `import()` of the SUT — the mock-then-dynamic-import shape the shim emulates. Calling vi.doMock directly from the test keys the mock against the test module (correct resolver base), which is exactly what the shim's bare-specifier path works to reproduce. Behavior-preserving: no assertion, mock, or test-count changes. Biome organizeImports reordered the swapped import lines. Per-file test counts unchanged (core 3, markdownlint-write 25, timeline-query 33, EditorArea dispatch 5, LintConfigEditor 12, rule-browser 28, useLintConfigViewMode 22). * chore(open-knowledge): raise combined-chunks size budget 3.35 -> 3.36 MB An 18-commit catch-up merge of main pushed the merged combined-chunks total 461 B over the 3.35 MB budget (CI measured 3,350,461 B). The lint-config feature's chunks are unchanged; growth is concurrent main features (OpenClaw/Hermes targets, bundle checkpoint refs, FileTree refactor, crash-capture line, et al.). Same catch-up-merge bump convention as the prior raises documented in the package.json comment. --------- GitOrigin-RevId: 0950dbf8a8260c9c350bbef077645b4528102298
|
|
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.