Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0debed1
add 0 district legislators
dcordz Mar 4, 2025
63609e5
padawan - job for sending notifications, with tests
dcordz Mar 6, 2025
08df230
padawan - dynamic sitemap.xml
dcordz Mar 10, 2025
b8d287b
padawan - add ahrefs site audit bot to robots.txt
dcordz Mar 10, 2025
ddcc7d1
update robots.txt, gems
dcordz Mar 11, 2025
e03664e
padawan - unknown route redirect to home
dcordz Mar 12, 2025
dcceddc
padawan - upgrade deps
dcordz Mar 12, 2025
238244a
padawan - updated dependencies
dcordz Mar 12, 2025
61e432e
padawan - bigger start voting button
dcordz Mar 12, 2025
bb93bd9
padawan - rubocoop
dcordz Mar 12, 2025
1a29730
padawan - try to remove an N+1 on legislator votes added
dcordz Mar 17, 2025
4c81139
padawan - deps + add libyaml to dockerfile to fix psych build issue -…
dcordz Mar 17, 2025
09fb3b2
padawan - adjust bill creator padding
dcordz Apr 1, 2025
bc6990b
padawan - limit what previous bills are sent to the creator
dcordz Apr 1, 2025
417df02
padawan - ui updates, don't expose is_admin on a user unless they are…
dcordz Apr 2, 2025
d3baf19
padawan - upgrade dependencies
dcordz Apr 2, 2025
d009304
padawan - upgrade dependencies
dcordz Apr 2, 2025
0153a29
padawan - upgrade dependencies
dcordz Apr 2, 2025
f98c4c2
padawan - gem types + type/null checks
dcordz Apr 3, 2025
0c4b8b3
padawan - updated gem definitions
dcordz Apr 3, 2025
e577ccb
switch from fly.io to kamal
dcordz Apr 10, 2025
dfefbd5
padawan - update gem definitions
dcordz Apr 10, 2025
d0eaebf
padawan - kamal secrets in bitwarden
dcordz Apr 10, 2025
34d49f7
padawan - upgrade node + deps
dcordz May 1, 2025
0ed886d
padawan - maryland legislator votes
dcordz May 8, 2025
9e9a3ff
padawan - remove outline from button if organizations count is not > 1
dcordz May 8, 2025
332ca34
padawan - update gems + node modules
dcordz May 8, 2025
ebb9b12
padawan - remove capacitator
dcordz May 8, 2025
3fafea2
padawan - merge staging upgrade ruby and node versions
dcordz Aug 24, 2025
3e2dc74
padawan - merge remote padawan
dcordz Aug 24, 2025
c7af159
padawan - ci
dcordz Aug 24, 2025
75eec98
padawan - node version
dcordz Aug 24, 2025
39fa3cc
padawan - use shortened urls for invites, replace 3000 with 3333 for …
dcordz Aug 27, 2025
8cf4c35
invites test, sorbet/tapioca rbis
dcordz Sep 4, 2025
2d3631a
update gems, gem rbis, node packages, create user_organization models…
dcordz Sep 10, 2025
0280c5c
padawan - fix rspec tests
dcordz Sep 10, 2025
f311e4f
padawan - different prettier config for rb and ts/x files
dcordz Sep 11, 2025
3a3fb52
padawan - more tests, org create position on bill
dcordz Sep 11, 2025
29b7d85
padawan - remove a log, more mobile friendly
dcordz Sep 11, 2025
2a446ac
padawan - upgrade deps
dcordz Sep 16, 2025
3c9f72a
padawan - remove rubocop from dockerfiles
dcordz Sep 16, 2025
9573b7d
padawan - add rate limiting
dcordz Sep 17, 2025
a996b28
padawan - add cloudflare-rails gem
dcordz Sep 17, 2025
6299ee1
padawan - fix conflicts
dcordz Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22.13.1"
node-version: "22.18.0"
cache: "npm"

- name: Install JS dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
- name: Set up Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4.1"
ruby-version: "3.4.5"
bundler-cache: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22.13.1"
node-version: "22.18.0"
cache: "npm"

- name: Install JS dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22.13.1"
node-version: "22.18.0"
cache: "npm"

- name: Install JS dependencies
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ tf/
!**/**/.keep
# Sentry Config File
.env.sentry-build-plugin

registry/
coverage/
6 changes: 4 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ npx tsc --project tsconfig.json
echo "Run prettier on project"
npm run prettier

echo "Run rubocop on changed files, autofix any fixable offenses"
bundle exec rubocop --autocorrect --only-recognized-file-types $changed_files
# echo "Run rubocop on changed files, autofix any fixable offenses"
# bundle exec rubocop --only-recognized-file-types $changed_files
# bundle exec rubocop --autocorrect --only-recognized-file-types $changed_files
# bundle exec rubocop --only-recognized-file-types $changed_files -A

git update-index --again
3 changes: 3 additions & 0 deletions .kamal/hooks/docker-setup.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "Docker set up on $KAMAL_HOSTS..."
3 changes: 3 additions & 0 deletions .kamal/hooks/post-app-boot.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..."
14 changes: 14 additions & 0 deletions .kamal/hooks/post-deploy.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

# A sample post-deploy hook
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)
# KAMAL_RUNTIME

echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds"
3 changes: 3 additions & 0 deletions .kamal/hooks/post-proxy-reboot.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "Rebooted kamal-proxy on $KAMAL_HOSTS"
3 changes: 3 additions & 0 deletions .kamal/hooks/pre-app-boot.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "Booting app version $KAMAL_VERSION on $KAMAL_HOSTS..."
51 changes: 51 additions & 0 deletions .kamal/hooks/pre-build.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh

# A sample pre-build hook
#
# Checks:
# 1. We have a clean checkout
# 2. A remote is configured
# 3. The branch has been pushed to the remote
# 4. The version we are deploying matches the remote
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)

if [ -n "$(git status --porcelain)" ]; then
echo "Git checkout is not clean, aborting..." >&2
git status --porcelain >&2
exit 1
fi

first_remote=$(git remote)

if [ -z "$first_remote" ]; then
echo "No git remote set, aborting..." >&2
exit 1
fi

current_branch=$(git branch --show-current)

if [ -z "$current_branch" ]; then
echo "Not on a git branch, aborting..." >&2
exit 1
fi

remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1)

if [ -z "$remote_head" ]; then
echo "Branch not pushed to remote, aborting..." >&2
exit 1
fi

if [ "$KAMAL_VERSION" != "$remote_head" ]; then
echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2
exit 1
fi

exit 0
47 changes: 47 additions & 0 deletions .kamal/hooks/pre-connect.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env ruby

# A sample pre-connect check
#
# Warms DNS before connecting to hosts in parallel
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)
# KAMAL_RUNTIME

hosts = ENV["KAMAL_HOSTS"].split(",")
results = nil
max = 3

elapsed = Benchmark.realtime do
results = hosts.map do |host|
Thread.new do
tries = 1

begin
Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
rescue SocketError
if tries < max
puts "Retrying DNS warmup: #{host}"
tries += 1
sleep rand
retry
else
puts "DNS warmup failed: #{host}"
host
end
end

tries
end
end.map(&:value)
end

retries = results.sum - hosts.size
nopes = results.count { |r| r == max }

puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ]
109 changes: 109 additions & 0 deletions .kamal/hooks/pre-deploy.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/env ruby

# A sample pre-deploy hook
#
# Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
#
# Fails unless the combined status is "success"
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_COMMAND
# KAMAL_SUBCOMMAND
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)

# Only check the build status for production deployments
if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
exit 0
end

require "bundler/inline"

# true = install gems so this is fast on repeat invocations
gemfile(true, quiet: true) do
source "https://rubygems.org"

gem "octokit"
gem "faraday-retry"
end

MAX_ATTEMPTS = 72
ATTEMPTS_GAP = 10

def exit_with_error(message)
$stderr.puts message
exit 1
end

class GithubStatusChecks
attr_reader :remote_url, :git_sha, :github_client, :combined_status

def initialize
@remote_url = `git config --get remote.origin.url`.strip.delete_prefix("https://github.com/")
@git_sha = `git rev-parse HEAD`.strip
@github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
refresh!
end

def refresh!
@combined_status = github_client.combined_status(remote_url, git_sha)
end

def state
combined_status[:state]
end

def first_status_url
first_status = combined_status[:statuses].find { |status| status[:state] == state }
first_status && first_status[:target_url]
end

def complete_count
combined_status[:statuses].count { |status| status[:state] != "pending"}
end

def total_count
combined_status[:statuses].count
end

def current_status
if total_count > 0
"Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
else
"Build not started..."
end
end
end


$stdout.sync = true

puts "Checking build status..."
attempts = 0
checks = GithubStatusChecks.new

begin
loop do
case checks.state
when "success"
puts "Checks passed, see #{checks.first_status_url}"
exit 0
when "failure"
exit_with_error "Checks failed, see #{checks.first_status_url}"
when "pending"
attempts += 1
end

exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS

puts checks.current_status
sleep(ATTEMPTS_GAP)
checks.refresh!
end
rescue Octokit::NotFound
exit_with_error "Build status could not be found"
end
3 changes: 3 additions & 0 deletions .kamal/hooks/pre-proxy-reboot.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo "Rebooting kamal-proxy on $KAMAL_HOSTS..."
49 changes: 49 additions & 0 deletions .kamal/secrets
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.

# Option 1: Read secrets from the environment
KAMAL_REGISTRY_PASSWORD=$GITHUB_ACCESS_TOKEN # .env.kamal

# Option 2: Read secrets via a command
# RAILS_MASTER_KEY=$(cat config/master.key)

# Option 3: Read secrets via kamal secrets helpers
# These will handle logging in and fetching the secrets in as few calls as possible
# There are adapters for 1Password, LastPass + Bitwarden
#
# SECRETS=$(kamal secrets fetch --adapter 1password --account my-account --from MyVault/MyItem KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD $SECRETS)
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY $SECRETS)

SECRETS=$(kamal secrets fetch --adapter bitwarden --account legis@sway.vote GOOGLE_CLOUD_PROJECT VITE_CLOUDFLARE_TURNSTILE_SITE_KEY GOOGLE_MAPS_API_KEY VITE_GOOGLE_RECAPTCHA_SITE_KEY VITE_SENTRY_IO_ID VITE_SENTRY_IO_ROUTE NEW_RELIC_USER_KEY NEW_RELIC_API_KEY NEW_RELIC_LICENSE_KEY NEW_RELIC_ACCOUNT_ID TWILIO_ACCOUNT_SID TWILIO_AUTH_TOKEN TWILIO_VERIFY_SERVICE_SID SENTRY_DSN SENTRY_ORG SENTRY_PROJECT SENTRY_AUTH_TOKEN CONGRESS_GOV_API_KEY OPEN_STATES_API_KEY ADMIN_PHONES SENDGRID_API_KEY SWAY_DATABASE_PASSWORD SECRET_KEY_BASE RAILS_MASTER_KEY VAPID_PRIVATE_KEY VAPID_PUBLIC_KEY TUNNEL_TOKEN)

GOOGLE_CLOUD_PROJECT=$(kamal secrets extract GOOGLE_CLOUD_PROJECT $SECRETS)
VITE_CLOUDFLARE_TURNSTILE_SITE_KEY=$(kamal secrets extract VITE_CLOUDFLARE_TURNSTILE_SITE_KEY $SECRETS)
GOOGLE_MAPS_API_KEY=$(kamal secrets extract GOOGLE_MAPS_API_KEY $SECRETS)
VITE_GOOGLE_MAPS_API_KEY=$(kamal secrets extract GOOGLE_MAPS_API_KEY $SECRETS)
VITE_GOOGLE_RECAPTCHA_SITE_KEY=$(kamal secrets extract VITE_GOOGLE_RECAPTCHA_SITE_KEY $SECRETS)
VITE_SENTRY_IO_ID=$(kamal secrets extract VITE_SENTRY_IO_ID $SECRETS)
VITE_SENTRY_IO_ROUTE=$(kamal secrets extract VITE_SENTRY_IO_ROUTE $SECRETS)
NEW_RELIC_USER_KEY=$(kamal secrets extract NEW_RELIC_USER_KEY $SECRETS)
NEW_RELIC_API_KEY=$(kamal secrets extract NEW_RELIC_API_KEY $SECRETS)
NEW_RELIC_LICENSE_KEY=$(kamal secrets extract NEW_RELIC_LICENSE_KEY $SECRETS)
NEW_RELIC_ACCOUNT_ID=$(kamal secrets extract NEW_RELIC_ACCOUNT_ID $SECRETS)
TWILIO_ACCOUNT_SID=$(kamal secrets extract TWILIO_ACCOUNT_SID $SECRETS)
TWILIO_AUTH_TOKEN=$(kamal secrets extract TWILIO_AUTH_TOKEN $SECRETS)
TWILIO_VERIFY_SERVICE_SID=$(kamal secrets extract TWILIO_VERIFY_SERVICE_SID $SECRETS)
SENTRY_DSN=$(kamal secrets extract SENTRY_DSN $SECRETS)
SENTRY_ORG=$(kamal secrets extract SENTRY_ORG $SECRETS)
SENTRY_PROJECT=$(kamal secrets extract SENTRY_PROJECT $SECRETS)
SENTRY_AUTH_TOKEN=$(kamal secrets extract SENTRY_AUTH_TOKEN $SECRETS)
CONGRESS_GOV_API_KEY=$(kamal secrets extract CONGRESS_GOV_API_KEY $SECRETS)
OPEN_STATES_API_KEY=$(kamal secrets extract OPEN_STATES_API_KEY $SECRETS)
ADMIN_PHONES=$(kamal secrets extract ADMIN_PHONES $SECRETS)
SENDGRID_API_KEY=$(kamal secrets extract SENDGRID_API_KEY $SECRETS)
SWAY_DATABASE_PASSWORD=$(kamal secrets extract SWAY_DATABASE_PASSWORD $SECRETS)
SECRET_KEY_BASE=$(kamal secrets extract SECRET_KEY_BASE $SECRETS)
RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY $SECRETS)
VAPID_PRIVATE_KEY=$(kamal secrets extract VAPID_PRIVATE_KEY $SECRETS)
VAPID_PUBLIC_KEY=$(kamal secrets extract VAPID_PUBLIC_KEY $SECRETS)
TUNNEL_TOKEN=$(kamal secrets extract TUNNEL_TOKEN $SECRETS)
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.13.1
v22.18.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.13.1
v22.18.0
31 changes: 24 additions & 7 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
./.vscode
./.firebase
./.bundle
./.github
./.certs
./.husky
./.kamal
./.rubocop
./.vscode

bin/
db/migrate/
docker/
log/
node_modules/
public/
scripts/
sorbet/
storage/
tmp/
vendor/

db/schema.rb

package.json
package-lock.json
Gemfile.lock

./keys
**/**/node_modules
**/build/**
**/dist/**
**/lib/**

./emulate_data/*
./firebase-export-*/*
**/**/*.log

**/**/*.log
Loading