Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
cdd02c3
Allow person to create a request directly in response to an offer
rsmithlal Aug 19, 2025
48c7392
Notifiy offer creators of a match when someone makes a request linked…
rsmithlal Aug 19, 2025
25e0e0c
Restrict the offer and request list results to exclude requests and o…
rsmithlal Aug 19, 2025
13509d6
If person has responded to an offer, prevent them from responding aga…
rsmithlal Aug 19, 2025
9e5ad4b
If request was created in response to an offer, show the offer that i…
rsmithlal Aug 19, 2025
4b2699f
Clearly identify offers and requests created by current-person or in …
rsmithlal Aug 19, 2025
aeaadeb
Filter requests and offers to exclude those that were creared in resp…
rsmithlal Aug 19, 2025
07a52d3
Rubocop fixes
rsmithlal Aug 19, 2025
97011e0
Allow person to directly create an offer or request in response to a …
rsmithlal Aug 20, 2025
a142ba5
She the offer/request creator on the show view
rsmithlal Aug 20, 2025
5b71f5a
Show source offer or request in the top of the form when responding t…
rsmithlal Aug 20, 2025
8146cf1
Show and allow setting offer and request status and urgency
rsmithlal Aug 20, 2025
f3b40a9
Restricts responses to open/matched sources; marks matched status
rsmithlal Aug 20, 2025
15f89cc
Update specs
rsmithlal Aug 20, 2025
caafc61
Rubocop Fixes
rsmithlal Aug 20, 2025
9c87d8a
Add posts url to navigation item route names
rsmithlal Aug 20, 2025
947bba4
Adjust offers and requests list sidebar to move add button to the sea…
rsmithlal Aug 20, 2025
b68463e
Rubocop fixes
rsmithlal Aug 20, 2025
c29afc0
Add diagram and docs for exchange system
rsmithlal Aug 21, 2025
cd23661
Update agent instructions to generate and maintain docs and diagrams
rsmithlal Aug 21, 2025
6574547
Add pull request template and contributing guidelines
rsmithlal Aug 21, 2025
b146f74
Enhance agreement and response link handling
rsmithlal Aug 21, 2025
4c0db86
Refactor notification handling in controllers and add NotificationRea…
rsmithlal Aug 21, 2025
bafc0ed
Add docs and flow diagram for notifications system
rsmithlal Aug 21, 2025
df0fafd
Update diagrams
rsmithlal Aug 21, 2025
49a2b60
Add docs to readmes
rsmithlal Aug 21, 2025
f1f0dbf
Add docs and diagrams for user accounts and invitation flows
rsmithlal Aug 21, 2025
10d0c89
Enhance diagram rendering script with force option and improved outpu…
rsmithlal Aug 21, 2025
c575e44
Add invitation requirement details to registration forms and document…
rsmithlal Aug 21, 2025
3e39f51
Update docs developer guides to explain rendering diagrams
rsmithlal Aug 21, 2025
6de2b6e
Update robot instructions to raise awareness of platform registrartio…
rsmithlal Aug 21, 2025
3923b0d
Update robot instructions to use i18n-tasks to ensure translation health
rsmithlal Aug 21, 2025
498e6ae
Add coverage report upload step to CI workflow
rsmithlal Aug 21, 2025
3810019
Refactor flash messages to use I18n translations across controllers a…
rsmithlal Aug 21, 2025
15e006b
Add docs and flow diagram for Role Based Access Control (RBAC)
rsmithlal Aug 21, 2025
8a709cf
Add docs and diagrams of the content management and navigation systems
rsmithlal Aug 21, 2025
c41e212
Add privacy practices and metrics documentation to enhance data handl…
rsmithlal Aug 21, 2025
9097f23
Add democratic-by-design docs
rsmithlal Aug 21, 2025
db789ef
Adjust i18n-health job to use ruby 3.4.4
rsmithlal Aug 21, 2025
a701242
feat: Implement event RSVP functionality with ICS export
rsmithlal Aug 21, 2025
8f96fbd
Update coverage report generation for GH action
rsmithlal Aug 21, 2025
33a39ad
feat: Implement source type validation in Joatu controllers and enhan…
rsmithlal Aug 21, 2025
f45e2c3
chore: Remove unnecessary whitespace in JoatuController
rsmithlal Aug 21, 2025
d921f33
feat: Enhance security guidelines in documentation for code generatio…
rsmithlal Aug 21, 2025
de3c632
Add event reminder functionality with associated tests and mailer
rsmithlal Aug 21, 2025
a233dac
feat: Enhance event reminder and update mailers with new templates an…
rsmithlal Aug 21, 2025
161c728
feat: Refactor event reminder job and notifier to use params for even…
rsmithlal Aug 21, 2025
fb62b95
chore: Remove test_person.rb file as it is no longer needed
rsmithlal Aug 21, 2025
333ed2f
refactor: Simplify error handling tests in EventReminderJob spec
rsmithlal Aug 21, 2025
e7939cf
Add notifications queue to dummy app
rsmithlal Aug 21, 2025
71b9e47
feat: Enhance event and notification systems with comprehensive remin…
rsmithlal Aug 21, 2025
b0b810b
Normalize existing translations
rsmithlal Aug 21, 2025
9e43d2e
Add missing translations
rsmithlal Aug 21, 2025
9359464
fix: Update notification titles to include conversation context in En…
rsmithlal Aug 21, 2025
f236bab
fix: Simplify new message notification title in French locale
rsmithlal Aug 21, 2025
fdd1618
fix: Update time-related translations for improved clarity in English…
rsmithlal Aug 21, 2025
e0052ed
Merge branch 'main' into feature/exchange
rsmithlal Aug 21, 2025
14860ad
refactor: Update event flow and documentation to enhance event hostin…
rsmithlal Aug 21, 2025
e2ea8af
refactor: Organize event host spec to improve clarity and structure
rsmithlal Aug 21, 2025
7b6c579
feat: Add better_together_event_hosts table to schema
rsmithlal Aug 21, 2025
b15d50c
test: Add validation trigger for event host defaulting to creator
rsmithlal Aug 21, 2025
7cd9c12
update i18n check
rsmithlal Aug 21, 2025
86d6134
ci(i18n): install dev/test gems and use bundler-cache; add bin/i18n h…
rsmithlal Aug 21, 2025
f6326bf
ci(i18n): ensure bundler uses dev/test groups during cache; add i18n-…
rsmithlal Aug 21, 2025
da26be1
ci(i18n): make bin/i18n compatible across i18n-tasks versions (fallba…
rsmithlal Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 108 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ This repository contains the **Better Together Community Engine** (an isolated R

## Core Principles

- **Security first**: Run `bundle exec brakeman --quiet --no-pager` before generating code; fix high-confidence vulnerabilities
- **Accessibility first** (WCAG AA/AAA): semantic HTML, ARIA roles, keyboard nav, proper contrast.
- **Hotwire everywhere**: Turbo for navigation/updates; Stimulus controllers for interactivity.
- **Keep controllers thin**; move business logic to POROs/service objects or concerns.
- **Prefer explicit join models** over polymorphic associations when validation matters.
- **Avoid the term STI** in code/comments; use single-table inheritance or alternate designs.
- **Avoid the term "STI"** in code/comments; use "single-table inheritance" or alternate designs.
- **Use `ENV.fetch`** rather than `ENV[]`.
- **Always add policy/authorization checks** on links/buttons to controller actions.
- **i18n & Mobility**: every user-facing string must be translatable; include missing keys.
- Provide translations for all available locales (e.g., en, es, fr) when adding new strings.

## Technology Stack

Expand All @@ -34,9 +36,38 @@ This repository contains the **Better Together Community Engine** (an isolated R

> Dev DB: PostgreSQL (not SQLite). Production: PostgreSQL. PostGIS enabled for geospatial needs.

## Documentation & Diagrams Policy

- For any new functionality, routes, background jobs, or changes to models/associations:
- Update or add documentation under `docs/` describing the behavior and flows.
- Maintain Mermaid diagrams (`.mmd`) reflecting new or changed relationships and process flows.
- Regenerate PNGs from `.mmd` sources using `bin/render_diagrams`.
- Ensure PRs include docs/diagrams updates when applicable; missing updates should be treated as a review blocker.
- When modifying exchange (Joatu) features (Offers, Requests, Agreements, Notifications), keep both the process doc and flow diagram in sync.


## Coding Guidelines

### Security Requirements
- **Run Brakeman before generating code**: `bundle exec brakeman --quiet --no-pager`
- **Fix high-confidence vulnerabilities immediately** - never ignore security warnings with "High" confidence
- **Review and address medium-confidence warnings** that are security-relevant
- **Safe coding practices when generating code:**
- **No unsafe reflection**: Never use `constantize`, `safe_constantize`, or `eval` on user input
- **Use allow-lists for dynamic class resolution**: Follow the `joatu_source_class` pattern with concern-based allow-lists
- **Validate user inputs**: Always sanitize and validate parameters, especially for file uploads and dynamic queries
- **Strong parameters**: Use Rails strong parameters in all controllers
- **Authorization everywhere**: Implement Pundit policy checks on all actions
- **SQL injection prevention**: Use parameterized queries, avoid string interpolation in SQL
- **XSS prevention**: Use Rails auto-escaping, sanitize HTML inputs with allowlists
- **For reflection-based features**: Create concerns with `included_in_models` class methods for safe dynamic class resolution
- **Post-generation security check**: Run `bundle exec brakeman --quiet --no-pager -c UnsafeReflection,SQL,CrossSiteScripting` after major code changes

## Test Environment Setup
- Configure the host Platform in a before block for controller/request/feature tests.
- Create/set a Platform as host (with community) before requests.
- Toggle requires_invitation and provide invitation_code when needed.

- **Ruby/Rails**
- 2-space indent, snake_case methods, Rails conventions
- Service objects in `app/services/`
Expand All @@ -48,24 +79,90 @@ This repository contains the **Better Together Community Engine** (an isolated R
- Bootstrap utility classes; respect prefers-reduced-motion & other a11y prefs
- Avoid inline JS; use Stimulus
- External links in `.trix-content` get FA external-link icon unless internal/mailto/tel/pdf
- All user-facing copy must use t("...") and include keys across all locales (add to config/locales/en.yml, es.yml, fr.yml).
- **Hotwire**
- Use Turbo Streams for CRUD updates
- Stimulus controllers in `app/javascript/controllers/`
- No direct DOM manipulation without Stimulus targets/actions
- **Background Jobs**
- Sidekiq jobs under appropriate queues (`:default`, `:mailers`, `:metrics`, etc.)
- Idempotent job design; handle retries
- When generating emails/notifications, localize both subject and body for all locales.
- **Search**
- Update `as_indexed_json` to include translated/plain-text fields as needed
- **Encryption & Privacy**
- Use AR encryption for sensitive columns
- Ensure blobs are encrypted at rest
- **Testing**
- RSpec (if present) or Minitest – follow existing test framework
- **Generate comprehensive test coverage for all changes**: Every modification must include RSpec tests covering the new functionality
- All RSpec specs **must use FactoryBot factories** for model instances (do not use `Model.create` or `Model.new` directly in specs).
- **A FactoryBot factory must exist for every model**. When generating a new model, also generate a factory for it.
- **Factories must use the Faker gem** to provide realistic, varied test data for all attributes (e.g., names, emails, addresses, etc.).
- **Test all layers**: models, controllers, mailers, jobs, JavaScript/Stimulus controllers, and integration workflows
- System tests for Turbo flows where possible
- **Session-based testing**: When working on existing code modifications, generate tests that cover all unstaged changes and related functionality

## Test Generation Strategy

### Mandatory Test Creation
When modifying existing code or adding new features, always generate RSpec tests that provide comprehensive coverage:

1. **Model Tests**:
- Validations, associations, scopes, callbacks
- Instance methods, class methods, delegations
- Business logic and calculated attributes
- Security-related functionality (encryption, authorization)

2. **Controller Tests**:
- All CRUD actions and custom endpoints
- Authorization policy checks (Pundit/equivalent)
- Parameter handling and strong params
- Response formats (HTML, JSON, Turbo Stream)
- Error handling and edge cases

3. **Background Job Tests**:
- Job execution and success scenarios
- Retry logic and error handling
- Side effects and state changes
- Queue assignment and timing

4. **Mailer Tests**:
- Email content and formatting
- Recipient handling and localization
- Attachment and delivery configurations
- Multi-locale support

5. **JavaScript/Stimulus Tests**:
- Controller initialization and teardown
- User interaction handlers
- Form state management and dynamic updates
- Target and action mappings

6. **Integration Tests**:
- Complete user workflows
- Cross-model interactions
- End-to-end feature functionality
- Authentication and authorization flows

### Session-Specific Test Coverage
For this codebase, ensure tests cover all recent changes including:
- Enhanced LocatableLocation model with polymorphic associations
- Event model with notification callbacks and location integration
- Calendar and CalendarEntry associations
- Event notification system (EventReminderNotifier, EventUpdateNotifier)
- Background jobs for event reminders and scheduling
- EventMailer with localized content
- Dynamic location selector JavaScript controller
- Form enhancements with location type selection

### Test Quality Standards
- Use descriptive test names that explain the expected behavior
- Follow AAA pattern (Arrange, Act, Assert) in test structure
- Mock external dependencies and network calls
- Test both success and failure scenarios
- Use shared examples for common behavior patterns
- Ensure tests are deterministic and can run independently

## Project Architecture Notes

Expand Down Expand Up @@ -94,3 +191,13 @@ This repository contains the **Better Together Community Engine** (an isolated R
---

_If you generate code that touches any of these areas, consult the relevant instruction file and follow it._

## Internationalization & Translation Normalization
- Use the `i18n-tasks` gem to:
- Normalize locale files (`i18n-tasks normalize`).
- Identify and add missing keys (`i18n-tasks missing`, `i18n-tasks add-missing`).
- Ensure all user-facing strings are present in all supported locales (en, fr, es, etc.).
- Add new keys in English first, then translate.
- Review translation health regularly (`i18n-tasks health`).
- All new/changed strings must be checked with `i18n-tasks` before merging.
- See `.github/instructions/i18n-mobility.instructions.md` for details.
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Summary

Describe the change and the motivation.

## Checklist

- [ ] Tests added/updated and passing (`bin/ci`).
- [ ] Lint and security checks (`rubocop`, `brakeman`, `bundler-audit`).
- [ ] Documentation updated under `docs/` describing new/changed functionality.
- [ ] Mermaid diagrams (`docs/*.mmd`) updated to reflect changes.
- [ ] Rendered PNGs regenerated with `bin/render_diagrams` and committed.
- [ ] For DB changes, included any needed backfills/dedupes and noted risks.

## Screenshots / Diagrams

If applicable, include screenshots or link to updated diagrams.

## Notes

Anything reviewers should be aware of (migration order, flags, feature toggles).

34 changes: 34 additions & 0 deletions .github/workflows/diagrams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Diagrams Check

on:
pull_request:
branches: [ "**" ]

jobs:
render-and-verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Render Mermaid diagrams
run: |
chmod +x bin/render_diagrams || true
./bin/render_diagrams || true

- name: Verify rendered PNGs are up to date
run: |
CHANGED=$(git status --porcelain -- docs/*.png | wc -l)
if [ "$CHANGED" -gt 0 ]; then
echo "Diagrams PNGs are out of date. Please run bin/render_diagrams and commit the updated PNGs." >&2
echo "Changed files:" >&2
git status --porcelain -- docs/*.png >&2 || true
exit 1
fi
shell: bash

48 changes: 48 additions & 0 deletions .github/workflows/i18n-health.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: i18n Translation Health Report

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
i18n-health:
runs-on: ubuntu-latest
env:
# Ensure dev/test gems (incl. i18n-tasks) are installed
BUNDLE_WITHOUT: ""
BUNDLE_WITH: "development:test"
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
env:
# Ensure bundler installs dev/test groups during caching step
BUNDLE_WITHOUT: ""
BUNDLE_WITH: "development:test"
with:
ruby-version: '3.4.4'
bundler-cache: true
- name: Verify i18n-tasks
run: bundle exec i18n-tasks --version
- name: Normalize locale files
run: bin/i18n normalize
- name: Run i18n checks
run: bin/i18n check
- name: Upload i18n health report
if: always()
run: bin/i18n health > i18n-health.txt
continue-on-error: true
- name: Archive i18n health report
uses: actions/upload-artifact@v4
with:
name: i18n-health-report
path: i18n-health.txt
continue-on-error: true
9 changes: 9 additions & 0 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
echo "Waiting for Elasticsearch to be healthy..."
curl -s "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" || (echo "Elasticsearch not healthy" && exit 1)


- name: Run RSpec
if: (matrix.rails == '7.1.5.2') || steps.update.outcome == 'success'
env:
Expand All @@ -96,6 +97,14 @@ jobs:
bundle exec rspec
continue-on-error: ${{ matrix.allowed_failure }}

- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report-ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}
path: |
coverage/

- name: Generate coverage badge
if: ${{ github.ref == 'refs/heads/main' && success() }}
continue-on-error: true
Expand Down
Loading
Loading