Skip to content

[Feedback] Represent independent user preference state and make vector updates reversible #29

Description

@theg1239

Goal

Represent independent user preference state, apply it exactly once, and reverse it safely.

Current implementation

PR #23 now:

  • stores separate interaction rows for like, save, and dislike;
  • makes repeated persistent events idempotent in the normal path;
  • scopes unlike, unsave, and undislike to the matching interaction type;
  • filters consumed and explicitly disliked repositories from recommendation results; and
  • adds transition and ranking tests.

Remaining problems

The shared database migration has the wrong primary key

ML expects (user_id, repo_id, interaction_type), but the application migration still creates (user_id, repo_id). ML currently attempts to replace the constraint at runtime, which requires DDL permission and leaves the two repositories with different schema definitions.

Relevant code:

Persistence and vector application are not failure-safe

The handler commits the feedback state before updating Qdrant. If Qdrant fails, the consumer ignores the returned False, marks the event processed, and acknowledges it. A retry would not repair the vector because the database state is already idempotently applied.

Negative alpha is not an exact undo

The vector is normalized after every shift. Applying the opposite alpha to the normalized result does not restore the original vector. The current test checks the requested alpha values but does not check the resulting vector.

The unrelated corpus target change remains

PR #23 still changes the acquisition target from 3500 to 1000.

Acceptance criteria

  • Like and save can coexist using the shared deployed migration.
  • Unsave preserves like and unlike preserves save in the handler state model.
  • Replaying an identical persistent event does not shift the vector twice in the normal path.
  • Failed vector application remains retryable and is not acknowledged as processed.
  • Undo restores the prior vector within a documented numerical tolerance.
  • Consumed repositories are not promoted solely because they were liked or saved.
  • Transition tests cover UI emission, database state, vector state, retries, and every action ordering.
  • The unrelated corpus target change is removed from the PR.

Related work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions