Skip to content

docs: add ARCHITECTURE.md - Rust/Dart boundary ADR - #7

Merged
grunch merged 3 commits into
mainfrom
docs/architecture-adr
Mar 23, 2026
Merged

docs: add ARCHITECTURE.md - Rust/Dart boundary ADR#7
grunch merged 3 commits into
mainfrom
docs/architecture-adr

Conversation

@mostronatorcoder

@mostronatorcoder mostronatorcoder Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an Architecture Decision Record that clearly defines the boundary between Rust core and Flutter shell.

Why This Matters

The spec mentions "Rust Core, Flutter Shell" in multiple places but never explicitly explains:

  • What goes in Rust vs Dart
  • Why each decision was made
  • How to decide for new features

This document answers all three.

Content

The Golden Rule

RUST handles: Protocol, Crypto, Network, Business Logic
DART handles: UI, Platform APIs, Device I/O

Includes

  • Rationale tables for Rust vs Dart responsibilities
  • ASCII data flow diagram
  • Concrete example: QR scan → Lightning payment flow
  • Forbidden patterns - what NOT to do (with code examples)
  • Platform-specific considerations matrix
  • Dependencies summary (Cargo.toml + pubspec.yaml)
  • Checklist for deciding where new features go

For Claude/AI

This is a spec-kit reference document. When Claude implements features, it should:

  1. Read this document first
  2. Follow the checklist
  3. Never violate the forbidden patterns

Location

.specify/ARCHITECTURE.md - alongside PROTOCOL.md and DESIGN_SYSTEM.md

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive architectural documentation outlining component boundaries, responsibilities, data flow patterns, and best practices to ensure consistent code organization across the project.

Defines the clear boundary between Rust core and Flutter shell:

- Rust: Protocol, crypto, network, business logic (nostr-sdk)
- Dart: UI, platform APIs, device I/O (camera, push, biometrics)

Includes:
- Data flow diagram
- Example: QR scan → Lightning payment
- Forbidden patterns (what NOT to do)
- Platform-specific considerations
- Dependencies summary
- Checklist for new features

This is a spec-kit reference document for Claude to understand
the architecture decisions when implementing features.
@grunch

grunch commented Mar 23, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 69cfec91-9ee9-41b2-aa03-a30431ef05ff

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

A new Architecture Decision Record is introduced that establishes a Rust/Dart boundary within the project, defining cryptography, networking, and business logic as Rust responsibilities while assigning UI, platform APIs, and device I/O to Dart/Flutter.

Changes

Cohort / File(s) Summary
Architecture Decision Record
.specify/ARCHITECTURE.md
New ADR defining the strict Rust/Dart architectural boundary, including data-flow diagrams, component responsibilities, forbidden patterns, platform-specific considerations, and a feature checklist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A bridge 'tween Rust and Dart so fine,
Where crypto stays in logic's line,
And Flutter paints the UI view,
Boundaries clear—now code shines true!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding an Architecture Decision Record (ADR) that defines the Rust/Dart boundary for the project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/architecture-adr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.specify/ARCHITECTURE.md:
- Around line 8-13: Update the fenced code blocks that currently have no
language tag (the ASCII box art blocks and the numbered step list) to include a
language identifier like "text" or "plaintext" after the opening triple
backticks so markdownlint MD040 is satisfied; specifically, locate the
triple-backtick blocks that contain the box-drawing UI/architecture diagrams and
the numbered "1. User taps..." sequence and change their openings from ``` to
```text (or ```plaintext) for each occurrence across the documented sections.
- Line 216: The dependency declaration nostr-sdk = "0.44+" uses invalid Cargo
semver syntax; replace the version specifier with a valid requirement such as
"0.44" or "^0.44" to allow patch updates within 0.44.x without permitting
breaking minor/major changes, updating the line that currently reads nostr-sdk =
"0.44+" accordingly.
- Around line 183-187: The example should guard against null/empty barcode
values before calling the Rust API: in onDetect, check that capture.barcodes is
not empty and that capture.barcodes.first.rawValue (Barcode.rawValue) is
non-null and non-empty, and only then call rustApi.parseInvoice(invoice: code);
otherwise skip calling the Rust API or handle the invalid input; update the
onDetect handler to validate rawValue (String?) from mobile_scanner before
passing to rustApi.parseInvoice.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3bd78243-bdf8-48c9-8918-eeaa056073ca

📥 Commits

Reviewing files that changed from the base of the PR and between fa792ed and 46d5367.

📒 Files selected for processing (1)
  • .specify/ARCHITECTURE.md

Comment thread .specify/ARCHITECTURE.md
Comment on lines +8 to +13
```
┌─────────────────────────────────────────────────────────────────┐
│ RUST handles: Protocol, Crypto, Network, Business Logic │
│ DART handles: UI, Platform APIs, Device I/O │
└─────────────────────────────────────────────────────────────────┘
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language identifiers to fenced code blocks.

These blocks trigger markdownlint MD040 and should specify a language (for example text/plaintext) to keep docs lint-clean.

📝 Suggested doc fix
-```
+```text
 ┌─────────────────────────────────────────────────────────────────┐
 │  RUST handles: Protocol, Crypto, Network, Business Logic        │
 │  DART handles: UI, Platform APIs, Device I/O                    │
 └─────────────────────────────────────────────────────────────────┘

- +text
┌──────────────────────────────────────────────────────────────────────┐
...
└──────────────────────────────────────────────────────────────────────┘


-```
+```text
1. User taps "Scan QR" button
...
9. Rust handles NWC payment or returns invoice for manual payment
</details>


Also applies to: 44-89, 95-122

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.21.0)</summary>

[warning] 8-8: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @.specify/ARCHITECTURE.md around lines 8 - 13, Update the fenced code blocks
that currently have no language tag (the ASCII box art blocks and the numbered
step list) to include a language identifier like "text" or "plaintext" after the
opening triple backticks so markdownlint MD040 is satisfied; specifically,
locate the triple-backtick blocks that contain the box-drawing UI/architecture
diagrams and the numbered "1. User taps..." sequence and change their openings
from totext (or ```plaintext) for each occurrence across the documented
sections.


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment thread .specify/ARCHITECTURE.md
Comment thread .specify/ARCHITECTURE.md Outdated
grunch and others added 2 commits March 23, 2026 11:01
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@grunch
grunch merged commit 5a509d8 into main Mar 23, 2026
1 check passed
@grunch
grunch deleted the docs/architecture-adr branch March 23, 2026 14:02
grunch added a commit that referenced this pull request Apr 2, 2026
  orders.rs — Fix #7: store_trade_key_index before publish
  Moved store_trade_key_index(&order_id, trade_index) from before the action dispatch to inside the publish-success else branch. A publish failure no longer leaves a stale key mapping.

  orders.rs — Fix #5: ln_address logged in plain text
  Replaced ln_address={:?} (which printed the actual address) with ln_address=present/none using if ln_address_ref.is_some().

  orders.rs — Fix #4: fixed 30-min deadline regardless of activity
  Replaced the fixed deadline with a last_activity instant that resets on each matching event. The idle timeout is now 30 minutes of inactivity, not 30 minutes of total uptime.

  add_lightning_invoice_screen.dart — Fix #2: Lightning Address sent with 1-sat amount
  _isValid now returns false for @ inputs when _resolvedSats is null. _submit also guards against it and surfaces an error instead of falling through to BigInt.one.

  trade_detail_screen.dart — Fix #3: OrderStatus.pending mapped to TradeStatus.active
  Added TradeStatus.loading to the enum and made it the default branch in _mapOrderStatus. Unresolved/initial statuses no longer match the active-trade action button sections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant