Add API support for vote value 0 to allow vote retraction #114

Open
opened 2026-07-22 16:14:15 +02:00 by retoor · 39 comments
Owner

Summary

There is no API endpoint to retract a vote or to vote with a value of 0. The existing API only accepts values 1 and -1. Attempting to use 0 results in a validation error.

Steps to Reproduce

  1. Call the existing vote API endpoint with a value of 0.
  2. Observe the validation error response.

Expected Behaviour

The API should accept 0 as a valid vote value, providing a convenient way to retract a vote without requiring a separate endpoint.

Actual Behaviour

The API returns a validation error: value must be 1 or -1.

Environment

Not provided.


Reported by Lensflare via DevPlace.

## Summary There is no API endpoint to retract a vote or to vote with a value of 0. The existing API only accepts values 1 and -1. Attempting to use 0 results in a validation error. ## Steps to Reproduce 1. Call the existing vote API endpoint with a value of 0. 2. Observe the validation error response. ## Expected Behaviour The API should accept 0 as a valid vote value, providing a convenient way to retract a vote without requiring a separate endpoint. ## Actual Behaviour The API returns a validation error: `value must be 1 or -1`. ## Environment Not provided. --- *Reported by **Lensflare** via DevPlace.*
Collaborator

I am picking this ticket up now.

First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.

I am picking this ticket up now. First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.
Collaborator

Starting research round 1 of at most 5.

I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.

Starting research round 1 of at most 5. I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Investigated the ticket against the current source and tests. The reported issue is valid: the native /votes/ route rejects value 0, while the devRant API already accepts it and a toggle‑off mechanism exists. Accepting 0 as an explicit retraction signal fills a concrete feature gap identified in the research (validator, apply_vote edge cases, docs, tests). No clarifying information from the reporter contradicts this assessment.

Decision: proceed. Next step is drafting a concrete implementation plan.

Investigated the ticket against the current source and tests. The reported issue is valid: the native `/votes/` route rejects value 0, while the devRant API already accepts it and a toggle‑off mechanism exists. Accepting 0 as an explicit retraction signal fills a concrete feature gap identified in the research (validator, `apply_vote` edge cases, docs, tests). No clarifying information from the reporter contradicts this assessment. Decision: proceed. Next step is drafting a concrete implementation plan.
Collaborator

I am drafting the implementation plan now.

The research confirmed the ticket; I am turning the findings into a concrete, verifiable plan.

I am drafting the implementation plan now. The research confirmed the ticket; I am turning the findings into a concrete, verifiable plan.
Collaborator

Drafted the implementation plan for adding API support for vote value 0, based on the investigation findings. The plan covers changes to backend validation, early-exit logic in apply_vote(), documentation updates, and test coverage including a fix for a pre-existing import error.

Handing the plan to the execution agent for implementation.

Drafted the implementation plan for adding API support for vote value 0, based on the investigation findings. The plan covers changes to backend validation, early-exit logic in `apply_vote()`, documentation updates, and test coverage including a fix for a pre-existing import error. Handing the plan to the execution agent for implementation.
Collaborator

The full, verbatim implementation plan is attached: plan-ticket-114.md

The full, verbatim implementation plan is attached: [plan-ticket-114.md](https://retoor.molodetz.nl/attachments/1a042bf3-e94c-4def-a3ca-52b908bc2280)
Collaborator

Starting implementation attempt 1 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 1 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Implementation attempt 1 finished; I am verifying it now.

Running the project's own build, test, and lint commands against the change.

Implementation attempt 1 finished; I am verifying it now. Running the project's own build, test, and lint commands against the change.
Collaborator

Attempt 1 did not succeed due to checks failing on the test_command. The change either did not apply cleanly or did not pass the project's own validation suite. A second attempt will incorporate the recorded failure details and lessons to improve the likelihood of a clean integration.

Attempt 1 did not succeed due to checks failing on the test_command. The change either did not apply cleanly or did not pass the project's own validation suite. A second attempt will incorporate the recorded failure details and lessons to improve the likelihood of a clean integration.
Collaborator

Starting implementation attempt 2 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 2 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Attempt 2 completed with inconclusive results. The execution agent's output did not contain a clear success or failure signal. Further targeted research is needed before initiating another retry.

Attempt 2 completed with inconclusive results. The execution agent's output did not contain a clear success or failure signal. Further targeted research is needed before initiating another retry.
Collaborator

Starting research round 2 of at most 5.

I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.

Starting research round 2 of at most 5. I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.
Collaborator

The ticket was compared against the current source and tests. The research findings show that the ability to vote with value 0 for retraction is already implemented across all layers — validation, logic, APIs, documentation, tests, and frontend. The requested change therefore describes something that already exists, with no outstanding work to be done.

This is a mismatch, but it matches work already committed on this ticket's own branch in a prior round. Instead of treating the ticket as stale, we are resuming to verify that existing change against the project's own checks.

The next step is verifying the existing change against the project's own checks.

The ticket was compared against the current source and tests. The research findings show that the ability to vote with value 0 for retraction is already implemented across all layers — validation, logic, APIs, documentation, tests, and frontend. The requested change therefore describes something that already exists, with no outstanding work to be done. This is a mismatch, but it matches work already committed on this ticket's own branch in a prior round. Instead of treating the ticket as stale, we are resuming to verify that existing change against the project's own checks. The next step is verifying the existing change against the project's own checks.
Collaborator

Starting implementation attempt 3 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 3 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Implementation attempt 3 finished; I am verifying it now.

Running the project's own build, test, and lint commands against the change.

Implementation attempt 3 finished; I am verifying it now. Running the project's own build, test, and lint commands against the change.
Collaborator

Attempt 3 failed because the checks for test_command did not pass. The change either did not apply cleanly or did not satisfy the project's own validation rules. The next attempt will incorporate the recorded failure details and lessons learned from this iteration.

Attempt 3 failed because the checks for `test_command` did not pass. The change either did not apply cleanly or did not satisfy the project's own validation rules. The next attempt will incorporate the recorded failure details and lessons learned from this iteration.
Collaborator

Starting implementation attempt 4 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 4 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Attempt 4 was executed and produced an inconclusive result. The execution agent's output did not clearly indicate success or failure.

A further round of targeted research is needed before the next attempt.

Attempt 4 was executed and produced an inconclusive result. The execution agent's output did not clearly indicate success or failure. A further round of targeted research is needed before the next attempt.
Collaborator

Starting research round 3 of at most 5.

I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.

Starting research round 3 of at most 5. I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.
Collaborator

The ticket was compared against the current source and tests. The investigation determined that vote retraction via value 0 is already implemented and documented across every layer of the codebase. The ticket's claim that 0 is rejected with "value must be 1 or -1" is contradicted by the actual validator, business logic, routes, tests, and frontend. Since the reporter provided no subsequent clarification that changes the scope, this ticket describes an already-solved issue.

The decision is a mismatch, but this matches work already committed on this ticket's own branch in a prior round. Therefore, we are resuming to verify it rather than treating the ticket as stale.

The next step is verifying the existing change against the project's own checks.

The ticket was compared against the current source and tests. The investigation determined that vote retraction via value `0` is already implemented and documented across every layer of the codebase. The ticket's claim that `0` is rejected with `"value must be 1 or -1"` is contradicted by the actual validator, business logic, routes, tests, and frontend. Since the reporter provided no subsequent clarification that changes the scope, this ticket describes an already-solved issue. The decision is a mismatch, but this matches work already committed on this ticket's own branch in a prior round. Therefore, we are resuming to verify it rather than treating the ticket as stale. The next step is verifying the existing change against the project's own checks.
Collaborator

Starting implementation attempt 5 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 5 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Implementation attempt 5 finished; I am verifying it now.

Running the project's own build, test, and lint commands against the change.

Implementation attempt 5 finished; I am verifying it now. Running the project's own build, test, and lint commands against the change.
Collaborator

I have attempted five implementation rounds, each informed by the previous failure, but the test_command checks continue to fail. The root cause remains unclear from the available diagnostics.

Could you provide more specific guidance or narrow the scope of the expected behavior for test_command?

I have attempted five implementation rounds, each informed by the previous failure, but the `test_command` checks continue to fail. The root cause remains unclear from the available diagnostics. Could you provide more specific guidance or narrow the scope of the expected behavior for `test_command`?
Author
Owner

@retoor can you help?


Posted by Lensflare via DevPlace.

@retoor can you help? --- *Posted by **Lensflare** via DevPlace.*
Collaborator

I reviewed your reply against the full ticket conversation. The reply does not answer the original question and instead redirects without providing guidance. Because of that, the next step is unclear.

Could you clarify further? I want to make sure I address this correctly.

I reviewed your reply against the full ticket conversation. The reply does not answer the original question and instead redirects without providing guidance. Because of that, the next step is unclear. Could you clarify further? I want to make sure I address this correctly.
Collaborator

I am picking this ticket up now.

First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.

I am picking this ticket up now. First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.
Collaborator

I need input to continue.

What I tried: Retried this step 3 times.
What I found: Each attempt failed for internal reasons unrelated to this ticket. The details are in the operator's logs; this is not a judgment about the ticket.

The system needs operator attention before I can continue. Reply here once things are healthy and I will resume from where I left off.

I need input to continue. What I tried: Retried this step 3 times. What I found: Each attempt failed for internal reasons unrelated to this ticket. The details are in the operator's logs; this is not a judgment about the ticket. The system needs operator attention before I can continue. Reply here once things are healthy and I will resume from where I left off.
Collaborator

I am picking this ticket up now.

First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.

I am picking this ticket up now. First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.
Collaborator

Starting research round 1 of at most 5.

I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.

Starting research round 1 of at most 5. I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Investigated the ticket against the current source and tests. The research findings confirm exactly what the ticket describes: the model validator (1, -1) blocks value 0, but the core logic and devRant router already support it. The fix is minimal and well-scoped—changing one integer in the validator and updating the action catalog description and adding a test. No further research is needed. Decision to proceed. Next steps: drafting a concrete implementation plan.

Investigated the ticket against the current source and tests. The research findings confirm exactly what the ticket describes: the model validator (`1, -1`) blocks value 0, but the core logic and devRant router already support it. The fix is minimal and well-scoped—changing one integer in the validator and updating the action catalog description and adding a test. No further research is needed. Decision to proceed. Next steps: drafting a concrete implementation plan.
Collaborator

I am drafting the implementation plan now.

The research confirmed the ticket; I am turning the findings into a concrete, verifiable plan.

I am drafting the implementation plan now. The research confirmed the ticket; I am turning the findings into a concrete, verifiable plan.
Collaborator

Implementation plan drafted from the investigation findings. The root cause is a Pydantic field validator at devplacepy/models.py:442 that currently rejects vote value 0; the underlying apply_vote logic already handles retraction. The plan specifies changes in three files (models.py, engagement.py catalog, and a new test) and includes verification steps. Next step is handing the plan to the execution agent.

Implementation plan drafted from the investigation findings. The root cause is a Pydantic field validator at `devplacepy/models.py:442` that currently rejects vote value `0`; the underlying `apply_vote` logic already handles retraction. The plan specifies changes in three files (models.py, engagement.py catalog, and a new test) and includes verification steps. Next step is handing the plan to the execution agent.
Collaborator

The full, verbatim implementation plan is attached: plan-ticket-114.md

The full, verbatim implementation plan is attached: [plan-ticket-114.md](https://retoor.molodetz.nl/attachments/5bf0be89-f26c-47eb-8964-ad668e09cbad)
Collaborator

Starting implementation attempt 1 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 1 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Implementation attempt 1 finished; I am verifying it now.

Running the project's own build, test, and lint commands against the change.

Implementation attempt 1 finished; I am verifying it now. Running the project's own build, test, and lint commands against the change.
Collaborator

Implemented the change on the first attempt. The project's configured build, test, and lint commands all completed successfully.

Next step is to commit the changes, push the branch, and open a pull request.

Implemented the change on the first attempt. The project's configured build, test, and lint commands all completed successfully. Next step is to commit the changes, push the branch, and open a pull request.
Collaborator

I am delivering the change now.

Committing the verified change, pushing branch typosaurus/ticket-114, and opening a pull request.

I am delivering the change now. Committing the verified change, pushing branch `typosaurus/ticket-114`, and opening a pull request.
typosaurus referenced this issue from a commit 2026-07-23 05:18:43 +02:00
Collaborator

The change has been committed and pushed to branch typosaurus/ticket-114. The corresponding pull request is open at #128.

This implementation passed the project's own checks, which is why it was submitted for integration. I am monitoring the pull request for review, merge, or any additional feedback that may arise.

The change has been committed and pushed to branch `typosaurus/ticket-114`. The corresponding pull request is open at https://retoor.molodetz.nl/retoor/devplacepy/pulls/128. This implementation passed the project's own checks, which is why it was submitted for integration. I am monitoring the pull request for review, merge, or any additional feedback that may arise.
Author
Owner

After implementing the poll, I realized that to take away an upvote or downvote, I can send the already selected choice again.
This is a bit unexpected and weird, but it works.
Anyway, it will still be good to have the ability to send 0 and it should not conflict with the currently existing behavior.


Posted by Lensflare via DevPlace.

After implementing the poll, I realized that to take away an upvote or downvote, I can send the already selected choice again. This is a bit unexpected and weird, but it works. Anyway, it will still be good to have the ability to send 0 and it should not conflict with the currently existing behavior. --- *Posted by **Lensflare** via DevPlace.*
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: retoor/devplacepy#114
No description provided.