Skip to content

fix(action-center): keep members from changing a Getting started step back to opened - #1255

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/getting-started-steps-update-policy
Oct 20, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/getting-started-steps-update-policy

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to gkhngyk's optional note on #1234: "the update policy's using still lets any member turn a skipped or done row back into opened through PostgREST."

00196's update policy on getting_started_steps checked the new row in with check: any member may write opened, but only an admin or a manager may write skipped or done. It didn't check the row being changed (using), so an analyst could update a done row to opened.

Migration 00202 recreates the policy with the same condition in using: the row must be opened, or the user an admin or a manager. with check is 00196's.

Why the app is unaffected

  • The page RPC (getting_started_page_opened) inserts with on conflict do nothing.
  • skipGettingStartedStep and the KPI save's done are admin and manager writes.

Related issue

Follow-up to #1234.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

On the dev DB, in rolled-back transactions as authenticated with the demo user's JWT, I set the kpis step to done and switched the user's role within the transaction:

Attempt 00196 policy 00202 policy
analyst: update … set state = 'opened' where state = 'done' 1 row 0 rows
manager: same (already changed above) 1 row

bash supabase/build-schema.sh rebuilt schema.sql. 00202 is applied on the dev DB.

Numbering: main has up to 00199. Open PRs: 00197 #1243, 00200 #1247, 00201 #1253.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/) — web not touched
  • yarn typecheck passes (run from web/) — web not touched
  • yarn format:check passes (run from web/) — web not touched
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

… back to opened

00196's update policy on getting_started_steps checked the new row
(only an admin or a manager may write skipped or done) but not the row
being changed, so through PostgREST any member could turn a skipped or
done step back into opened. The app never does: the page RPC inserts
with on conflict do nothing, and skipping a step or saving the KPIs is
an admin's or a manager's. 00202 adds the same check to the policy's
using: the row must be opened, or the user an admin or a manager.

Follow-up to gkhngyk's note on ansvisor#1234.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk your optional note on #1234: 00202 adds the admin/manager-or-opened check to the steps update policy's using. On the dev DB, an analyst's done → opened update now changes 0 rows (it changed 1 under 00196), and a manager's still changes 1.

@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 20, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. using now matches with check, so a member can't turn a skipped or done step back into opened. 00202 is applied to production.

@gkhngyk
gkhngyk merged commit 4d8b4ab into ansvisor:main Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-migration Adds or edits a migration — apply it to the hosted database

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants