Skip to content

Ranking touch-drag fix on iOS + direct DB connection docs - #50

Merged
countercheck merged 3 commits into
mainfrom
fix/ranking-touch-drag-ios
May 30, 2026
Merged

Ranking touch-drag fix on iOS + direct DB connection docs#50
countercheck merged 3 commits into
mainfrom
fix/ranking-touch-drag-ios

Conversation

@countercheck

Copy link
Copy Markdown
Owner

Two unrelated small changes, bundled at the operator's request.

1. Fix ranking touch-drag on iOS (GH #49)

survey-core's ranking defaults longTap=true, so on iOS Safari the first touch on a ranking item is treated as a scroll gesture and the page scrolls instead of starting the drag — reorder is unreachable on iPhone. SurveyJS's own docs recommend disabling longTap when users naturally swipe-to-drag.

  • New frontend/src/surveyInit.ts toggles the default once via Serializer.findProperty('ranking', 'longTap').defaultValue = false. Idempotent; the explicit null-check makes a future survey-core property rename fail loudly here rather than at the assignment site.
  • Imported as a side-effect by both code paths that mount a Survey: SurveyRunner.tsx (respondent) and admin/SurveyPreview.tsx (admin preview).
  • Regression test asserts the live default — a survey-core bump that reset it would silently re-break iPhone reordering.

2. Document direct Postgres access in infra/README.md

Inlines the analyst/reviewer connect flow that previously just pointed at docs/verification/m7.6-demo-to-prod.md: enable the opt-in TCP proxy, grab the role password from a tofu output, connect with psql. Calls out the choice between stele_analyst (marts) and stele_pii_reviewer (pii), and the gotchas — the postgresql:// vs postgresql+psycopg:// driver tag, the database_name default, and the NOINHERIT SET ROLE step for per-user credentials. Demo seed + secret rotation stay as a pointer.

Test plan

  • cd frontend && npm run lint — clean
  • cd frontend && npm run typecheck — clean
  • cd frontend && npm test — 140 tests across 25 files pass, incl. the new surveyInit regression test
  • Manual: load a published survey with a ranking question in mobile Safari and confirm the drag starts on the first touch (no long-press, no page scroll)

🤖 Generated with Claude Code

countercheck and others added 2 commits May 30, 2026 03:36
survey-core defaults ranking's longTap to true, so on iOS Safari the first
touch on a ranking item is treated as a scroll gesture and the page scrolls
instead of starting the drag — reorder is unreachable on iPhone. SurveyJS's
own docs recommend disabling longTap when users naturally swipe-to-drag.

Disable it at the schema level via a one-shot Serializer side-effect (new
surveyInit.ts) imported by both code paths that mount a Survey: the
respondent runner and the admin preview. Idempotent and explicit about the
shape it expects, so a future survey-core upgrade that renames the property
fails loudly here rather than at the assignment site.

Regression test asserts the live default — survey-core resetting it would
silently re-break iPhone reordering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Inline the analyst/reviewer connect flow that previously just pointed at
docs/verification/m7.6-demo-to-prod.md: enable the opt-in TCP proxy, grab
the role password from a tofu output, connect with psql. Calls out the
choice between stele_analyst (marts) and stele_pii_reviewer (pii), and
the gotchas worth knowing up front — the postgresql:// vs.
postgresql+psycopg:// driver tag, the database_name default, and the
NOINHERIT SET ROLE step for a per-user credential minted by the M3.5
provisioning CLI. Demo seed + secret rotation stay as a pointer.

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

Copilot AI 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.

Pull request overview

This PR bundles two small, unrelated updates: (1) a frontend SurveyJS initialization tweak to make ranking drag/reorder usable on iOS Safari, and (2) expanded infra documentation for direct Postgres access via Railway’s opt-in TCP proxy.

Changes:

  • Frontend: introduce a surveyInit side-effect module that sets SurveyJS ranking longTap default to false, and load it anywhere a Survey is mounted.
  • Frontend: add a Vitest regression test asserting the longTap default remains false.
  • Infra: expand infra/README.md with step-by-step guidance for enabling the Postgres proxy and connecting via psql.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
infra/README.md Adds direct-Postgres connection instructions (proxy enable/disable + psql gotchas).
frontend/src/SurveyRunner.tsx Imports surveyInit for respondent runner path.
frontend/src/admin/SurveyPreview.tsx Imports surveyInit for admin preview path.
frontend/src/surveyInit.ts Sets SurveyJS ranking longTap serializer default to false with a fail-fast check.
frontend/src/surveyInit.test.ts Regression test ensuring longTap default remains disabled.

Comment thread infra/README.md Outdated
Comment on lines +128 to +129
echo 'enable_postgres_proxy = true' >> terraform.tfvars
tofu apply
Comment thread infra/README.md Outdated
Comment on lines +132 to +144
# 2. Grab the role password.
tofu output -raw stele_analyst_password # marts (the warehouse)
tofu output -raw stele_pii_reviewer_password # pii (free-text review)

# 3. Connect.
psql "postgresql://stele_analyst:<password>@<host>:<port>/stele"
```

Pick the role by what you need to read: `stele_analyst` reaches `marts` only,
`stele_pii_reviewer` reaches `pii` only — that one-schema-each ceiling is what
keeps a leaked credential low-stakes (CLAUDE.md *Schemas* table). Both group
roles are LOGIN and hold the schema grant directly, so no `SET ROLE` step is
needed.
Comment thread infra/README.md Outdated
Comment on lines +158 to +159
When you're done, set `enable_postgres_proxy = false` and `tofu apply` to close
the public endpoint.
- Use `tofu apply -var 'enable_postgres_proxy=true/false'` for both flip and
  unflip so re-running stays idempotent (the prior `echo … >> terraform.tfvars`
  appended duplicate assignments on a second pass) and matches the house style
  in "Rolling out a new build" (-var deploy_latest=true).
- Split into "Operator shortcut" + "Per-user logins" subsections. The former
  spells out that the group-role passwords from tofu state are operator-wide
  secrets with no per-person audit trail — don't hand them out. The latter
  promotes the M3.5 provisioning CLI flow from a buried gotcha to a named
  peer subsection, which is the auditable/revocable path for anyone else.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@countercheck
countercheck merged commit 8ed18b5 into main May 30, 2026
15 checks passed
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.

2 participants