Skip to content

Manual graph apply backend split#8

Merged
XucroYuri merged 13 commits into
mainfrom
codex/split-manual-graph-apply
May 30, 2026
Merged

Manual graph apply backend split#8
XucroYuri merged 13 commits into
mainfrom
codex/split-manual-graph-apply

Conversation

@XucroYuri
Copy link
Copy Markdown
Owner

Summary

  • Add Manual Merge/Split Canonical Graph design and execution plan.
  • Add audited canonical graph operation log plus idempotent merge/split preview and apply methods.
  • Expose protected research graph merge/split/operations APIs with 404/422 error mapping and focused tests.

Split boundary

  • Kept this PR to backend/store/API plus tests.
  • Deferred legacy target_workbench UI apply controls because current main does not carry the old target workbench route/files; UI should be reintroduced in a current-admin-shell split.

Verification

  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m pytest tests/unit/test_async_store.py -k 'canonical_graph or canonical_merge or canonical_split' -q --no-cov
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m pytest tests/unit/test_api_server.py -k 'research_graph' -q --no-cov
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m pytest tests/unit/test_async_store.py -q --no-cov
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m pytest tests/unit/test_api_server.py -q --no-cov
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m ruff check
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m mypy src/news_sentry/ --ignore-missing-imports
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python tools/scan_sensitive_data.py
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python tools/check_no_hardcoded_target.py
  • PYTHONPATH=src /Volumes/SSD/Code/06-dev-tools/NewsSentry/.venv/bin/python -m pytest tests/unit/test_config_schema_validation.py -q --no-cov
  • PYTHONPATH=src uv run --python 3.12 --extra dev --extra api --extra proxy python -m pytest tests/ -q --tb=short --timeout=300 --cov=src/news_sentry --cov-report=term-missing --cov-report=xml

Note: the full pytest run passed with existing Starlette/httpx deprecation and aiosqlite event-loop warnings.

@XucroYuri XucroYuri merged commit 27fee65 into main May 30, 2026
1 check passed
@XucroYuri XucroYuri deleted the codex/split-manual-graph-apply branch May 30, 2026 19:54
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55efe71e07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1911 to +1914
survivor = await self._load_canonical_event_for_merge(
survivor_canonical_event_id,
target_id=target_id,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject merges into retired canonical events

If survivor_canonical_event_id points to an event already marked status == "merged", this path still accepts it as the survivor and _apply_canonical_merge_plan later moves the candidate mentions onto that retired node while leaving its merged_into metadata intact. In the scenario where A was already merged into B, a subsequent manual merge of C into A will strand C's mentions under A instead of the active survivor B; add a survivor-specific status/merged_into check before building the merge plan.

Useful? React with 👍 / 👎.

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.

1 participant