Repository navigation
JVNAUTOSCI-2592: harden idempotent spreadsheet KR writes - #300
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the represented spreadsheet→KR materialisation pipeline so that create-time timeouts can recover safely (idempotently) and more efficiently, while avoiding recursive event/workflow fan-out from workflow-owned mutation phases.
Changes:
- Introduces an opt-in
duplicate_resolution_mode="canonical_id_only"forcreate_concepts, preserving exact canonical-id reuse while skipping semantic fallback after an exact miss, plus adds cooperative cancellation checkpoints to prevent post-deadline creates. - Adds request-local event-workflow launch suppression (ContextVar-backed) and threads that suppression through the workflow MCP invoke action, including explicit telemetry output.
- Regenerates/bumps the KR + spreadsheet workflow seed bundles (and dependent fingerprints), and documents the reserved VWL control; adds focused regression tests for the new behaviours.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/backend/test_workflow_mcp_tool_actions.py | Adds coverage ensuring event-launch suppression is applied to the invocation context without forwarding the control flag into tool payloads. |
| tests/backend/test_workflow_event_integration_service.py | Adds tests for nested/thread-local suppression and verifies suppressed launches return early without binding reads; validates local cache-invalidation suppression. |
| tests/backend/test_spreadsheet_programme_workflow_vontology_service.py | Updates assertions for regenerated spreadsheet seed v17 + KR dependency seed v4 and related fingerprints. |
| tests/backend/test_mcp_create_concepts_duplicate_resolution_mode.py | New focused tests for canonical_id_only mode and cooperative cancellation behaviour in create_concepts. |
| tests/backend/test_kr_materialisation_workflow_vontology_service.py | Updates for KR seed v4, guard output mapping of duplicate resolution mode, sequential fail-fast iteration, and owned-mutation event fan-out suppression assertions. |
| tests/backend/test_kr_materialisation_guard_service.py | Verifies the guard returns/propagates duplicate_resolution_mode consistently (None when unguarded/rejected, canonical when guarded/pass). |
| src/backend/workflows/workflow_mcp_tool_actions.py | Adds suppress_event_workflow_launches control input, prevents payload forwarding, applies suppression scope around gateway invoke, and emits event_workflow_launch_suppression_requested. |
| src/backend/workflows/repo_seed_bundles/spreadsheet_programme_representation_workflow_seed_bundle.json | Updates spreadsheet seed bundle to v17 and refreshes KR dependency identity + authority fingerprint values. |
| src/backend/workflows/repo_seed_bundles/kr_materialisation_workflow_seed_bundle.json | Bumps KR seed bundle to v4; wires duplicate resolution mode mapping, suppression flag on owned mutation steps, and sequential/stop-on-error iteration. |
| src/backend/services/workflow_event_integration_service.py | Implements ContextVar-based suppression API and short-circuits launch_event_workflow when suppressed. |
| src/backend/services/text_value_service.py | Gates workflow discovery cache invalidation behind the new suppression-aware feature flag. |
| src/backend/services/relationship_write_service.py | Gates workflow discovery cache invalidation behind the new suppression-aware feature flag. |
| src/backend/services/kr_materialisation_guard_service.py | Adds GUARDED_CREATE_DUPLICATE_RESOLUTION_MODE and includes duplicate_resolution_mode in pass/reject guard responses. |
| src/backend/services/feature_flags.py | Makes discovery-cache invalidation suppression-aware via lazy import of the workflow-event suppression state. |
| src/backend/services/create_concepts_duplicate_guard_service.py | Adds duplicate_resolution_mode support to skip semantic resolution after exact miss for deterministic identities. |
| src/backend/mcp_server/vontology_mcp.json | Documents and schemas duplicate_resolution_mode for create_concepts in the published MCP manifest; includes additional schema/doc tweaks in other tool entries. |
| src/backend/integrations/internal_mcp/catalogue.py | Implements duplicate_resolution_mode validation + schema enum, and adds cooperative cancellation points before/after key phases in create_concepts. |
| scripts/generate_spreadsheet_programme_workflow_seed.py | Updates spreadsheet seed version to v17 and keeps deterministic fingerprint generation aligned with updated dependencies. |
| docs/engineering/von_workflow_language_manual.md | Documents the reserved suppress_event_workflow_launches control and its constraints; notes emitted telemetry output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outcome
Makes the represented spreadsheet-to-KR materialisation path recover safely and efficiently after create timeouts.
Changes
canonical_id_onlyduplicate-resolution mode for stable represented identities while preserving the existing semantic fallback by defaultValidation
Three unrelated stale tests in the broader workflow MCP file fail identically on untouched
origin/main; none intersects this delta.Live acceptance
After merge, restart the exact merged build, publish/read back both represented workflow bundles, then run a fresh one-record create/reuse probe followed by the 28-record unchanged-replay campaign.