Skip to content

Add Core Workspace Storage Service base#38

Merged
mors119 merged 1 commit into
FrilLab:mainfrom
mors119:feature/core-basic-architecture
Jun 3, 2026
Merged

Add Core Workspace Storage Service base#38
mors119 merged 1 commit into
FrilLab:mainfrom
mors119:feature/core-basic-architecture

Conversation

@mors119
Copy link
Copy Markdown
Collaborator

@mors119 mors119 commented Jun 3, 2026

Summary

Add Core Workspace Storage Service base code.

Closes #6
Closes #7
Closes #8
Closes #9
Closes #10
Closes #12

Type of Change

  • feat
  • fix
  • docs
  • refactor
  • test
  • chore

Testing

Checklist

  • Code builds successfully
  • Tests pass
  • Documentation updated

Summary by CodeRabbit

Release Notes

  • New Features
    • Introduced a new CLI application for managing code notes
    • Added ability to create notes linked to specific locations within source files (by line number or code symbol)
    • Implemented persistent storage with automatic timestamps and unique note identifiers
    • Added functionality to retrieve all notes associated with a given source file

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR implements the core frilvault-core library for the FrilVault annotation system. It establishes domain models for code notes with positional anchors, a YAML persistence layer, workspace path resolution, a parser abstraction, and a service API—all tested and integrated. A CLI scaffold is added as a placeholder.

Changes

Core Library Implementation with Note Persistence

Layer / File(s) Summary
Foundation and Error Handling
Cargo.toml, crates/frilvault-core/Cargo.toml, crates/frilvault-core/src/constants.rs, crates/frilvault-core/src/error/*, crates/frilvault-core/src/lib.rs
Workspace configuration, library dependencies (chrono, serde, serde_yml, thiserror, uuid), public constants for vault directory and file extension, and FrilVaultError enum with automatic From conversions for IO and YAML errors; lib.rs refactored into module root with FrilVaultResult type alias.
Note Domain Model
crates/frilvault-core/src/note/entity.rs, crates/frilvault-core/src/note/mod.rs
Note entity with UUID, source file, anchor (line or symbol), content, and UTC timestamps; NoteAnchor variants (LineAnchor, SymbolAnchor with SymbolKind enum); AddNoteInput for construction; NoteFile as Vec container; Note::new generates UUID and timestamps.
Workspace Model and Path Resolution
crates/frilvault-core/src/workspace/models.rs, crates/frilvault-core/src/workspace/path_resolver.rs, crates/frilvault-core/src/workspace/mod.rs
Workspace struct holding root PathBuf; PathResolver converts source file paths to workspace-relative paths and resolves note file locations under .vault directory; error on path outside workspace.
Parser Abstraction and YAML Implementation
crates/frilvault-core/src/parser/note_parser.rs, crates/frilvault-core/src/parser/yaml_parser.rs, crates/frilvault-core/src/parser/mod.rs
NoteParser trait with serialize/deserialize methods; YamlParser concrete implementation delegating to serde_yml for YAML encoding/decoding.
Storage Layer - YAML Repository
crates/frilvault-core/src/storage/yaml_repository.rs, crates/frilvault-core/src/storage/mod.rs
YamlNoteRepository wires PathResolver and YamlParser; append_note loads existing YAML, adds note, saves back; load_by_source_file and save_by_source_file resolve paths and persist via YAML; load_by_note_path returns default empty NoteFile if missing.
Note Service - Application API
crates/frilvault-core/src/note/service.rs
NoteService wraps YamlNoteRepository; add_note constructs Note from AddNoteInput with UUID and timestamps, appends via repository; list_notes loads and returns Vec for source file.
Comprehensive Test Coverage
crates/frilvault-core/src/tests/*
Unit tests: Note entity preserves input and generates UUID; PathResolver correctly formats and resolves paths; YamlParser serializes/deserializes NoteFile with YAML round-trip; NoteService integration creates .vault files, persists notes, and loads them back with correct anchors; temp workspaces cleaned per test.

CLI Application Scaffold

Layer / File(s) Summary
CLI Package Setup
apps/frivault-cli/Cargo.toml, apps/frivault-cli/src/main.rs
New frivault-cli binary crate (v0.1.0, 2024 edition) added to workspace; main entry point prints hello message.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A vault of notes, so neat and bright,
With anchors marking lines just right,
YAML stored in the .vault so deep,
Code annotations safe to keep.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.62% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly summarizes the main objective: adding core workspace storage service base infrastructure, which matches the primary changes introducing workspace models, storage/repository patterns, and note domain entities.
Linked Issues check ✅ Passed All linked issue requirements are addressed: Note domain model (#6), NoteFile model (#7), note path resolution (#8), workspace root detection (#9), YAML serialization (#10), and note file loading (#12) are fully implemented with supporting tests.
Out of Scope Changes check ✅ Passed All changes are directly aligned with linked issue objectives. The workspace configuration update and CLI scaffolding are minimal supporting changes necessary for workspace organization and feature demonstration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Cargo.toml`:
- Around line 4-6: The workspace member in Cargo.toml lists "apps/frivault-cli"
which looks like a typo versus the project name FrilVault and the core crate
"frilvault-core"; rename the directory and crate to match: change the workspace
member to "apps/frilvault-cli", rename the filesystem folder apps/frivault-cli →
apps/frilvault-cli, and update the package name in that crate's Cargo.toml (the
package.name field) to "frilvault-cli" so the workspace entry, directory name,
and crate name are consistent.

In `@crates/frilvault-core/Cargo.toml`:
- Line 9: The dependency serde_yml = "0.0.12" is flagged as
unsound/unmaintained; replace or mitigate it by switching to a maintained YAML
crate (e.g., serde_yaml) or a vetted fork and updating all code paths that
import/use serde_yml to the new crate name (search for uses of serde_yml in
Cargo.toml and in imports/usages throughout the crate); update Cargo.toml
dependency entry and adjust any feature flags or API call sites to match the
chosen replacement, run cargo build/test to ensure compatibility, and remove
serde_yml once all references are migrated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 91abca54-558f-4290-806e-075f0dd8fa13

📥 Commits

Reviewing files that changed from the base of the PR and between 21e652d and faadeae.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (24)
  • Cargo.toml
  • apps/frivault-cli/Cargo.toml
  • apps/frivault-cli/src/main.rs
  • crates/frilvault-core/Cargo.toml
  • crates/frilvault-core/src/constants.rs
  • crates/frilvault-core/src/error/errors.rs
  • crates/frilvault-core/src/error/mod.rs
  • crates/frilvault-core/src/lib.rs
  • crates/frilvault-core/src/note/entity.rs
  • crates/frilvault-core/src/note/mod.rs
  • crates/frilvault-core/src/note/service.rs
  • crates/frilvault-core/src/parser/mod.rs
  • crates/frilvault-core/src/parser/note_parser.rs
  • crates/frilvault-core/src/parser/yaml_parser.rs
  • crates/frilvault-core/src/storage/mod.rs
  • crates/frilvault-core/src/storage/yaml_repository.rs
  • crates/frilvault-core/src/tests/mod.rs
  • crates/frilvault-core/src/tests/note_entity_test.rs
  • crates/frilvault-core/src/tests/note_resolver_test.rs
  • crates/frilvault-core/src/tests/note_service_test.rs
  • crates/frilvault-core/src/tests/yaml_parser_test.rs
  • crates/frilvault-core/src/workspace/mod.rs
  • crates/frilvault-core/src/workspace/models.rs
  • crates/frilvault-core/src/workspace/path_resolver.rs

Comment thread Cargo.toml
Comment on lines +4 to +6
members = ["apps/frivault-cli",
"crates/frilvault-core"
] No newline at end of file
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Likely typo in crate directory name: frivault-cli vs project frilvault.

The CLI member is apps/frivault-cli (missing an l), while the core crate is frilvault-core and the project is FrilVault. If unintentional, rename the directory/crate now while it's still a scaffold to avoid churn later.

✏️ Proposed fix
-members = ["apps/frivault-cli",
+members = ["apps/frilvault-cli",
     "crates/frilvault-core"
 ]

Note: also rename the apps/frivault-cli directory and update its Cargo.toml package name accordingly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Cargo.toml` around lines 4 - 6, The workspace member in Cargo.toml lists
"apps/frivault-cli" which looks like a typo versus the project name FrilVault
and the core crate "frilvault-core"; rename the directory and crate to match:
change the workspace member to "apps/frilvault-cli", rename the filesystem
folder apps/frivault-cli → apps/frilvault-cli, and update the package name in
that crate's Cargo.toml (the package.name field) to "frilvault-cli" so the
workspace entry, directory name, and crate name are consistent.

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_yml = "0.0.12"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Latest serde_yml version on crates.io
curl -s https://crates.io/api/v1/crates/serde_yml | jq '.crate.max_stable_version, .crate.newest_version'

# Security advisories for serde_yml
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: RUST, package: "serde_yml") {
    nodes {
      advisory { summary severity publishedAt }
      vulnerableVersionRange
      firstPatchedVersion { identifier }
    }
  }
}'

Repository: FrilLab/frilvault

Length of output: 313


Address the serde_yml advisory for serde_yml = "0.0.12".

GitHub reports serde_yml as “unsound and unmaintained” (MODERATE) with vulnerableVersionRange <= 0.0.12 and no firstPatchedVersion. The currently pinned 0.0.12 falls in the vulnerable range, so this dependency needs replacement/mitigation (e.g., switch to a maintained YAML backend or another vetted crate/fork) rather than just version confirmation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/frilvault-core/Cargo.toml` at line 9, The dependency serde_yml =
"0.0.12" is flagged as unsound/unmaintained; replace or mitigate it by switching
to a maintained YAML crate (e.g., serde_yaml) or a vetted fork and updating all
code paths that import/use serde_yml to the new crate name (search for uses of
serde_yml in Cargo.toml and in imports/usages throughout the crate); update
Cargo.toml dependency entry and adjust any feature flags or API call sites to
match the chosen replacement, run cargo build/test to ensure compatibility, and
remove serde_yml once all references are migrated.

@mors119 mors119 merged commit bb7cd3f into FrilLab:main Jun 3, 2026
3 checks passed
@mors119 mors119 deleted the feature/core-basic-architecture branch June 3, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant