Skip to content

fix(projects): decline the settings write when a project update is refused - #86

Merged
barelyworkingcode merged 2 commits into
mainfrom
fix/46-refused-update-no-write
Sep 26, 2026
Merged

barelyworkingcode merged 2 commits into
mainfrom
fix/46-refused-update-no-write

Conversation

@barelyworkingcode

Copy link
Copy Markdown
Owner

Closes #46

A refused PUT /api/projects/{id} (for example an unknown mode), or one naming a missing project, returned nil from the WithDeclinable callback. So settings.json was rewritten with identical content, and the watcher and fan-out fired for no change.

  • The callback now returns the ApplyUpdate refusal, or an unexported not-found sentinel, so the store declines the write.
  • Update still returns (_, true, err) for a refusal (unwrapped) and (_, false, nil) for a missing project. The HTTP 400/404 and IPC results are unchanged.
  • Audit still records only after a successful write.

Tests (red first, cmd/relay/project_update_declined_test.go):

  • a refused update (invalid mode, invalid access) leaves settings.json untouched, bytes and file identity;
  • so does an unknown id;
  • a valid update still writes.

Break-and-restore on the decline. Review round 1 clean. Full go test ./... passed locally with Relay stopped. A pre-existing race the reviewer found is #85.

🤖 Generated with Claude Code

barelyworkingcode and others added 2 commits September 25, 2026 23:52
…settings.json

Checkpoint before the fix; --no-verify because the tests are red by design.

Refs #46

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…fused

A refused update, or one naming a missing project, returned nil from
the declinable callback, so settings.json was rewritten with identical
content. The callback now returns the refusal and the store declines.

Refs #46

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@barelyworkingcode
barelyworkingcode merged commit c6a05cc into main Sep 26, 2026
2 checks passed
@barelyworkingcode
barelyworkingcode deleted the fix/46-refused-update-no-write branch September 26, 2026 07:07
@barelyworkingcode

Copy link
Copy Markdown
Owner Author

Merged by the coordinator under the owner's delegation: CI test and race green on 707d8b3, review round 1 clean.

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.

A refused project update still rewrites settings.json

1 participant