Skip to content

fix(kits): add missing delete button to single kit edit modal#106

Merged
adnaan merged 2 commits intomainfrom
kit-feature-parity
Feb 19, 2026
Merged

fix(kits): add missing delete button to single kit edit modal#106
adnaan merged 2 commits intomainfrom
kit-feature-parity

Conversation

@adnaan
Copy link
Copy Markdown
Contributor

@adnaan adnaan commented Feb 15, 2026

Summary

  • Add missing delete button to single kit's monolithic template.tmpl.tmpl edit modal, matching the multi kit's Update | Delete | Cancel pattern
  • Add feature parity test (kits_parity_test.go) that verifies both multi and single kit templates contain all critical CRUD UI features

Partially addresses #56

Test plan

  • go test ./internal/kits/ -run TestKitFeatureParity — parity test passes for both kits
  • go test ./... — full suite passes (28 packages, 0 failures)
  • Manually verify: generate a single-kit app, open edit modal, confirm delete button is present and functional

🤖 Generated with Claude Code

The single kit's monolithic template was missing a delete button in the
edit modal, unlike the multi kit which had Update | Delete | Cancel.
Add the delete button and a parity test to prevent future drift.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 15, 2026 18:51
@claude
Copy link
Copy Markdown

claude bot commented Feb 15, 2026

Pull Request Review - PR #106

Summary

This PR adds a missing delete button to the single kit's edit modal and introduces a feature parity test to prevent future drift between kit templates. The change addresses issue #56 and ensures consistency across kits.

✅ Strengths

1. Excellent Problem Identification

  • The PR correctly identifies and fixes a genuine UI inconsistency where single kit lacked delete functionality that multi kit had
  • The fix brings single kit to feature parity with multi kit

2. Strong Test Coverage

  • The new kits_parity_test.go test is well-designed and prevents regression
  • Test covers all critical CRUD operations: add, edit, update, delete, and cancel actions
  • Uses embedded filesystem (systemKits.ReadFile) correctly, consistent with existing test patterns in loader_test.go

3. Clean Implementation

  • The template change is minimal and matches the multi kit pattern exactly
  • Button includes proper attributes: danger class, delete action, confirmation dialog
  • Code follows existing conventions for button styling and LiveTemplate directives

4. Good Documentation

  • Clear PR description with summary and test plan
  • Test has descriptive comments explaining its purpose
  • Commit message follows conventional commit format

💡 Observations & Suggestions

1. Test Pattern Consistency (Minor)
The test uses strings.Replace(templatePath, "%s", kit, 1) instead of fmt.Sprintf. While this works, fmt.Sprintf might be more idiomatic:

path := fmt.Sprintf("system/%s/templates/resource/template.tmpl.tmpl", kit)

2. Limited Scope (Question, not blocker)
The issue #56 mentions auditing all three kits (multi, single, simple), but this PR only tests multi and single. Looking at the file structure, I notice there's no system/simple directory, only multi and single. Is the "simple" kit deprecated, or is it in a different location? If it's still relevant, should it be included in the parity test?

3. Test Robustness (Enhancement idea)
The test checks for presence of patterns but not their context. For example, it verifies lvt-click="delete" exists but doesn't verify it's:

  • Inside the edit modal (not somewhere else)
  • On a button element
  • Has the correct confirmation message

This is probably fine for the current use case, but a more robust approach might check for larger context strings. Not required for this PR, but worth considering for future iterations.

4. Feature Matrix Documentation (From issue #56)
The original issue mentions creating a feature matrix in a kit README. This PR doesn't include that documentation. Is that planned for a follow-up PR?

🔒 Security & Performance

No security concerns identified:

  • The delete button includes proper confirmation (lvt-confirm attribute)
  • Uses data attributes safely (lvt-data-id="{{.EditingID}}")
  • No injection vulnerabilities introduced

Performance:

  • Minimal impact - just one additional button in the template
  • Test is fast (simple string matching on embedded files)

📋 Code Quality

Strengths:

  • Clean, readable code
  • Follows Go conventions
  • Consistent with existing codebase patterns
  • No unnecessary complexity

Minor style notes:

  • Test is well-structured with clear test case definitions
  • Good use of subtests for each kit
  • Proper error handling with descriptive messages

✅ Final Recommendation

APPROVE with minor suggestions

This is a solid PR that:

  • ✅ Fixes a real UI inconsistency
  • ✅ Adds regression protection through testing
  • ✅ Maintains code quality and conventions
  • ✅ Has no security or performance concerns
  • ✅ Properly addresses the stated issue

The implementation is clean and the test strategy is sound. The suggestions above are minor enhancements, not blockers.

Suggested follow-up work (not required for this PR):

  1. Clarify the status of the "simple" kit
  2. Consider adding feature matrix documentation per issue [1.5] Ensure All Kits Have Feature Parity #56
  3. Consider more context-aware pattern matching in future test iterations

Great work on catching this inconsistency and adding preventive measures! 🎉


Review generated by Claude Code

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing delete action to the single kit resource edit modal and introduces a guardrail test to prevent CRUD UI feature drift between kits.

Changes:

  • Add a Delete button to the single kit edit modal (to match the multi kit’s Update | Delete | Cancel pattern).
  • Add TestKitFeatureParity to ensure key CRUD UI hooks are present in both multi and single monolithic resource templates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/kits/system/single/templates/resource/template.tmpl.tmpl Adds the missing edit-modal delete button in the single kit template.
internal/kits/kits_parity_test.go Adds a required-features template smoke test intended to prevent kit UI regressions.

Comment thread internal/kits/kits_parity_test.go Outdated
name string
pattern string
}{
{"delete button in edit modal", `lvt-click="delete"`},
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case labeled "delete button in edit modal" only checks for lvt-click="delete", which already exists in the table delete button. This means the test would still pass even if the edit modal delete button were missing (the regression this PR is trying to catch). Use a more specific pattern that uniquely identifies the edit modal delete button (e.g., lvt-data-id="{{.EditingID}}" and/or the lvt-confirm="Are you sure you want to delete this text).

Suggested change
{"delete button in edit modal", `lvt-click="delete"`},
{"delete button in edit modal", `lvt-data-id="{{.EditingID}}"`},

Copilot uses AI. Check for mistakes.
Comment thread internal/kits/kits_parity_test.go Outdated
Comment on lines +8 to +10
// TestKitFeatureParity verifies that multi and single kit monolithic templates
// contain the same critical UI features. This catches regressions where a kit
// template drifts from the expected feature set.
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment says this test verifies the kits "contain the same" features / "feature parity", but the implementation only checks that a fixed set of required patterns exist in each template; it does not compare the templates to each other or detect extra/missing features beyond the required set. Consider updating the comment (or the test name) to reflect that this is a required-features smoke test, or extend the test to actually assert parity.

Suggested change
// TestKitFeatureParity verifies that multi and single kit monolithic templates
// contain the same critical UI features. This catches regressions where a kit
// template drifts from the expected feature set.
// TestKitFeatureParity is a smoke test that ensures the multi and single kit
// monolithic templates all include a shared set of critical UI features. This
// catches regressions where a kit template loses a required feature.

Copilot uses AI. Check for mistakes.
Comment thread internal/kits/kits_parity_test.go Outdated
Comment on lines +12 to +16
templatePath := "system/%s/templates/resource/template.tmpl.tmpl"

kits := []string{"multi", "single"}

// Features that both CRUD kits must have in their monolithic template.
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description indicates this change "Closes #56", but #56's acceptance criteria/tasks also call for auditing all three kits (including simple) and adding a kit feature matrix README. This PR currently only updates single-kit template behavior and adds a multi/single required-features test. Either adjust the PR description/linked issue status, or expand coverage to include the remaining kit(s)/documentation if you intend to close the full issue.

Copilot uses AI. Check for mistakes.
- Use edit-modal-specific pattern (lvt-data-id="{{.EditingID}}") instead
  of generic lvt-click="delete" that also matches table delete button
- Clarify test doc comment: this is a required-features smoke test
- Use fmt.Sprintf instead of strings.Replace for path formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Feb 16, 2026

PR Review: Fix Missing Delete Button in Single Kit Edit Modal

Summary

This PR adds a missing delete button to the single kit's monolithic template edit modal and introduces a parity test to prevent future drift between multi and single kit templates. The changes address issue #56.


✅ Code Quality & Best Practices

Strengths:

  • Clean implementation: The delete button addition follows the exact pattern already established in the multi kit (line 165)
  • Consistent styling: Uses the same buttonClass helper with "danger" variant
  • Proper attributes: Includes all necessary LiveTemplate attributes (lvt-click, lvt-data-id, lvt-confirm)
  • Good test design: The parity test is well-structured with clear feature definitions and descriptive error messages
  • Excellent documentation: Test comments clearly explain the purpose (smoke test for critical UI features)
  • Test improvements in commit 2: The second commit addressed bot feedback by using more specific pattern matching (lvt-data-id="{{.EditingID}}" instead of generic lvt-click="delete")

Minor suggestions:

  1. Test could be more comprehensive: Consider adding other critical features to the test suite:

    • Delete buttons in table rows (lvt-data-id="{{.ID}}")
    • Modal visibility controls
    • Form validation patterns
  2. Test organization: Consider adding a comment explaining why lvt-data-id="{{.EditingID}}" specifically identifies the edit modal delete button vs table delete buttons


🐛 Potential Issues

No major issues found. The implementation is solid.

Minor observations:

  1. The test checks for the presence of patterns but doesn't validate that buttons are in the correct location (edit modal vs table). This is acceptable for a smoke test but could be enhanced if stricter validation is needed in the future.

  2. The test uses strings.Contains which could match partial patterns. Given the current patterns are specific enough (e.g., lvt-data-id="{{.EditingID}}"), this is not a problem but worth noting for future pattern additions.


⚡ Performance Considerations

No performance concerns. The test:

  • Runs quickly (simple string matching on embedded file content)
  • Uses efficient embed.FS for system kits
  • Has minimal memory footprint
  • Properly scoped to run only on system kits

🔒 Security Concerns

No security issues identified. The changes:

  • Add standard CRUD functionality with proper confirmation dialog
  • Don't introduce any new data handling or validation logic
  • Follow existing patterns that are already in production

The lvt-confirm attribute provides user confirmation before deletion, which is good UX and prevents accidental deletions.


🧪 Test Coverage

Excellent test coverage:

✅ New parity test (TestKitFeatureParity) validates:

  • Delete button in edit modal
  • Cancel edit button
  • Update form submission
  • Add form submission
  • Add modal open button
  • Edit button in table

✅ Test runs for both multi and single kits

✅ PR description indicates full test suite passes (28 packages, 0 failures)

Recommendations:

  1. Consider adding an E2E test that actually clicks the delete button and verifies the deletion occurs (beyond the scope of this PR, but worth considering for comprehensive coverage)
  2. The manual testing checkbox in the PR description is still unchecked - recommend completing this before merge

📝 Additional Observations

Commit messages: Follow conventional commit format nicely (fix(kits):)

Pattern matching specificity: The evolution from first to second commit shows good iteration:

  • Initially might have used generic lvt-click="delete"
  • Refined to lvt-data-id="{{.EditingID}}" for better specificity
  • This prevents false positives from table delete buttons

Code consistency: The added delete button at single/templates/resource/template.tmpl.tmpl:165 now perfectly mirrors multi/templates/resource/template.tmpl.tmpl:165


✨ Overall Assessment

Recommendation: ✅ APPROVE

This is a well-executed bug fix with appropriate test coverage. The parity test is a valuable addition that will prevent similar issues in the future. The code follows project conventions, commit messages are clear, and the implementation is consistent with existing patterns.

Before merging:

  • Complete manual testing (as noted in PR description)
  • Verify CI checks pass (if any are configured)

Nice work! The iterative improvements based on feedback (commit 2) demonstrate good attention to detail.

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.

2 participants