mirror of
https://github.com/we-promise/sure.git
synced 2026-09-08 08:04:15 +00:00
* Document instruction inventory and preservation decisions Trace main history from September 2025 through September 2026, including earlier policy origins. Record preserved requirements, detailed-guide destinations, stale facts, harness boundaries and explicit policy-strength decisions before consolidating instruction sources. * Consolidate repository instructions into shared guidance Keep AGENTS concise and vendor neutral, move detailed conventions into shared guides, and use thin adapters with preserved Cursor scopes. Preserve the strict pre-PR checks globally and document the stronger scope, retired migration pin and rule-generation trigger. Update existing API guidance verification without changing application behavior. * Narrow the always-on Cursor UI adapter and correct the SimpleFIN comment Split the design-system guidance out of docs/llm-guides/ui.md into docs/llm-guides/design-system.md. The ui-ux-design-guidelines rule is alwaysApply: true, so importing all of ui.md loaded the Stimulus, localization and ViewComponent guidance (previously confined to scoped rules) on every Cursor session; the always-on adapter now imports only the design-system guide, matching the scope it had before the consolidation. view_conventions and stimulus_conventions keep the full UI guide. Also correct the stale Provider::Simplefin header comment: pending inclusion defaults on and is resolved by the importer (explicit argument, then SIMPLEFIN_INCLUDE_PENDING, then Setting.syncs_include_pending); the previous comment described the flag as default-off. * Read guidance files as UTF-8 in the API consistency validators The frontmatter regex match ran against content read with the locale default external encoding; the Cursor rule's description contains an em dash, so under US-ASCII (LC_ALL=C) Regexp#match raised ArgumentError, breaking the standalone no-Rails fallback the docs point contributors to. Read all checked files with an explicit UTF-8 encoding in both the standalone script and the Rails test.
4.8 KiB
4.8 KiB
Repository guidance
Working in the repository
- Read architecture and conventions before changing code, and the relevant task guides.
- Rails code lives in
app/; keep business logic in models, concerns and POROs, with thin controllers. JavaScript is inapp/javascript/, components inapp/components/, assets inapp/assets/, and configuration inconfig/. - Minitest tests mirror
app/undertest/; fixtures are intest/fixtures/. Migrations and schema are indb/, scripts inbin/, shared libraries inlib/. - Use
Current.userandCurrent.family, nevercurrent_userorcurrent_family. Preserve family tenancy and existing authorization boundaries. - Prefer built-in Rails patterns and established dependencies. New dependencies need a strong technical or business reason. Keep changes focused, readable and consistent with nearby code.
- Ruby uses two-space indentation,
snake_casemethods/variables andCamelCaseclasses. JavaScript useslowerCamelCasevariables/functions andPascalCaseclasses; follow Biome. Keep domain logic out of ERB. - Never commit secrets; use environment variables and
.env.localfor local configuration. - Do not start
rails server, touchtmp/restart.txt, runrails credentials, or automatically run migrations. Setup and database commands in the development guide are for explicitly requested environment work. - New migrations use the current Rails migration version; leave historical migration versions intact.
Tests and pull requests
- Use Minitest and fixtures for behavioral tests, with Mocha and VCR where needed. RSpec/rswag is for OpenAPI documentation only. Follow the testing guide.
- Run
bin/rails testand ensure it is green before pushing. Before opening a PR, run all checks in the pre-PR checklist: full Rails tests, applicable system tests, Ruby and ERB lint, Biome and Brakeman. Only create the PR when all required checks pass. - Commits use imperative subjects of at most 72 characters, with rationale and issue references where relevant. Target
mainwith small, cohesive changes. - PRs explain the problem, resulting behavior and validation; link issues and include screenshots for UI changes and migration notes when applicable. Ensure CI passes and the branch is up to date before requesting review; see CONTRIBUTING.md.
UI changes
When touching ERB, view components or CSS, follow the design system guide:
- Use functional tokens from
app/assets/tailwind/sure-design-system.css, such asbg-container,text-primary,border-primary,bg-warning/10andtext-destructive. No raw Tailwind palette classes or hex literals. - Check
app/components/DS/first for alerts, badges, buttons, disclosures, dialogs and inputs. Use existingDS::*primitives. - If the same hand-built shape appears at least twice in a diff with no DS equivalent, propose a new
DS::*primitive before the second copy lands. - Use the
iconhelper, neverlucide_icondirectly; no raw SVG outside DS primitives. Uset()for user-facing strings and scale tokens instead of arbitrary pixel values when a scale token fits. - Adding styles to
app/assets/tailwind/sure-design-system.cssorapp/assets/tailwind/application.cssrequires explicit permission. - Reviewers escalate DS reuse and repeated-shape violations to close/rewrite; token and icon/SVG/localization/scale violations are request-changes.
API changes
Adding or modifying app/controllers/api/v1/ endpoints requires Minitest behavioral coverage and corresponding documentation-only rswag specs in spec/requests/api/v1/. Reusable schemas belong in spec/swagger_helper.rb; regenerate docs/api/openapi.yaml with RAILS_ENV=test bundle exec rake rswag:specs:swaggerize after changes.
Post-commit API consistency: after every API endpoint commit, follow the API checklist: Minitest coverage, no behavioral assertions in rswag, and the shared X-Api-Key authentication pattern in those tests/specs.
Provider and feature work
- Read provider sync guidance when changing imports, pending transactions, FX metadata or diagnostics. Use
DebugLogEntry.capture(...)for support-relevant failures and partial responses, with provider/source metadata and family/account-provider context where available. - For securities providers, follow adding a securities provider.
- For feature rollout, follow preview-feature gating; for goals, read the Goals guide.