From 7b74e3921f050b72596f7f6ff1f8485f9759a36f Mon Sep 17 00:00:00 2001 From: Niladri Das Date: Thu, 28 May 2026 13:23:05 +0530 Subject: [PATCH] [ci] run android pr checks --- .github/PULL_REQUEST_TEMPLATE.md | 34 +++ .github/workflows/android.yml | 44 ++++ .github/workflows/pr-check.yml | 43 +++ .gitignore | 2 + AGENTS.md | 434 +++++++++++++++++++++++++++++++ CONTRIBUTING.md | 358 +++++++++++++++++++++++++ gradle.properties | 1 - 7 files changed, 915 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/android.yml create mode 100644 .github/workflows/pr-check.yml create mode 100644 AGENTS.md create mode 100644 CONTRIBUTING.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d884a0f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +## Why + +- + +## What + +- + +## Result + +- + +## Checks + +- [ ] build passes +- [ ] tests pass +- [ ] lint passes +- [ ] focused on one purpose +- [ ] small enough to review calmly +- [ ] commit messages follow repository style +- [ ] final squash commit matches PR title +- [ ] deeper reasoning stays in this PR description +- [ ] squash commit is one clean title-style line +- [ ] review comments preserve useful reasoning when needed +- [ ] screenshots are consistent when UI changes +- [ ] release notes are calm when release-facing + +## Branch Rules + +- [ ] targets `main` +- [ ] no direct push to `main` +- [ ] no force push to `main` +- [ ] squash merge only +- [ ] required status checks pass diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..1ee1bd7 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,44 @@ +name: android + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: android-${{ github.ref }} + cancel-in-progress: true + +jobs: + android: + name: build test lint + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v6 + + - name: set up java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 21 + + - name: set up gradle + uses: gradle/actions/setup-gradle@v6 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v6 + + - name: build debug apk + run: ./gradlew :app:assembleDebug + + - name: run unit tests + run: ./gradlew :app:testDebugUnitTest + + - name: run lint + run: ./gradlew :app:lintDebug diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..e78836b --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,43 @@ +name: pr check + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +concurrency: + group: pr-check-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + android: + name: build test lint + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v6 + + - name: set up java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 21 + + - name: set up gradle + uses: gradle/actions/setup-gradle@v6 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v6 + + - name: build debug apk + run: ./gradlew :app:assembleDebug + + - name: run unit tests + run: ./gradlew :app:testDebugUnitTest + + - name: run lint + run: ./gradlew :app:lintDebug diff --git a/.gitignore b/.gitignore index 350dc5d..ca4e77e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ /.idea/assetWizardSettings.xml /.idea/deploymentTargetSelector.xml /.idea/deviceManager.xml +/.idea/.name +/.idea/markdown.xml .DS_Store /build /captures diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..809e2f5 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,434 @@ +# Commit Rules + +All git commits must follow the repository commit style. + +Format: + +```text +[scope] short summary +``` + +Examples: + +```text +[chat] preserve draft +[sync] retry pending send +[media] reduce preview memory +``` + +Rules: + +* lowercase only +* no emojis +* no exclamation marks +* short calm wording +* one purpose per commit +* avoid generic summaries +* summaries must be readable without opening code +* prefer specific engineering verbs over repetitive generic verbs + +Allowed scopes: + +* chat +* sync +* media +* session +* thread +* ui +* core +* ci +* notification +* auth +* storage + +Bad: + +```text +fix stuff +update code +final changes +``` + +Good: + +```text +[session] restore after restart +[chat] preserve unsent text +[sync] avoid duplicate delivery +``` + +Avoid overusing generic verbs: + +* add +* update +* fix + +Prefer precise intent verbs: + +* refine +* stabilize +* preserve +* reduce +* simplify +* tighten +* align +* defer +* isolate +* harden +* soften +* normalize +* cache +* streamline +* prevent + +Good precise summaries: + +```text +[sync] stabilize reconnect retry +[media] reduce preview memory +[session] preserve auth restore +[thread] normalize message ordering +``` + +# Language Style + +Prefer calm and concise wording. + +Use: + +* short phrases +* restrained wording +* clear intent +* product language when possible + +Avoid: + +* noisy technical phrasing +* excessive detail in summaries +* repeated engineering filler words + +Good product-leaning summaries: + +```text +[sync] steadier reconnect +[media] lighter previews +[thread] keeps your place +[session] ready after restart +``` + +# Pull Request Rules + +Use pull requests for app changes, even when working alone. + +Permanent rule: + +* all changes must go through pull requests +* merge only after checks pass +* do not push directly to main +* follow repository merge settings and commit style automatically + +# Branch Rules + +The `main` branch must remain stable. + +Rules: + +* no direct push to main +* all changes go through pull requests +* pull requests should stay focused on one purpose +* commit messages must follow repository commit style +* force push to main is not allowed + +Recommended flow: + +```text +feature branch -> pull request -> squash merge -> main +``` + +In GitHub repository settings, enable: + +* require pull request before merging +* require status checks to pass +* allow squash merge +* disable rebase merge +* disable merge commits +* require linear history +* block force pushes +* require branches to be up to date + +Default flow: + +```text +main -> always stable +feature branch -> work happens +pr -> review and squash merge +``` + +Why: + +* cleaner history +* safer changes +* easier rollback +* agents can explain changes +* discussions stay attached to code +* more trusted and open-source ready + +Branch names should be short, lowercase, and scoped: + +```text +chat/draft-preserve +sync/retry-queue +media/image-cache +``` + +PR titles should match the commit identity style: + +```text +[chat] preserve unsent draft +[sync] improve reconnect retry +``` + +Direct push to `main` is allowed only for: + +* tiny docs +* typo fixes +* emergency hotfix + +For all other work, create a feature branch and open a PR before merging. + +# Repository Habits + +Consistency matters more than sophistication. + +Trust-building rules: + +* keep PRs small +* never leave broken `main` +* write calm release notes +* close stale branches +* avoid huge final-cleanup commits +* keep filenames predictable +* avoid random abbreviations +* use draft PRs while work is still in progress +* squash merge PRs into one calm commit on `main` +* keep screenshots consistent +* tag releases properly +* use semantic versions calmly + +Good doc filenames: + +```text +docs/architecture.md +docs/message-flow.md +docs/offline-behavior.md +``` + +Good release tags: + +```text +v0.4.1 +v0.5.0 +v0.6.0-beta1 +``` + +Write PR descriptions in this shape: + +```text +why: +message retries could duplicate after reconnect + +what: +adds request id tracking for pending sends + +result: +delivery becomes idempotent during reconnect +``` + +PR title and final squash commit should match: + +```text +[sync] improve reconnect retry +``` + +Keep deeper reasoning in the PR description, not in the squash commit body. +The squash commit on `main` should be one clean title-style line. + +# Continuous Integration + +Keep CI simple and fast. + +Only use Gradle tasks that currently exist in the project. Do not add +placeholder CI steps for ktlint, detekt, dependency review, Firebase validation, +or any other tool until the plugin, task, or integration is actually configured. + +Rules: + +* no fake automation +* no speculative checks +* CI must reflect real project state + +Pull requests should run: + +```text +./gradlew test +./gradlew lint +./gradlew assembleDebug +``` + +Use these workflows: + +```text +.github/workflows/pr-check.yml +.github/workflows/android.yml +``` + +Later additions should happen in two steps: + +```text +[core] add ktlint configuration +[ci] run ktlint in pull requests +``` + +Use the same pattern for detekt, dependency review, secret scanning, Firebase +emulator tests, or Firebase rules validation. + +# Release Rules + +Start with manual releases and automated checks. + +Release flow: + +```text +feature work -> PR -> squash merge -> stable main -> manual version bump -> tag -> GitHub release +``` + +Version tags should stay semantic and calm: + +```text +v0.1.0 +v0.2.0 +v0.3.0-beta1 +``` + +Rules: + +* keep release decisions manual for now +* use CI for checks and debug APK builds +* avoid full auto-release until signing and release assets are mature +* write calm prose release notes +* avoid generated bullet dumps + +Good release note style: + +```text +DIFF Android 0.3.0 improves reconnect handling, draft preservation, and pull request navigation stability. +``` + +Later, tags may trigger release asset builds: + +```text +git tag v0.4.0 +git push origin v0.4.0 +``` + +# Issue Rules + +Use GitHub Issues for tracked work and problems. Keep the workflow minimal. + +Good labels: + +```text +bug +enhancement +design +android +sync +discussion +``` + +Good issue titles are calm and specific: + +```text +draft can disappear after process death +reconnect may duplicate pending send +review comments jump during refresh +``` + +Avoid noisy titles: + +```text +urgent bug please fix +``` + +Use this structure: + +* issues for actual tracked work or problems +* discussions for ideas and thoughts +* PRs for implementation history +* `docs/roadmap.md` for product direction + +Avoid Jira-style process, large project boards, and many templates early on. + +# Review Comment Rules + +Leave small review comments occasionally when there is reasoning worth preserving. + +Good review comments explain architecture, tradeoffs, edge cases, or future cleanup: + +```text +consider reconnect edge case here +might move this into session manager later +keeping this separate for retry safety +avoids duplicate notification on restore +``` + +Rules: + +* comment only when useful context exists +* keep comments calm and short +* focus on architecture or tradeoffs +* avoid fake approval chatter +* do not create conversations just to make activity + +Preferred prefixes: + +```text +observation: +question: +note: +follow-up: +later: +``` + +Examples: + +```text +note: +keeping this separate avoids duplicate reconnect work + +question: +should session restore own this state instead? + +later: +might move retry tracking into sync manager + +observation: +this becomes easier to test independently +``` + +Avoid loud reviewer language unless truly needed: + +```text +nit: +must fix +blocking +urgent +``` + +Bad: + +```text +looks good to me +approved +great work +``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..45e18a4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,358 @@ +# Contributing + +## Branch Rules + +The `main` branch must remain stable. + +Permanent rule: + +* all changes must go through pull requests +* merge only after checks pass +* do not push directly to main +* follow repository merge settings and commit style automatically + +Rules: + +* no direct push to main +* all changes go through pull requests +* pull requests should stay focused on one purpose +* commit messages must follow repository commit style +* force push to main is not allowed + +Recommended flow: + +```text +feature branch -> pull request -> squash merge -> main +``` + +In GitHub repository settings, enable: + +* require pull request before merging +* require status checks to pass +* allow squash merge +* disable rebase merge +* disable merge commits +* require linear history +* block force pushes +* require branches to be up to date + +## Repository Habits + +Consistency matters more than sophistication. + +Trust-building rules: + +* keep PRs small +* never leave broken `main` +* write calm release notes +* close stale branches +* avoid huge final-cleanup commits +* keep filenames predictable +* avoid random abbreviations +* use draft PRs while work is still in progress +* squash merge PRs into one calm commit on `main` +* keep screenshots consistent +* tag releases properly +* use semantic versions calmly + +Good doc filenames: + +```text +docs/architecture.md +docs/message-flow.md +docs/offline-behavior.md +``` + +Good release tags: + +```text +v0.4.1 +v0.5.0 +v0.6.0-beta1 +``` + +Write PR descriptions in this shape: + +```text +why: +message retries could duplicate after reconnect + +what: +adds request id tracking for pending sends + +result: +delivery becomes idempotent during reconnect +``` + +PR title and final squash commit should match: + +```text +[sync] improve reconnect retry +``` + +Keep deeper reasoning in the PR description, not in the squash commit body. +The squash commit on `main` should be one clean title-style line. + +## Continuous Integration + +Pull requests run a small Android check: + +```text +./gradlew test +./gradlew lint +./gradlew assembleDebug +``` + +Keep CI simple and fast. Only use Gradle tasks that currently exist in the +project. Do not add placeholder CI steps for ktlint, detekt, dependency review, +Firebase validation, or any other tool until the plugin, task, or integration is +actually configured. + +Rules: + +* no fake automation +* no speculative checks +* CI must reflect real project state + +Later additions should happen in two steps: + +```text +[core] add ktlint configuration +[ci] run ktlint in pull requests +``` + +Use the same pattern for detekt, dependency review, secret scanning, Firebase +emulator tests, or Firebase rules validation. + +## Release Rules + +Start with manual releases and automated checks. + +Release flow: + +```text +feature work -> PR -> squash merge -> stable main -> manual version bump -> tag -> GitHub release +``` + +Version tags should stay semantic and calm: + +```text +v0.1.0 +v0.2.0 +v0.3.0-beta1 +``` + +Rules: + +* keep release decisions manual for now +* use CI for checks and debug APK builds +* avoid full auto-release until signing and release assets are mature +* write calm prose release notes +* avoid generated bullet dumps + +Good release note style: + +```text +DIFF Android 0.3.0 improves reconnect handling, draft preservation, and pull request navigation stability. +``` + +Later, tags may trigger release asset builds: + +```text +git tag v0.4.0 +git push origin v0.4.0 +``` + +## Issue Rules + +Use GitHub Issues for tracked work and problems. Keep the workflow minimal. + +Good labels: + +```text +bug +enhancement +design +android +sync +discussion +``` + +Good issue titles are calm and specific: + +```text +draft can disappear after process death +reconnect may duplicate pending send +review comments jump during refresh +``` + +Avoid noisy titles: + +```text +urgent bug please fix +``` + +Use this structure: + +* issues for actual tracked work or problems +* discussions for ideas and thoughts +* PRs for implementation history +* `docs/roadmap.md` for product direction + +Avoid Jira-style process, large project boards, and many templates early on. + +## Commit Rules + +Format: + +```text +[scope] short summary +``` + +Rules: + +* lowercase only +* no emojis +* no exclamation marks +* short calm wording +* one purpose per commit +* avoid generic summaries +* summaries must be readable without opening code +* prefer specific engineering verbs over repetitive generic verbs + +Allowed scopes: + +* chat +* sync +* media +* session +* thread +* ui +* core +* ci +* notification +* auth +* storage + +Examples: + +```text +[session] restore after restart +[chat] preserve unsent text +[sync] avoid duplicate delivery +``` + +Avoid overusing generic verbs: + +* add +* update +* fix + +Prefer precise intent verbs: + +* refine +* stabilize +* preserve +* reduce +* simplify +* tighten +* align +* defer +* isolate +* harden +* soften +* normalize +* cache +* streamline +* prevent + +Good precise summaries: + +```text +[sync] stabilize reconnect retry +[media] reduce preview memory +[session] preserve auth restore +[thread] normalize message ordering +``` + +## Language Style + +Prefer calm and concise wording. + +Use: + +* short phrases +* restrained wording +* clear intent +* product language when possible + +Avoid: + +* noisy technical phrasing +* excessive detail in summaries +* repeated engineering filler words + +Good product-leaning summaries: + +```text +[sync] steadier reconnect +[media] lighter previews +[thread] keeps your place +[session] ready after restart +``` + +## Review Comments + +Small review comments are useful when they preserve reasoning. + +Good comments explain architecture, tradeoffs, edge cases, or future cleanup: + +```text +consider reconnect edge case here +might move this into session manager later +keeping this separate for retry safety +avoids duplicate notification on restore +``` + +Rules: + +* comment only when useful context exists +* keep comments calm and short +* focus on architecture or tradeoffs +* avoid fake approval chatter +* do not create conversations just to make activity + +Preferred prefixes: + +```text +observation: +question: +note: +follow-up: +later: +``` + +Examples: + +```text +note: +keeping this separate avoids duplicate reconnect work + +question: +should session restore own this state instead? + +later: +might move retry tracking into sync manager + +observation: +this becomes easier to test independently +``` + +Avoid loud reviewer language unless truly needed: + +```text +nit: +must fix +blocking +urgent +``` diff --git a/gradle.properties b/gradle.properties index 7c13a57..2d6942d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,6 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -org.gradle.java.home=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. For more details, visit # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects