feat(resource): add virtual resource equivalence tracking #334

Open
opened 2026-02-22 23:41:22 +00:00 by freemo · 1 comment
Owner

Metadata

  • Commit Message: feat(resource): add virtual resource equivalence tracking
  • Branch: feature/m7-post-resource-equivalence

Background

virtual_resource_links table maps virtual resource ULIDs to physical resource ULIDs with uniqueness constraints. ResourceEquivalenceService creates, merges virtual resources, and updates links on content divergence. Equivalence key computation (hash or name) supports auto-linking during discovery.

Acceptance Criteria

  • Add virtual_resource_links table mapping virtual resource ULID to physical resource ULIDs with uniqueness constraints.
  • Add ResourceEquivalenceService to create/merge virtual resources and update links on content divergence.
  • Add helper to compute equivalence key (hash or name) for auto-linking during resource discovery.
  • Add agents resource equivalence list/add/remove CLI to manage equivalence sets (post-M6).
  • Add conflict policy for equivalence (prefer physical over virtual; log divergence events).

Definition of Done

This issue is complete when:

  • All subtasks below are completed and checked off.
  • A Git commit is created where the first line of the commit message matches
    the Commit Message in Metadata exactly, followed by a blank line, then
    additional lines providing relevant details about the implementation. The
    commit body should be appropriate in size for a commit message and relatively
    complete in describing what was done.
  • The commit is pushed to the remote on the branch matching the Branch in
    Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and
    merged before this issue is marked done.

Subtasks

  • Add virtual_resource_links table mapping virtual resource ULID to physical resource ULIDs with uniqueness constraints.
  • Add ResourceEquivalenceService to create/merge virtual resources and update links on content divergence.
  • Add helper to compute equivalence key (hash or name) for auto-linking during resource discovery.
  • Add agents resource equivalence list/add/remove CLI to manage equivalence sets (post-M6).
  • Add conflict policy for equivalence (prefer physical over virtual; log divergence events).
  • Add equivalence reconciliation job to re-hash linked resources on schedule.
  • Add guard to prevent linking resources of incompatible types (type mismatch error).
  • Update docs/reference/resource_model.md with physical/virtual equivalence rules and examples.
  • Add CLI examples for equivalence list/add/remove.
  • Tests (Behave): Add scenarios for linking/unlinking physical resources to virtual resources and divergence updates.
  • Tests (Robot): Add Robot test that creates two identical physical resources and verifies a shared virtual resource.
  • Tests (ASV): Add benchmarks/virtual_resource_bench.py for equivalence update overhead.
  • Verify coverage >=97% via nox -s coverage_report. If coverage is <97% then review the current unit test coverage report at build/coverage.xml and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun nox -s coverage_report to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.
  • Run nox (all default sessions, including benchmark), fix any errors if needed ensuring nox passes across entire code base, do not ignore any failure even if it seems unrelated to this commit, fix it.

Section: ### Section 18: Deferred Work
Status: Open

## Metadata - **Commit Message**: `feat(resource): add virtual resource equivalence tracking` - **Branch**: `feature/m7-post-resource-equivalence` ## Background `virtual_resource_links` table maps virtual resource ULIDs to physical resource ULIDs with uniqueness constraints. `ResourceEquivalenceService` creates, merges virtual resources, and updates links on content divergence. Equivalence key computation (hash or name) supports auto-linking during discovery. ## Acceptance Criteria - [x] Add `virtual_resource_links` table mapping virtual resource ULID to physical resource ULIDs with uniqueness constraints. - [x] Add `ResourceEquivalenceService` to create/merge virtual resources and update links on content divergence. - [x] Add helper to compute equivalence key (hash or name) for auto-linking during resource discovery. - [x] Add `agents resource equivalence list/add/remove` CLI to manage equivalence sets (post-M6). - [x] Add conflict policy for equivalence (prefer physical over virtual; log divergence events). ## Definition of Done This issue is complete when: - All subtasks below are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. The commit body should be appropriate in size for a commit message and relatively complete in describing what was done. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. ## Subtasks - [x] Add `virtual_resource_links` table mapping virtual resource ULID to physical resource ULIDs with uniqueness constraints. - [x] Add `ResourceEquivalenceService` to create/merge virtual resources and update links on content divergence. - [x] Add helper to compute equivalence key (hash or name) for auto-linking during resource discovery. - [x] Add `agents resource equivalence list/add/remove` CLI to manage equivalence sets (post-M6). - [x] Add conflict policy for equivalence (prefer physical over virtual; log divergence events). - [x] Add equivalence reconciliation job to re-hash linked resources on schedule. - [x] Add guard to prevent linking resources of incompatible types (type mismatch error). - [x] Update `docs/reference/resource_model.md` with physical/virtual equivalence rules and examples. - [x] Add CLI examples for equivalence list/add/remove. - [x] Tests (Behave): Add scenarios for linking/unlinking physical resources to virtual resources and divergence updates. - [x] Tests (Robot): Add Robot test that creates two identical physical resources and verifies a shared virtual resource. - [x] Tests (ASV): Add `benchmarks/virtual_resource_bench.py` for equivalence update overhead. - [x] Verify coverage >=97% via `nox -s coverage_report`. If coverage is <97% then review the current unit test coverage report at `build/coverage.xml` and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun `nox -s coverage_report` to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%. - [x] Run `nox` (all default sessions, including benchmark), fix any errors if needed ensuring nox passes across **entire** code base, do not ignore any failure even if it seems unrelated to this commit, fix it. **Section**: ### Section 18: Deferred Work **Status**: Open
freemo added this to the (deleted) milestone 2026-02-22 23:41:22 +00:00
freemo modified the milestone from (deleted) to v3.6.0 2026-02-23 00:07:05 +00:00
Author
Owner

Expected completion updated (Day 15 rebaseline): Day 47 / 2026-03-27 (previously Day 42 / 2026-03-22)

**Expected completion updated (Day 15 rebaseline):** Day 47 / 2026-03-27 (previously Day 42 / 2026-03-22)
freemo added the due date 2026-03-14 2026-02-23 18:42:00 +00:00
freemo self-assigned this 2026-04-02 06:14:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

2026-03-14

Blocks
#398 Epic: Post-MVP Resources
cleveragents/cleveragents-core
Depends on
Reference
cleveragents/cleveragents-core#334
No description provided.