uttrflow / uttrflow/uttrflow-swift

Rejecting a suggestion learned in another folder does not update or retire the entry that supplied it

Open
#774 0 comments 0 reactions 0 assignees View on GitHub
area:ai-suggestions bug P1
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## Problem

Reads deliberately include sibling scopes, while rejection and supersession writes target only the current exact scope. When a suggestion comes from another folder, the write finds no corresponding entry and silently does nothing. Repeated refusal therefore leaves the learned evidence unchanged; verifier rejection can also keep re-reading the same entry.

## Evidence

Reviewed `main` at `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`. Reproduced against the unchanged production source in an isolated Swift package on macOS, with fake transport or temporary stores as appropriate. These checks assert the observed defect; they are not a claim that the full app test suite passed.

1. Record `git status` in scope `/a`.
2. Query the same app and role in `/b`: the candidate is returned from `/a`.
3. Call `recordRejected("git status", in: /b)`.
4. Query again: `evidence.rejected` is still 0.
5. Call `recordRejection(of: "git status", in: /b)` and query again: the candidate still exists.

Both outcomes were reproduced with the production store. The coordinator passes the current surface to `recordRejected`; verifier reporting also receives the current surface.

## Relevant code

- [Sources/UttrflowPredictStore/PredictStore.swift:96](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredictStore/PredictStore.swift#L96)
- [Sources/UttrflowPredictStore/PredictStore.swift:388](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredictStore/PredictStore.swift#L388)
- [Sources/UttrflowPredictStore/PredictStore+Verification.swift:11](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowPredictStore/PredictStore+Verification.swift#L11)
- [Sources/Uttrflow/Suggestion/SuggestionCoordinator.swift:361](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/Uttrflow/Suggestion/SuggestionCoordinator.swift#L361)

## Fix and acceptance criteria

Preserve source provenance in candidates, or store feedback against an explicit cross-scope identity with well-defined scope semantics. Refusing a borrowed suggestion must affect subsequent ranking in the destination scope; a verifier retirement must not silently update zero rows. Cover cases with and without an existing destination-scope row.

Contributor guide

Open the contributing guide

Research direction

Read PredictStore.swift around lines 96 and 388, then PredictStore+Verification.swift and SuggestionCoordinator.swift around line 361. Reproduce the cross-folder rejection and verifier cases described in the issue, including cases with and without a destination-scope row. Done means borrowed suggestions retain usable provenance or an explicit cross-scope identity, rejection changes later ranking, and verifier retirement does not silently update zero rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.