Feature Development Workflow
This document outlines the standard operating procedure for adding new features to the project. AI agents must follow this pipeline sequentially.
1. Requirement & Planning Phase
- Understand the Goal: Cross-reference requests against the strategic roadmap (
research/Expected_features_speed_Assist_Product_Roadmap.md). If a feature violates the core pivot (e.g., adding a heavy map module), flag it. - Create an Implementation Plan: For any non-trivial change, AI must output an
implementation_plan.mddetailing:- Which layers (
data,domain,presentation) will change. - What new classes or tests will be created.
- Which layers (
- Wait for Approval: Do not write code until the user approves the plan.
2. Execution Phase (AI & Developer Workflow)
When executing a new feature, strict adherence to the following sequence is mandatory. Do not make any assumptions, fail out loud, and ask for clarity.
- Information Gathering: Clarify requirements and gather any necessary mockups or existing references.
- Analysis: Analyze the codebase to find where the feature fits cleanly without breaking existing logic.
- Preview (Diff Style): Propose the exact code changes to the user using a
diffstyle format. Clearly state the class names and functions being modified or created. - Approval & Execution: Stop and wait. Do not apply corrections or write the code until explicit approval is given by the user. Once approved, apply the exact changes.
- Post-Correction Review: After applying the feature, show the resulting code changes using a
diffstyle summary to confirm the exact modifications made. - Module Separation (SDK Architecture): Write logic in the appropriate module (
:speed-core,:speed-ui,:speed-overlay,:speed-autostart,:speed-bom). Keep:speed-coreheadless with zero Compose dependencies.
3. Testing Phase (Mandatory)
Every new feature or bug fix MUST be accompanied by unit and/or UI tests.
- Unit Tests: Use JUnit4 / Robolectric, MockK, and kotlinx-coroutines-test.
- Domain telematics algorithms (
TelematicsEngine,SpeedWatcher,SpeedUnit) and repository implementations must have high branch and line coverage (target > 90%). - Verification: Run
./gradlew testDebugUnitTestlocally to ensure all test suites pass before committing.
- Domain telematics algorithms (
- UI Tests: Use Compose Testing rules (
createComposeRule) to verify that UI elements render correctly based on specificSpeedDataandUiStateinputs. - CI/CD Quality Gates: All commits and Pull Requests are automatically validated by GitHub Actions (
.github/workflows/quality-gates.yml).
4. Verification & Documentation
- Run Quality Gates: Before concluding any task or pushing code, run the strict static analysis gates:
- Run
./gradlew detekt lintDebug - Fix any code smells or formatting issues reported by these tools.
- Run
- Run the Build: Always verify that the project compiles via
./gradlew assembleDebug. - Update Docs: If you added or modified public APIs, update the web documentation in
docs/and verify the build withnpm run docs:build --prefix docs. - Walkthrough: Generate a
walkthrough.mdsummarizing what was built, how it was tested, and how to verify the feature.
5. API Stability & Deprecation Policy (B2B SDK Lifecycle)
To ensure long-term stability across dozens of versions and enterprise clients, we enforce a strict backwards-compatibility rule:
- Never abruptly delete public APIs.
- Deprecate First: Mark obsolete functions/classes with the Kotlin
@Deprecatedannotation. You must include a descriptivemessageexplaining why it is deprecated and provide areplaceWithparameter so the client's IDE can automatically auto-correct their code. - 2-Major-Version Rule: A deprecated API must be fully supported under the hood for exactly 2 major versions. (e.g., An API deprecated in v3.1.0 can only be deleted in v5.0.0).
- Update Migration Guides: Any breaking changes or deprecations MUST be documented in
docs/guide/migration-guides.md.