Repository navigation
Add lifecycle_status as core node property with semantic search exclusion - #828
Conversation
…sion Implements Phase 1 and 2 of Issue #755 - adds lifecycle management to enable knowledge governance across all nodes. Changes: - Add lifecycle_status field to SurrealDB schema with default "active" and index for efficient filtering (schema.surql) - Add lifecycle_status to Node struct with serde defaults and skip serialization for "active" status (node.rs) - Add include_archived parameter to search_semantic MCP tool (tools.rs) - Implement lifecycle filtering in search handler - excludes archived nodes by default, always excludes deleted nodes (search.rs) - Update SurrealNode and all Node construction sites to include lifecycle_status field (surreal_store.rs, node_service.rs, schema_node.rs, task_node.rs) Lifecycle values: - "active" (default): Included in search, visible in UI - "archived": Excluded from search by default, hidden from default views - "deleted": Always excluded, soft-deleted, purgeable Tests added for: - Node lifecycle_status serialization/deserialization - include_archived parameter parsing and defaults - Lifecycle filter logic (active/archived/deleted combinations) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Pragmatic Code ReviewReview Type: Initial Review Requirements Check (Issue #755)
Summary: All Phase 1 and Phase 2 acceptance criteria implemented correctly. Code Review FindingsCritical IssuesNone identified. Suggested Improvements[Improvement] Consider using an enum for lifecycle_status Files: Currently,
Consider a #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum LifecycleStatus {
Active,
Archived,
Deleted,
}Rationale: Type safety (SOLID - stronger contracts), exhaustive match enforcement, IDE autocomplete support. Priority: Low - current implementation is functional and well-tested. The string approach is pragmatic for Phase 1 and allows forward compatibility with potential future states. This can be addressed in a follow-up if the team prefers stronger typing. [Improvement] Lifecycle filtering could be pushed to database level File: The current implementation fetches extra results (
For future optimization, consider pushing the lifecycle filter into the database query when SurrealDB's vector search supports WHERE clauses on joined tables. Priority: Low - this is a reasonable pragmatic approach for Phase 1. The NitpicksNit: fn is_active_lifecycle(status: &String) -> bool {Prefer fn is_active_lifecycle(status: &str) -> bool {This is idiomatic Rust and avoids unnecessary indirection. Nit: Test naming consistency The lifecycle tests in Architecture Assessment✅ Follows Existing Patterns: The implementation aligns with existing codebase patterns (serde defaults, skip_serializing_if, comprehensive test coverage). ✅ Single Responsibility: Each file change is focused - schema updates schema, model updates model, search updates search. ✅ No Breaking Changes: Default value ✅ Proper Documentation: Comments reference Issue #755 consistently throughout the codebase. ✅ Comprehensive Testing: 16 new tests added covering serialization, deserialization, and filter logic edge cases. Security Review✅ No security concerns identified:
Performance Assessment✅ Index Added: 🟡 Post-filtering Overhead: As noted above, current approach fetches 3x results. Acceptable for Phase 1 but document for future optimization. ✅ Serialization Optimization: Test Coverage
All 54 relevant tests pass (26 node tests + 28 search tests). Recommendation✅ APPROVEThis PR is a net positive improvement to the codebase. The implementation:
The suggested improvements (enum type, database-level filtering) are minor optimizations that can be addressed in future iterations. They do not block this PR. Reviewed by Claude Opus 4.5 - Principal Engineer Reviewer |
malibio
left a comment
There was a problem hiding this comment.
Review Status: APPROVE (recommendation)
Implementation correctly addresses Phase 1 and Phase 2 acceptance criteria with comprehensive test coverage and no blocking issues. See detailed review comment above for suggested improvements that can be addressed in future iterations.
Note: Cannot self-approve - requires another reviewer to formally approve.
malibio
left a comment
There was a problem hiding this comment.
Review Status: APPROVE (recommendation)
Implementation correctly addresses Phase 1 and Phase 2 acceptance criteria with comprehensive test coverage and no blocking issues. See detailed review comment above for suggested improvements that can be addressed in future iterations.
Note: Cannot self-approve - requires another reviewer to formally approve.
Changed is_active_lifecycle parameter from &String to &str for idiomatic Rust. This allows passing string literals directly and avoids unnecessary indirection. Addresses reviewer nitpick from PR #828 code review. Co-Authored-By: Claude <[email protected]>
Review Recommendations AddressedSummary
Changes Made✅ Use
Skipped Recommendations⏭️ Use enum for lifecycle_status (🟡 Improvement)
⏭️ Push filtering to database level (🟡 Improvement)
⏭️ Test naming consistency (🟢 Nitpick)
Test Results
Addressed by Claude Opus 4.5 |
Resolved conflict in packages/core/src/db/surreal_store.rs: - Main refactored get_all_collections_with_member_counts to use typed CollectionWithCount struct with .map().collect() pattern - Feature branch added lifecycle_status field to nodes - Resolution: Added lifecycle_status field to CollectionWithCount struct and included it in Node construction Co-Authored-By: Claude <[email protected]>
…sion (#828) * Add lifecycle_status as core node property with semantic search exclusion Implements Phase 1 and 2 of Issue #755 - adds lifecycle management to enable knowledge governance across all nodes. Changes: - Add lifecycle_status field to SurrealDB schema with default "active" and index for efficient filtering (schema.surql) - Add lifecycle_status to Node struct with serde defaults and skip serialization for "active" status (node.rs) - Add include_archived parameter to search_semantic MCP tool (tools.rs) - Implement lifecycle filtering in search handler - excludes archived nodes by default, always excludes deleted nodes (search.rs) - Update SurrealNode and all Node construction sites to include lifecycle_status field (surreal_store.rs, node_service.rs, schema_node.rs, task_node.rs) Lifecycle values: - "active" (default): Included in search, visible in UI - "archived": Excluded from search by default, hidden from default views - "deleted": Always excluded, soft-deleted, purgeable Tests added for: - Node lifecycle_status serialization/deserialization - include_archived parameter parsing and defaults - Lifecycle filter logic (active/archived/deleted combinations) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Address review: Use idiomatic &str instead of &String Changed is_active_lifecycle parameter from &String to &str for idiomatic Rust. This allows passing string literals directly and avoids unnecessary indirection. Addresses reviewer nitpick from PR #828 code review. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
…sion (#828) * Add lifecycle_status as core node property with semantic search exclusion Implements Phase 1 and 2 of Issue #755 - adds lifecycle management to enable knowledge governance across all nodes. Changes: - Add lifecycle_status field to SurrealDB schema with default "active" and index for efficient filtering (schema.surql) - Add lifecycle_status to Node struct with serde defaults and skip serialization for "active" status (node.rs) - Add include_archived parameter to search_semantic MCP tool (tools.rs) - Implement lifecycle filtering in search handler - excludes archived nodes by default, always excludes deleted nodes (search.rs) - Update SurrealNode and all Node construction sites to include lifecycle_status field (surreal_store.rs, node_service.rs, schema_node.rs, task_node.rs) Lifecycle values: - "active" (default): Included in search, visible in UI - "archived": Excluded from search by default, hidden from default views - "deleted": Always excluded, soft-deleted, purgeable Tests added for: - Node lifecycle_status serialization/deserialization - include_archived parameter parsing and defaults - Lifecycle filter logic (active/archived/deleted combinations) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Address review: Use idiomatic &str instead of &String Changed is_active_lifecycle parameter from &String to &str for idiomatic Rust. This allows passing string literals directly and avoids unnecessary indirection. Addresses reviewer nitpick from PR #828 code review. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
…sion (#828) * Add lifecycle_status as core node property with semantic search exclusion Implements Phase 1 and 2 of Issue #755 - adds lifecycle management to enable knowledge governance across all nodes. Changes: - Add lifecycle_status field to SurrealDB schema with default "active" and index for efficient filtering (schema.surql) - Add lifecycle_status to Node struct with serde defaults and skip serialization for "active" status (node.rs) - Add include_archived parameter to search_semantic MCP tool (tools.rs) - Implement lifecycle filtering in search handler - excludes archived nodes by default, always excludes deleted nodes (search.rs) - Update SurrealNode and all Node construction sites to include lifecycle_status field (surreal_store.rs, node_service.rs, schema_node.rs, task_node.rs) Lifecycle values: - "active" (default): Included in search, visible in UI - "archived": Excluded from search by default, hidden from default views - "deleted": Always excluded, soft-deleted, purgeable Tests added for: - Node lifecycle_status serialization/deserialization - include_archived parameter parsing and defaults - Lifecycle filter logic (active/archived/deleted combinations) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Address review: Use idiomatic &str instead of &String Changed is_active_lifecycle parameter from &String to &str for idiomatic Rust. This allows passing string literals directly and avoids unnecessary indirection. Addresses reviewer nitpick from PR #828 code review. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
Summary
lifecycle_statusfield as a core hub property on all nodesinclude_archivedparameter tosearch_semanticMCP toolChanges
Database Schema (
schema.surql)lifecycle_statusfield with default "active"idx_node_lifecyclefor efficient filteringNode Model (
node.rs)lifecycle_statusfield with serde default "active"Semantic Search (
search.rs,tools.rs)include_archivedparameter to SearchSemanticParams (default: false)include_archived=trueinclude_archived=true)include_archivedboolean parameterOther Updates
lifecycle_statussurreal_store.rs: SurrealNode struct and conversionsnode_service.rs: Node creation methodsschema_node.rs: Schema node to Node conversiontask_node.rs: Task node to Node conversionTest Plan
include_archived: true, verify archived nodes includedAcceptance Criteria Status
From issue #755:
lifecycleStatusfield added to SurrealDB node hub table with defaultactivesearch_semanticexcludes archived/deleted nodes by defaultsearch_semanticincludes archived nodes wheninclude_archived: true🤖 Generated with Claude Code