Fix #2049: guard promote_to_l2 against L0 -- error instead of silent no-op#897
Open
AlexMikhalev wants to merge 2 commits into
Open
Fix #2049: guard promote_to_l2 against L0 -- error instead of silent no-op#897AlexMikhalev wants to merge 2 commits into
AlexMikhalev wants to merge 2 commits into
Conversation
added 2 commits
June 3, 2026 20:16
…instead of silent no-op Refs #2049
- SharedLearningStore::promote_to_l2 now returns StoreError::InvalidInput
when the learning is not at L1, with message "Learning is at {level};
promote to L1 first using --to l1"
- SharedLearningStore::promote_to_l1 now returns StoreError::InvalidInput
when the learning is not at L0 (prevents silent re-promote no-op)
- CLI 'learn shared promote --to l1' now calls store.promote_to_l1 instead
of unconditionally returning error; fixes wrong message "learnings start
at L1" (they start at L0)
- Test suite: fix 5 pre-existing tests that called promote_to_l2 without
first calling promote_to_l1 (masked the bug); fix shared_import assertion
from L1 to L0 (accurate to code behaviour); add 3 regression tests for
#2049 (promote_l0_directly_to_l2_fails, promote_l0_to_l1_via_store_succeeds,
promote_l1_to_l1_again_fails)
- All 12 shared_learning_cli_tests pass with --features shared-learning
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.
Summary
Fixes #2049:
learn shared promote <id> --to l2from L0 silently no-opped and printed false success.SharedLearningStore::promote_to_l2now returnsStoreError::InvalidInputwhen learning is not at L1, with message matching AC1SharedLearningStore::promote_to_l1now returns error when learning is not at L0 (prevents silent re-promote)learn shared promote --to l1now works (promotes L0 → L1); fixes wrong error message "learnings start at L1"Acceptance Criteria
promote_to_l2from L0 returns non-zero exit code with message containing "Extracted"/"L0" and "--to l1"--to l1now callspromote_to_l1instead of unconditional errorpromote_l0_directly_to_l2_fails,promote_l0_to_l1_via_store_succeeds,promote_l1_to_l1_again_fails)cargo test -p terraphim_agent --test shared_learning_cli_tests --features shared-learningpasses (12/12)cargo clippy -p terraphim_agent --features shared-learning -- -D warningscleanRefs terraphim/terraphim-ai#2049 (Gitea)