Skip to content

[WIP] Implement CRUD operations for ProposedChange documents#92

Closed
Copilot wants to merge 1 commit into
masterfrom
copilot/manage-proposed-changes-again
Closed

[WIP] Implement CRUD operations for ProposedChange documents#92
Copilot wants to merge 1 commit into
masterfrom
copilot/manage-proposed-changes-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 30, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>DL-5: Manage Proposed Changes</issue_title>
<issue_description>Category: data-layer | Epic: 0 | Priority: high

Summary

Implement CRUD operations for ProposedChange documents in MongoDB. These are
staging documents for canonical changes that CanonKeeper evaluates at scene end.
Supports different change types (fact, entity, relationship, state_change, event)
and status transitions (pending → accepted/rejected).

Acceptance Criteria

  • mongodb_create_proposed_change creates ProposedChange document
  • mongodb_create_proposed_change validates change_type enum
  • mongodb_create_proposed_change stores content payload as flexible JSON
  • mongodb_create_proposed_change links to scene_id or story_id
  • mongodb_get_proposed_change returns full document with evidence
  • mongodb_list_proposed_changes supports filtering by status, change_type, scene_id
  • mongodb_update_proposed_change allows status transitions
  • mongodb_update_proposed_change validates status transitions (pending only → accepted/rejected)
  • mongodb_update_proposed_change records decision metadata (decided_by, decided_at, reason)
  • Accepted changes include reference to created canonical entity
  • All operations track timestamps and proposer identity
  • Unit tests achieve >= 80% coverage

Dependencies

This use case depends on:

  • DL-4

Blocks

This use case blocks:

  • P-3
  • CF-3

Implementation

Layer: 1

Files to create:

  • packages/data-layer/src/monitor_data/schemas/proposed_changes.py
  • packages/data-layer/tests/test_tools/test_proposed_change_tools.py
    Files to modify:
  • packages/data-layer/src/monitor_data/tools/mongodb_tools.py
  • packages/data-layer/src/monitor_data/middleware/auth.py

MONGODB Operations:

  • mongodb_create_proposed_change (authority: *)
  • mongodb_get_proposed_change (authority: *)
  • mongodb_list_proposed_changes (authority: *)
  • mongodb_update_proposed_change (authority: CanonKeeper)

Notes:

  • Any agent can propose changes (authority: *)
  • Only CanonKeeper can accept/reject (update status)
  • Accepted changes should include canonical_ref pointing to created node
  • Consider indexing by scene_id for efficient batch retrieval

Testing Requirements

Minimum coverage: 80%

Unit tests:

  • test_create_proposed_change_fact: change_type=fact → valid doc
  • test_create_proposed_change_entity: change_type=entity → valid doc
  • test_create_proposed_change_relationship: change_type=relationship → valid doc
  • test_list_by_scene: scene_id filter returns relevant proposals
  • test_list_by_status: pending filter works
  • ... and 3 more

Integration tests:

  • test_proposal_lifecycle: create → list → accept → verify canonical created
  • test_batch_canonization: multiple proposals → batch accept/reject

References

Documentation:


Generated from /home/sebas/monitor2/docs/use-cases/data-layer/DL-5.yml</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@github-actions github-actions Bot added the needs-tests No tests touched label Dec 30, 2025
@github-actions
Copy link
Copy Markdown

\nTests not detected in this PR. Please add/confirm coverage where applicable.

@spuentesp
Copy link
Copy Markdown
Owner

Closing as duplicate - DL-5 was already implemented and merged in PR #67.

@spuentesp spuentesp closed this Dec 30, 2025
Copilot AI requested a review from spuentesp December 30, 2025 01:49
@spuentesp spuentesp deleted the copilot/manage-proposed-changes-again branch April 25, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-tests No tests touched

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DL-5: Manage Proposed Changes

2 participants