Skip to content

feat(overview): add search and inline editing to lessons table (#17982) - #18831

Closed
bhumin18 wants to merge 3 commits into
kirodotdev:mainfrom
bhumin18:feat/lessons-search-edit
Closed

bhumin18 wants to merge 3 commits into
kirodotdev:mainfrom
bhumin18:feat/lessons-search-edit

Conversation

@bhumin18

@bhumin18 bhumin18 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Enable users to quickly search and filter lessons by rule text and edit existing lesson rules inline on the Overview Memory tab.

Users managing accumulated memory records could not filter lessons by text query and had to delete and re-create a rule if they needed to update its wording.

Why it matters

As the memory knowledge base grows, browsing hundreds of rules to find or tweak a specific guideline becomes cumbersome. Direct filtering and inline edits streamline memory curation.

Not a goal

  • Changing backend lesson storage format or schema.
  • Batch editing multiple lessons at once.

What changed (motivation → approach → change)

  • Search input: Added a <SearchInput> component above the lessons table with client-side case-insensitive filtering over the loaded lessons window and a FilteredEmpty state with a clear filter action.
  • Inline editing: Added an inline rule edit trigger that renders an <Input> with Save (Enter) and Cancel (Escape). Creation occurs first via api.createLesson(...); the old rule is deleted only after creation succeeds (inserted or enriched) to prevent data loss. If creation is refused or fails, the original row is preserved and the draft remains open. Unusable-scope rows (repo_scope: null) do not offer editing to prevent silent global promotion.
  • Field & attribute preservation: Updated createLesson in website/src/api/client/memory.ts and types/index.ts to support applies and preserve existing category, scope, repo_scope, workspace, and applies attributes across updates.
  • Localization: Added localized strings (search_lessons, edit, cancel, edit_rule, edit_failed) across all 13 locale catalogs.
  • Media evidence: Committed high-resolution screenshot evidence under temp-screenshots/17982-lessons-evidence/ for normal, filtered-empty, and inline-editing states.

Backwards compatibility

Compatible: All memory API payloads and props remain backward compatible with existing lesson schemas.
Removes nothing: No existing APIs, components, or fields are removed.

Tests

  • Added full test suite in website/src/test/MemoryTab.lessonsSearchEdit.test.tsx verifying:
    • Text search filtering with match count and filtered empty state.
    • Inline editing mode activation, save with Enter, and cancellation with Escape.
    • Creation-first order and preservation of scope, workspace, category, and applies.
    • Refused or failed creation safety leaving the original lesson intact without deleting.
    • Disabling edit action for unusable-scope (repo_scope: null) rows.
  • Verified TypeScript type checking (tsc -p tsconfig.app.json).
  • Verified ESLint on all touched files (0 errors).

Manual verification

Verified via headless browser screenshot capture across normal, filtered-empty, and editing states.

Screenshots / video

Committed evidence under temp-screenshots/17982-lessons-evidence/:

  • temp-screenshots/17982-lessons-evidence/01-lessons-table-normal.png (Lessons table with search box and actions)
  • temp-screenshots/17982-lessons-evidence/02-lessons-table-filtered-empty.png (Filtered empty state with clear action)
  • temp-screenshots/17982-lessons-evidence/03-lessons-table-editing.png (Inline editing input with Save and Cancel)

Related Issues

Closes #17982

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bhumin18
bhumin18 requested review from a team and KiroCrewCaptain as code owners October 10, 2026 10:55
@bhumin18
bhumin18 requested a review from dodgeblaster October 10, 2026 10:55
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of a2e50ab01ccb03d55cdcaa819849269779438842 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing the failed-edit state. No screenshot shows the new "Could not update the lesson" or "Lesson updated, but the list could not be refreshed" notice. That notice also renders above the table, away from the row being edited.

Evidence gaps

  • Failed save, draft kept open: no screenshot shows the edit_failed notice, or the "already stored" / "already covered" messages it now carries, alongside the still-open draft. To close it, add a screenshot of a refused or failed save with the draft open.
  • List refresh fails after a successful save: no screenshot shows the lessons_refresh_failed_edit notice. To close it, add a screenshot of that state.
  • Row whose scope is unusable: no screenshot shows a lesson with repo_scope: null offering Delete but no Edit. To close it, add a screenshot of one.

Notes

  • In edit mode the When cell is clipped. 03-lessons-table-editing.png shows "10/1/2026, 3:30:00 PI" because Save and Cancel are wider than Edit and Delete. Give the actions cell a fixed width, or let the timestamp wrap.
  • The edit error appears in an ErrorNotice above the table, not in the row. On a long filtered list the user can't see it from the row where they pressed Save. Show the message under the textarea in the editing row.
  • Search filters every lesson, while an empty query shows only the 20 most recent. Clearing a search makes matching rows outside those 20 disappear without explanation. Show a count, such as "Showing 20 most recent", when the query is empty.

[UX-REVIEWED] a2e50ab

Description read

[DESCRIPTION-READ] 91aab5a698b0bac02a81d19fd8ec9076f15137b2dc4be8cf326f1e5c5fd43770

That sha256 names everything this verdict read: the PR description, plus the 6 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of a2e50ab01ccb03d55cdcaa819849269779438842 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No blocking design problem. Server-side replaces keeps the edit to one write and is additive to the API, and committed screenshots cover the new surface.

Notes

  • The description does not match the diff. It says "the old rule is deleted only after creation succeeds" and lists backend schema changes as "Not a goal", but the patch adds a server-side replaces parameter to POST /api/lessons, learn.save_or_enrich and write_lesson, plus new bare_rule and negative fields in the GET /api/lessons response. Describe the backend contract that actually ships.
  • An edit on the V1 vector path still runs the substring, topic and embedding dedup, so saving one row can retire other lessons. saveEdit drops createRes.superseded, so those rows disappear with no notice. Show the superseded rules after a successful edit.
  • The search filters the full lessons list, while the empty query shows only the last 20. The description says "the loaded lessons window", so either the code or the description should change.

[DESIGN-REVIEWED] a2e50ab

Description read

[DESCRIPTION-READ] cc57a088f018c25ee27d4a5f384468aaeb33c572754dab5935f7949af7d6c109

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of a2e50ab01ccb03d55cdcaa819849269779438842 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. One wire field has no reader, and the description describes a client-side delete that the diff does not do.

Notes

  • Item 9 — zero consumers: the GET response adds result["negative"] = ... and createLesson gains a negative?: option, but nothing in website/src reads l.negative or passes negative (grepped \.negative|negative: in non-test files: 0 hits). Subtraction: delete the negative key from api_lessons's row builder, the negative option and spread in memory.ts, and negative? on Lesson.
  • Item 6 — undeclared: the description says "the old rule is deleted only after creation succeeds". The diff instead adds a server-side replaces to save_or_enrich/write_lesson, and the test asserts "client must NOT call deleteLesson". The mechanism is justified, because without it the shortened-edit test would be deduped against its own original. Only the prose is stale.

What this change ships

Inventory (10 items) — 7 justified

Intent: let users find lessons by text and reword one in place on the Memory tab. ADDITION.

  1. Search box above the lessons table filters rows by rule text — justified
  2. While searching, matches come from all loaded lessons, not just the latest 20 — justified
  3. Filtered-empty state with a clear action — justified
  4. Per-row Edit (absent on unusable-scope rows) opens an inline editor with Save/Cancel and Enter/Escape — justified
  5. An unsaved edit draft trips the leave guard and asks before you switch rows — justified
  6. POST /api/lessons accepts replaces, retiring the edited row atomically in both stores — undeclared; description says client deletes
  7. An edited rule keeps the old NOT-clause when none is given — justified
  8. GET /api/lessons returns bare_rule — justified
  9. GET /api/lessons returns negative; createLesson gains a negative option — zero consumers
  10. Screenshots committed under temp-screenshots/ — justified

[FIRST-PRINCIPLES-REVIEWED] a2e50ab

Description read

[DESCRIPTION-READ] e4f9f325bfd90d047934eb5db23049dae0a6c9dc79c7ea9af5468ddd890c97c7

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

Reviewed a2e50ab01ccb03d55cdcaa819849269779438842 via the fork AI-review pipeline; updated in place on each push.

2 of 2 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- src/kiro_crew/learn.py:598 -- Editing into an existing rule permanently drops the original NOT-clause

if outcome == "unchanged" and replaced_original:
Trigger: With vector memory disabled, edit a JSONL lesson carrying a NOT-clause to another existing rule in the same scope that has no clause. saveEdit omits negative; api_lessons_create calls save_or_enrich, which matches the destination and removes the original.
Outcome: The write reports enriched, but the original clause disappears permanently: inherited_negative is applied only when not matched, so subsequent context injection loses that instruction.
Anchor: residual/crash-data-loss-corruption
Fix: Resolve the inherited clause before exact-match enrichment; refuse an incompatible merge without retiring the original.

BLOCKING -- website/src/pages/overview/MemoryTab.tsx:400 -- Redacted replacement selectors silently create a second lesson

replaces: bareRule,
Trigger: Edit a JSONL knowledge lesson whose rule contains a private-key header mentioned in prose. api_lessons redacts bare_rule; saveEdit sends that altered text as replaces, and save_or_enrich compares it against the unredacted stored rule.
Outcome: No original matches the selector, so a distinct edited rule is inserted and the editor closes successfully while the original instruction remains stored and active.
Anchor: defect
Fix: Address replacements through a stable selector unaffected by redaction, or mark identity-redacted rows non-editable and reject their inline saves.

[BLOCK-MERGE] a2e50ab
[GPT-REVIEWED] a2e50ab

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 stays fenced as written. Merging a lesson into an existing rule is an ordinary edit, and the NOT-clause is lost silently and for good.

  • In the diff's learn.py, the original row is retired and its clause goes into inherited_negative (patch lines 248–257).
  • The destination row matches as unchanged, then gets relabelled enriched (patch lines 214, 229, 265–266).
  • inherited_negative is only applied when nothing matched (patch lines 271–276), so the clause is dropped. Nothing restores it, and the edit box shows only the bare rule (patch lines 1148, 1187–1192).

F2 is flagged; a writer could reasonably accept the risk.

  • Listed lessons have their rule text redacted (cron_lessons.py:989), and the edit sends the redacted text as replaces (patch line 1192). A row with a credential-like pattern then matches nothing, and a second row is inserted.

  • It only happens on a lesson whose rule text trips the credential redactor, which is rare.

  • Nothing is lost or exposed. The original is untouched, the new row holds only the redaction placeholder, and the duplicate is visible in the lessons table after a refresh.

    [ADJUDICATION] a2e50ab total=0 uphold=0 downgrade=0
    [GPT-ADJUDICATED] a2e50ab

    [ADJUDICATION-FENCED] a2e50ab fenced=2 flagged=1
    UPHOLD-FENCED F1 src/kiro_crew/learn.py:598 -- Editing a clause-bearing lesson into an existing same-scope rule is a normal way to merge duplicates, and the retired row's NOT-clause is silently and permanently dropped because inherited_negative is applied only on the not-matched insert path.
    FLAG F2 website/src/pages/overview/MemoryTab.tsx:400 -- Only a lesson whose rule text trips the credential redactor (cron_lessons.py:989) is affected, and the outcome is a visible extra row holding only the redaction placeholder, while the original stays intact, so nothing is lost or exposed.
    [GPT-ADJUDICATED-FENCED] a2e50ab

🏷️ Fenced finding(s) machine-flagged as likely edge case

The security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override recorded by a repository writer, who must independently verify a rationale before recording it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop. (This lane's comment deliberately carries no override command.)

  • F2 website/src/pages/overview/MemoryTab.tsx:400 — Only a lesson whose rule text trips the credential redactor (cron_lessons.py:989) is affected, and the outcome is a visible extra row holding only the redaction placeholder, while the original stays intact, so nothing is lost or exposed.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — 🔴 changes requested (blocking)

Reviewed a2e50ab01ccb03d55cdcaa819849269779438842 via the fork AI-review pipeline; updated in place on each push.

BLOCKING: an inline edit of a lesson whose rule text gets redacted sends the masked text back as the new rule and as replaces. The original lesson is never retired, and a duplicate with the redaction placeholder in it is saved, while the UI reports success.

BLOCKING — src/kiro_crew/dashboard/handlers/cron_lessons.py:1029
result["bare_rule"] = _redact_memory_field(bare_rule.strip()) (MemoryTab: setEditingText(bare) … replaces: bareRule)
Trigger: a stored lesson's rule holds a token or URL that _redact_memory_field masks. Nothing on the write path refuses credential-shaped rule text, and memory_edit.py already treats such stored records as real. The user clicks Edit, changes a word and saves. GET /api/lessons returns the masked bare_rule, which pre-fills the textarea. POST /api/lessons then sends the masked text as rule and as replaces. Both LessonStore._insert_or_enrich (le_norm == replaces_clean) and write_lesson._is_replaced_row (stored_r == replaces_clean) compare it against the raw stored rule, so nothing matches.
Outcome: the route answers inserted and the editor closes as if the edit worked. The original row, secret included, stays in the store and keeps being injected. A second lesson is stored with the redaction placeholder written into its rule text. The user ends up with a duplicate and a corrupted rule.
Anchor: defect
Fix: mark a lesson as not editable inline when redaction changed its rule. Have _safe_lesson emit a flag that canEditLesson checks, the same way memory_edit refuses redacted records with memory_record_redacted. Also have the server reject a replaces that matched no row instead of silently inserting.

Notes:

  • temp-screenshots/17982-lessons-evidence/*.png are review screenshots committed at the repo root.

[BLOCK-MERGE] a2e50ab
[OPUS-REVIEWED] a2e50ab

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 12, 2026
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch from bf55d3e to eefc2a3 Compare October 16, 2026 12:41
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 16, 2026
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch from eefc2a3 to 3b88709 Compare October 21, 2026 00:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 21, 2026
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch from 3b88709 to b3374e4 Compare October 21, 2026 11:31
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 21, 2026
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch 2 times, most recently from e549447 to 589c50c Compare October 24, 2026 04:56
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 24, 2026
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch from d77186c to 53b5e95 Compare October 24, 2026 10:09
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch 3 times, most recently from afca62d to 64337b2 Compare October 26, 2026 06:50
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch 2 times, most recently from 7808382 to 0ecae84 Compare October 29, 2026 13:09
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 29, 2026
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch from 8b7dc44 to a2e50ab Compare October 30, 2026 12:01
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 30, 2026
…otdev#17982)

Add text search filtering over loaded lessons and in-place rule editing
to the lessons table on the Overview Memory tab, creating the replacement
before deleting the original to prevent data loss and preserving category,
scope, workspace, and applies attributes.

Includes committed screenshot evidence under temp-screenshots for
normal, filtered-empty, and editing states.
@bhumin18
bhumin18 force-pushed the feat/lessons-search-edit branch from a2e50ab to e76692e Compare October 31, 2026 05:06
@bolichen97

Copy link
Copy Markdown
Contributor

[operator: bolichen97] Continuing this in #31438; thanks for the start.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 7, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks for this work, @bhumin18. Search and inline editing in the memory tab's lessons now ship on main through #31438 (merge commit d4dfaad), which continued from this PR, and issue #17982 is closed as completed. Closing this one as superseded. If something here is not covered by #31438, please open a new issue and we can pick it up.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lessons table: add text search and inline edit of a rule

3 participants