Repository navigation
feat(knowledge): edit a folder source's ignore patterns after adding it - #31410
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the edit route is narrow, every field is checked before anything is written, and the keep-and-freeze rule matches the maintainer ruling on #17371. Notes
[DESIGN-REVIEWED] cd7d812 Description read[DESCRIPTION-READ] 18f8261fa0da74dccee11ad32791cf124bf279b475298170398c228aa968ad74 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item serves the frozen Goal: edit a folder source's patterns without losing indexed content. The keep rule is the "without losing anything" half of that Goal, not a rider. Not checked: the maintainer ruling on #17371 that kept files stay frozen; the issue is not readable here. Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: let a user change a folder source's ignore patterns after adding it, keeping what is already indexed. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] cd7d812 Description read[DESCRIPTION-READ] ec4cb219fcd858c09cdac850babd7750f07e68f037266593bb138fc2c5fd8ed0 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the Evidence gaps
Notes
[UX-REVIEWED] cd7d812 Description read[DESCRIPTION-READ] a32471fa6e02207d8ca12799e84993dee4576290c0d4e169a215d84176370064 That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
758a435 to
dabfcb2
Compare
|
self-added: yes
|
|
dabfcb2 to
9c97577
Compare
|
Backend Tests (3.12, 2) and Backend Tests (Windows) (2) fail on test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget, which is red on main as well (this PR touches nothing under src/kiro_crew/security). #31625 raises that budget; this PR will rebase onto it once it merges. The other reds on 9c97577 (facade manifest entry, bn/hi register for the Save button) are fixed in the next push. |
Pull request was closed
9c97577 to
a31eccd
Compare
bee8b94 to
45239da
Compare
|
On 45239da every review lane passes. The remaining reds are both main's: test_the_package_stays_within_its_line_budget (fixed by #31625, now merged) and test_pull_request_target_allowlist.py::test_only_the_allowed_workflows_use_pull_request_target (tracked in #31771, no fix merged yet). This PR touches neither area; it will rebase once the #31771 fix lands. |
45239da to
ad6f83e
Compare
A folder source's ignore patterns could only be set when the source was
added; fixing a missed pattern meant removing the source and indexing
the whole folder again. The expanded folder row in the Knowledge panel
now has a pattern editor, and PATCH /api/knowledge/sources/{id} accepts
ignore_patterns for a folder source.
An edit never removes indexed content: the folder sweep keeps an
indexed file that only the ignore patterns now exclude, and stops
updating it. Deleting the file, or any other rule excluding it, still
removes it as before. Purging already-indexed matches is left for a
later change.
Closes #17371
ad6f83e to
cd7d812
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on cd7d812, no conflict, no open change request.
…hile they save (#33453) A native disabled button leaves the tab order, so pressing one from the keyboard drops focus to the page until the request settles. Mark each busy button aria-disabled (and aria-busy) and guard the press instead, the way the knowledge Generate now button already does. Visual disabled styling is unchanged. The ignore-pattern Save keeps its native disabled only for the unchanged (nothing-to-save) state, which is inert, not in flight. Co-authored-by: kirocrew-agent <agent@kirocrew.local> Backport note: release has no IgnorePatternsEditor.tsx (the editor comes from feat #31410, unreleased), so only the DetailView hunks are taken, and the test drops its ignore-patterns Save case. (cherry picked from commit 359e4ef)
…hile they save (#33453) A native disabled button leaves the tab order, so pressing one from the keyboard drops focus to the page until the request settles. Mark each busy button aria-disabled (and aria-busy) and guard the press instead, the way the knowledge Generate now button already does. Visual disabled styling is unchanged. The ignore-pattern Save keeps its native disabled only for the unchanged (nothing-to-save) state, which is inert, not in flight. Co-authored-by: kirocrew-agent <agent@kirocrew.local> Backport note: release has no IgnorePatternsEditor.tsx (the editor comes from feat #31410, unreleased), so only the DetailView hunks are taken, and the test drops its ignore-patterns Save case. (cherry picked from commit 359e4ef)
os.walk skips a directory it cannot list, and the folder walk skipped a file it could not stat. Either can be transient: a permission change, or a network mount that drops out mid-walk. The scan then read every tracked file in that gap as deleted and removed its indexed items, which only a fresh, paid re-ingest brings back. Record the directories the walk could not list and the files it could not stat, and keep their rows and items. A file that is really gone is still removed. A file whose stat answers not-found (or not-a-directory) is gone, so it is still removed: it was deleted after the listing, or it is a symlink whose target is gone. An AsciiDoc includer whose target the walk could not see keeps its indexed text too. Backport note: conflicts only where main's hunks sit next to the ignore-pattern keep of #31410 (unreleased). folder_watcher.py adds the unlisted and unlisted_real sets to release's step 1 walk call (which has no tracked or pattern_ignored arguments) and the not-unseen check to release's removed list; _walk gains only the two new keywords. knowledge.md adds the two new sentences to release's bullets, without main's ignore_patterns paragraph. The test applies as on main. (cherry picked from commit 73e3275)
Problem / Motivation
Goal: Let a user change a local folder source's ignore patterns after adding it, without removing the source and without losing anything already indexed.
A folder source's ignore patterns can only be set in the add-source form. A pattern missed at that point (for example a generated subfolder of ~1,600 notes) leaves two bad options: remove the source and index the whole folder again, or hand-edit the stored properties.
Why it matters
Large folders and vaults are the sources most likely to need a pattern added later, and the most expensive to index again. Re-adding a source throws away its indexing progress and spends model calls on content that was already in the Library.
Not a goal
.kiroignore, the sensitive-path guard,confine_to_rootor the extension and size filters treat a file they exclude: they still remove it on the next sweep.What changed (motivation → approach → change)
Opening a folder row in the Knowledge panel now shows its ignore patterns in an editable box with a Save patterns button. Saving changes which files future sweeps pick up. It never removes anything already indexed.
PATCH /api/knowledge/sources/{id}(dashboard/handlers/knowledge_sources.py) acceptsignore_patternson alocal_folderorobsidian_vaultsource: a list of strings, trimmed, blank lines dropped.nameis optional when patterns are sent, and every field is checked before anything is written. The write goes throughmerge_source_properties, so other properties are kept; a source deleted mid-request gets 404source_not_foundand no audit line. Each refusal carries acode.folder_watcher.pykeeps a tracked file that only the ignore patterns now exclude, as long as its row still holds indexed items. That file is frozen: it is not re-read and gets nolast_seenupdates. Deleting the file, or any other rule excluding it, still archives it. Only tracked files go through the remaining rules before the pattern decides. Any other matched file is dropped before it is resolved or stat'ed, as onmain. A kept row leftpending(a Retry) orscanning(an interrupted re-read) is writtendonewith an empty bytes hash, so progress completes and a later un-ignore re-reads the file.IgnorePatternsEditor.tsxsits in the expanded folder view above the progress list. A visible Ignore patterns label names the box. A visible line under it gives the format (one pattern per line, matched against the file's path inside the folder;*matches any characters,/included; case-sensitive) and describes the box, so it stays when saved patterns hide the placeholder. It has a hint that matching indexed files are kept and no longer updated, and it shows errors throughErrorNotice. Three new catalog keys are added in all 12 locales underwebsite/src/i18n/locales/, anden-XAis regenerated.knowledge.mdspec describes the edit route and the keep rule. The feature map lists the editor and the route. Thekiroignore.pyandbundle_ownership.pycomments are updated to match the keep rule.A kept AsciiDoc includer keeps the included text it was indexed with, like any other frozen copy.
Backwards compatibility
Breaking: the route now checks
ignore_patternswhen it is sent. Onmainit ignored every key exceptname. So{"name": ..., "ignore_patterns": <not a list of strings>}, orignore_patternssent to a non-folder source, used to succeed and is now refused with 400.{"name": ...}alone behaves as before. Writer sweep on origin/main @ 665a0e4: the only caller that sends PATCH to/api/knowledge/sources/{id}is the Sources list rename, and it sends{ name }only. No app, CLI, MCP tool or doc calls this route.Behaviour change: on
main, the next sweep archives a tracked file that newly matchesignore_patterns. That case was only reachable by hand-editing the stored properties. Such a file is now kept, as the maintainer ruling on #17371 asks.Reader: website/src/pages/knowledge/SourcesList.tsx:renameMutation -- crew page -- sends
{ name }only; website/src/test/SourcesList.rename.test.tsxReader: src/kiro_crew/knowledge/folder_watcher.py:FolderWatcher._do_scan -- crew page -- the step-4 removal still archives every row a non-pattern rule excludes; test/test_folder_watcher.py::TestEditedIgnorePatterns::test_a_newly_ignored_file_another_rule_excludes_is_still_archived
Tests
test/test_folder_watcher.py::TestEditedIgnorePatterns: an indexed file that a new pattern matches keeps its row and items and is not re-ingested, even when edited. This holds for adonerow and for afailedrow that still holds items. A kept row inpendingorscanningendsdoneafter one sweep and is re-read once the pattern is dropped. A new file under the pattern is not ingested. A file that.kiroignorealso excludes is still archived, which pins that patterns are tested after every other rule.test/test_folder_watch_handlers.py::TestEditIgnorePatterns: patterns are trimmed and blanks dropped, other properties and the name are kept, a non-folder source or a non-list value is refused without any write, and a source deleted before the write gets 404.website/src/test/SourcesList.ignorePatterns.test.tsx: the expanded folder row shows the saved patterns, the box has a visible label bound to it and is described by the format line, Save stays disabled until they change, and the edited list is PATCHed trimmed.-n0, 10 times at-n 4beside their files' other tests, and once in a shuffled order.Proof: PROVEN test/test_folder_watch_handlers.py::TestEditIgnorePatterns::test_a_folder_source_takes_trimmed_patterns_and_keeps_its_other_properties, test/test_folder_watch_handlers.py::TestEditIgnorePatterns::test_a_non_folder_source_or_a_non_list_is_refused_unwritten[local_file-patterns0], test/test_folder_watch_handlers.py::TestEditIgnorePatterns::test_a_non_folder_source_or_a_non_list_is_refused_unwritten[local_folder-sub/*], test/test_folder_watch_handlers.py::TestEditIgnorePatterns::test_a_non_folder_source_or_a_non_list_is_refused_unwritten[local_folder-patterns2], test/test_folder_watch_handlers.py::TestEditIgnorePatterns::test_a_source_deleted_before_the_write_is_a_404_not_a_success (head b4796960d87b)
Manual verification
The real
IgnorePatternsEditorwas rendered in a throwaway capture page with a saved pattern list, served by a Vite dev server on 127.0.0.1, and shot with Playwright in both themes. The label, box, hint and Save button render as shown below. The backend was checked by the unit tests above.Screenshots / video
The pattern editor with its visible label and saved patterns (dark, light):
Related Issues
Closes #17371
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.