Skip to content

Fix #2049: guard promote_to_l2 against L0 -- error instead of silent no-op#897

Open
AlexMikhalev wants to merge 2 commits into
mainfrom
task/2049-shared-learning-promote-guard
Open

Fix #2049: guard promote_to_l2 against L0 -- error instead of silent no-op#897
AlexMikhalev wants to merge 2 commits into
mainfrom
task/2049-shared-learning-promote-guard

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Fixes #2049: learn shared promote <id> --to l2 from L0 silently no-opped and printed false success.

  • SharedLearningStore::promote_to_l2 now returns StoreError::InvalidInput when learning is not at L1, with message matching AC1
  • SharedLearningStore::promote_to_l1 now returns error when learning is not at L0 (prevents silent re-promote)
  • learn shared promote --to l1 now works (promotes L0 → L1); fixes wrong error message "learnings start at L1"
  • Fixes 5 pre-existing test bugs that masked this issue; adds 3 regression tests

Acceptance Criteria

  • promote_to_l2 from L0 returns non-zero exit code with message containing "Extracted"/"L0" and "--to l1"
  • --to l1 now calls promote_to_l1 instead of unconditional error
  • 3 new regression tests added (promote_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-learning passes (12/12)
  • cargo clippy -p terraphim_agent --features shared-learning -- -D warnings clean

Refs terraphim/terraphim-ai#2049 (Gitea)

Test User 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
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