DevPlaceApp - Complete Implementation Document
- Version: 0.3.4
- Status: Active (zero untracked open points)
- Date: 29-11-2026
- Owner: retoor
DevPlaceApp is the native C++ desktop port of the DevPlaceIOS app (SwiftUI, iOS 26, bundle wok.DevPlaceIOS, version 1.1.0). It talks to the DevPlace backend (https://devplace.net/) exclusively through aiohttpcpp and draws its UI with SDL3. Normative per-screen detail (verbatim strings, layout trees, metrics, flows) lives in docs/inventory/*.md; this file owns IDs, decisions, caps and verification.
0. Document control
0.1 Conventions
- Normative IDs: FR, SEC, OPS, NFR, UX, PG, D, PIN, A, TRK, DOC, G, NG. IDs are never reused once retired. Cross-reference by ID.
- The inventory files are normative sub-specs:
docs/inventory/models.md(MODEL),shell.md(SHELL),posts.md(POSTS),social.md(SOCIAL). A requirement that cites "INV- section N" is satisfied only when that section is reproduced. - No open gaps: anything that would be an open point has a decided default in section 9 or a tracked assumption below.
- Language of prose: English. Dates DD-MM-YYYY, decimal comma in documents (A-05 of the method). Code and logs keep ISO 8601 UTC.
- Code style: C++20, namespace
dp, one class per header/source pair for domain code (small view primitives may share a header, D-11), zero warnings with-Wall -Wextra, no TODO or placeholders, no em dashes (U+2014).
0.2 Assumptions (tracked, all need fallback)
| ID | Assumption | Owner | Verify by | Fallback |
|---|---|---|---|---|
| A-01 | The DevPlace REST and websocket API behaves as the Swift SDK encodes it (no newer contract). | retoor | 31-12-2026 | Adjust DevPlaceRequest only; models are tolerant of unknown keys. |
| A-02 | No iOS device screenshots exist, so pixel parity is proven against numeric spec values and by deterministic renders, not against Apple renders. | retoor | 31-12-2026 | Every unverified metric is recorded as DIFF in PARITY_CHECKLIST.md with its source line. |
| A-03 | SDL3 3.4.2, SDL3_ttf 3.2.2 and aiohttpcpp (installed in ~/.local) stay available on the build machine. | retoor | 31-12-2026 | Pins PIN-02..PIN-04 name exact versions; README documents the vcpkg-free vendored route. |
| A-04 | A desktop GL/Vulkan-free software path is fast enough: full-frame redraw only when dirty, target under 16 ms at 430x900 points, scale 1. | retoor | 15-12-2026 | Add dirty-rect redraw in Host (D-02 allows it); measured in section 6.5. |
| A-05 | Backend avatars are SVG (multiavatar) and attachments are PNG/JPEG/GIF/SVG/video. | retoor | 31-12-2026 | Unknown media types render a generic file tile with a Save action. |
0.3 Hard global caps
| Cap | Value | Enforced at |
|---|---|---|
| Request body | 25 MiB | NetworkService::send (spec/NetLimits.hpp) |
| Response body | 32 MiB | NetworkService (per request override allowed, never above 64 MiB) |
| Requests in flight | 24 | NetworkService |
| Request timeout | 60 s total, 20 s connect | NetworkService |
| GET retries | 1 (offline or timeout only, 400 ms backoff) | NetworkService |
| Redirects | 5 | NetworkService |
| Websocket frame | 1 MiB | SocketSession |
| UiQueue pending closures | 4096 (drop oldest, counted) | UiQueue |
| Text render cache | 3000 entries / 96 MiB | TextEngine |
| Image cache | 64 MiB / 6 concurrent loads | RemoteImages |
| Decoded image edge | 8192 px; 64 MiB per bitmap | Bitmap::decode |
| Edit buffer | 512 KiB | TextInput (spec/EditLimits.hpp) |
| Markdown input | 200000 characters, nesting depth 32 | Markdown |
| Log file | 10 MiB x 3 rotations | Log |
| Recent emojis | 30 | SettingsStore (INV-shell 5) |
| Post title / body | 500 / 10..125000 UTF-16 units; comment 3..125000; report detail 2000; poll 2..6 options | INV-posts 4.4, 5, 9 |
0.4 Changelog (ascending, one row per change)
| Version | Date | Change |
|---|---|---|
| 0.1.0 | 29-11-2026 | Initial spec skeleton |
| 0.2.0 | 29-11-2026 | Full requirement set, decisions D-01..D-14, pins, estimates, verification plan |
| 0.3.0 | 29-11-2026 | Implementation complete: verification results recorded in PARITY_CHECKLIST.md and docs/benchmarks.md |
| 0.3.1 | 29-11-2026 | Optional --fit-screen PERCENT: window height capped at the percentage of the display and centered |
| 0.3.2 | 29-11-2026 | --fit-screen polls the display bounds every 250 ms so a resized screen is re-fitted and re-centered |
| 0.3.3 | 29-11-2026 | --fit-screen polling runs in the event loop so it also works while the UI is idle |
| 0.3.4 | 29-11-2026 | --fit-screen corrects drift from the centered rect during a 15 s startup grace |
1. Goals and non-goals
- G-01: Every iOS screen, flow and edge case exists in the C++ app (parity checklist rows all PASS or DIFF with a reason).
- G-02: All network traffic (HTTP, HTTPS, websocket) uses aiohttpcpp only; verified by grep (VER-03).
- G-03: UI is pixel-faithful to the SwiftUI source: same points, fonts (Inter substitute), colors (both appearances), radii, spacing, animation durations.
- G-04: The binary builds with
cmake -S . -B build && cmake --build buildon Linux, macOS and Windows with no iOS toolchain. - G-05: Responsive from 320x480 points up; touch, mouse and keyboard all work.
- G-06: Every screen is reachable headlessly (
--screen,--screenshot) and every flow is runnable offline with--mock. - NG-01: No APNs: push is replaced by polling the unread counts (D-05).
- NG-02: No iOS-only hardware features (haptics, camera capture, share sheet UI beyond file dialogs and clipboard).
- NG-03: No App Store packaging, signing or entitlements processing.
- NG-04: No new backend endpoints, keys or behavior (hermetic rule).
- NG-05: No security hardening beyond what iOS did (owner decision): credentials are stored as the Keychain stored them, in a 0600 file (D-04).
2. Scope (personas, use cases)
Personas: anonymous reader (feed, posts, profiles without login), member (post, comment, vote, react, poll, report, follow, block, mute, message, notifications), operator (runs headless smoke and parity checks).
Use cases (each owns the PG and FR IDs below): browse the feed with infinite scroll; read a post with comments, reactions, poll, attachments; sign in and sign up; create, edit and delete posts; comment, reply, edit, delete; vote and react optimistically; chat live over websocket with typing and read receipts; read and open notifications; view and manage profiles; configure appearance and feed options; delete the account.
3. Requirements
3.1 Network and data
- FR-NET-01: All HTTP(S) requests go through
NetworkServiceon one worker thread that owns the aiohttpLoopandClientSession; callbacks run on the UI thread. (INV-shell 6) - FR-NET-02: Query values and path segments are percent-encoded by
UrlCodec; base URL ishttps://devplace.net/and overridable for tests. - FR-NET-03: Per request timeout, bounded retry for GET, size caps in section 0.3, cancellation by
CancelToken. - FR-NET-04: Failures map to
Error{kind,status,message,isSpecific}; offline and timeout are distinct kinds; the API error JSON is decoded with the exact message-selection rules of INV-models. - FR-NET-05: The chat websocket uses
SocketSessionoverClientSession::ws_connect; reconnect backoff 200 ms doubling to 5000 ms, close code 4013 retries at 200 ms (INV-shell 6, INV-social 12.9). - FR-NET-06: Image and attachment downloads use the same NetworkService (absolute URLs); decode happens off the UI thread.
- FR-MOD-01: Every model decodes tolerantly (unknown keys ignored, same optionality as Swift) per INV-models.
- FR-MOD-02: Dates decode ISO 8601 with optional fractional seconds;
beforecursors encode as2026-11-29T08:00:00Z. - FR-MOD-03: Model update helpers (vote, reaction toggling, comment replacement) behave exactly as the Swift extensions.
- FR-API-01:
DevPlaceApiexposes every method of the Swift protocol;ProdDevPlaceApirefreshes an about-to-expire token (under 3600 s left) with stored credentials before each authenticated call, exactly as the Swift code, including its quirks recorded in INV-shell 6. - FR-API-02:
MockDevPlaceApireturns the Swift mock fixtures with the same delays and is selected by--mock. - FR-STORE-01: Settings (appearance default dark, feed toggles, recent emojis, drafts) persist in one JSON file in the SDL pref path, written atomically. (D-04)
- FR-STORE-02: Credentials persist in a 0600 JSON file, written before the sign-in request like the Swift code (INV-shell 12).
- FR-STORE-03:
AppStatemirrors the Swift singleton (token, currentUser, feed, unread counts, pending conversation) and notifies the UI through a version counter. - FR-STORE-04: Drafts (post title, post message, reply message) persist per keystroke with the same keys.
3.2 Screens and features
- FR-SHELL-01: Four tabs (Posts, Messages, Notifications, Settings) with badges, reselect behavior, cross-tab routing and unread refresh on tab change and foreground. (INV-shell 11)
- FR-AUTH-01: Sign in, sign up (validation order and messages exact), forgot password link, terms link, account created alert. (INV-shell 12, 13)
- FR-SET-01: Settings form, appearance picker, feed toggles, sign out, delete account two-step alert with password. (INV-shell 14)
- FR-FEED-01: Feed with cards, pull to refresh, infinite scroll with duplicate guard, reselect scroll-to-top, empty and error states. (INV-posts 1, 3)
- FR-POST-01: Post detail with markdown body, attachments, poll, reactions, votes, comments tree, edit and delete own post, deep link scroll to comment. (INV-posts 2)
- FR-CREATE-01: Create and edit post with topic, project link, attachments, poll creation, drafts, counters, validation. (INV-posts 4, 10)
- FR-CMT-01: Comment list, editor with mention suggestions, reply, edit, delete, quote, votes and reactions. (INV-posts 5, INV-social 19)
- FR-VOTE-01: Optimistic vote toggle with rollback; always sends
.up. (INV-posts 8, INV-shell 4) - FR-REACT-01: Optimistic emoji reaction toggle with rollback; emoji picker with 9 categories (827 emojis) and recents. (INV-social 20)
- FR-POLL-01: Poll voting toggles, results bars, creation with 2..6 options. (INV-posts 9, 10)
- FR-REPORT-01: Report reasons, detail text (2000), duplicate handling, visibility toggle. (INV-posts 11)
- FR-MSG-01: Conversation list, conversation view, bubbles, typing indicator, read receipts, send flow with attachments, live socket. (INV-social 11..14)
- FR-NOTIF-01: Notification groups, open and route rules (conversation, own profile, web, post with comment), mark read, load more. (INV-social 15)
- FR-PROF-01: Profile screen (own and other) with follow, unfollow, block, mute, badges, stats, projects, gists. (INV-social 16)
- FR-MEDIA-01: Attachment viewer, fullscreen zoom viewer (1x..5x pinch via ctrl+wheel and buttons), video thumbnail and external open, share via save dialog or clipboard. (INV-social 17)
- FR-UP-01: Attachment uploader: file dialog, upload by URL, delete attachment, progress states. (INV-social 18)
- FR-PUSH-01: Unread counts poll every 60 s while a user is logged in and the window is active; foreground and tab change refresh immediately; the window title shows the unread notification count (icon badge equivalent). (D-05)
- FR-CLI-01:
--screen <id>,--screenshot <png>,--mock,--scale <n>,--size WxH,--dark|--light,--wait <s>,--script <file>,--base-url <url>,--dump-a11y. - FR-CLI-02: Screen ids: feed, post, create-post, edit-post, login, signup, settings, profile, messages, conversation, notifications, emoji-picker, report, comment-editor, attachment-viewer, uploader (full list in README).
3.3 UX and rendering
- UX-LAYOUT-01: The layout engine implements SwiftUI's proposal protocol (stacks sort by flexibility, spacers, flexible frames, fixedSize, layout priority, ViewThatFits). All values are points.
- UX-LAYOUT-02: Modifiers (padding, frame, background, overlay, border, clip, opacity, offset, scale, shadow, env font and foreground) are wrapper views.
- UX-THEME-01: Colors come from spec/Theme.hpp: asset catalog values converted from Display-P3 to sRGB once (ADR 0004), light and dark, plus iOS system colors; appearance setting System/Light/Dark applies instantly.
- UX-FONT-01: Inter replaces SF Pro; text styles map to SwiftUI sizes; line heights follow the SF Pro table (Font.cpp); measurement is window-scale independent. (D-06)
- UX-RENDER-01: One software canvas: anti-aliased rounded rects, strokes, linear gradients, Gaussian-like shadows, bitmaps, clip stack with rounded clips, global opacity.
- UX-INPUT-01: TextField, SecureField, TextEditor with caret, selection, clipboard, word movement, IME commit text, mouse selection.
- UX-HOST-02: Optional
--fit-screen PERCENT(20 to 100). The OUTER window (client area plus the window manager frame) is at most PERCENT of the display height, never wider than the display, and centered on the display. The cap is a hard maximum handed to the window system and is re-applied within 250 ms when the display size changes (polled, because a streaming client may not raise an SDL event). During the first 15 seconds the app also corrects any move or resize by the window manager or desktop panels (2 px tolerance). Off by default. Pure math insrc/ui/WindowFit.hpp, bounds inspec/AppSpec.hpp. - UX-HOST-01: SDL3 window, frame rebuilt on demand, press/drag/tap/long-press gestures, wheel scroll, drag scroll with momentum, pull to refresh, keyboard shortcuts (Esc back, Ctrl+R refresh), dark mode follows the system when appearance is System.
- UX-ICON-01: SF Symbols map to Lucide icons (ISC) in assets/icons via
Icons::resolve; the mapping is listed in MAPPING.md. (D-07) - UX-IMG-01: Bitmaps decode through stb_image and nanosvg; remote images are cached and loaded off-thread.
- UX-RESP-01: Layout works from 320 points wide; wider windows center content in a column of at most 700 points (DIFF-02).
- UX-A11Y-01: Keyboard focus order follows tree order, Tab/Shift+Tab move focus between inputs and buttons,
--dump-a11yprints the label tree. (DIFF-05) - UX-L10N-01: Strings are English as in the app;
.stringsdo not exist in the source, so the Localizer holds the singleentable inspec/Strings.hpp.
3.4 Non-functional
- NFR-THR-01: All SDL and UI state on the main thread; aiohttp objects only on the network thread; crossing only via UiQueue and call_soon_threadsafe.
- NFR-MEM-01: Every cache has a byte or entry cap (section 0.3).
- NFR-TEST-01: Tests use
tests/TestHarness.hpp, run serially withmake test; tierstests/unit,tests/api(local aiohttpcpp server),tests/e2e(headless host renders and scripted taps). - NFR-PKG-01: Assets resolve from
DEVPLACE_ASSETS, then next to the binary, then the source tree. - NFR-PERF-01: Frame build+layout+draw at 430x900 points under 16 ms median in Release on the reference machine (measured, section 6.5).
- OPS-01: Logging to stderr and a rotating file under the pref path; levels via
DEVPLACE_LOG_LEVEL; secrets are never logged. - OPS-02: Missing secrets or env: none required (the app has no embedded keys);
DEVPLACE_BASE_URLoverrides the backend; a warning is logged when it is set. - SEC-01: No hardening work (owner decision NG-05); recorded so reviewers do not file it as a bug.
4. Surfaces
| ID | Surface | Spec |
|---|---|---|
| PG-01 | Main tabs | INV-shell 11 |
| PG-02 | Feed | INV-posts 1, 3 |
| PG-03 | Post detail | INV-posts 2 |
| PG-04 | Create / edit post | INV-posts 4, 10 |
| PG-05 | Messages list | INV-social 11 |
| PG-06 | Conversation | INV-social 12..14 |
| PG-07 | Notifications | INV-social 15 |
| PG-08 | Profile | INV-social 16 |
| PG-09 | Settings | INV-shell 14 |
| PG-10 | Sign in | INV-shell 12 |
| PG-11 | Sign up | INV-shell 13 |
| PG-12 | Emoji picker, attachment viewer, uploader, report, mention suggestions | INV-social 17..20, INV-posts 11 |
5. Architecture
Layers (dependency direction downwards only): app (main, App, routes) > screens (Screen objects = presenters + views) > ui (framework) and store/api (domain) > net > core.
- PIN-01: C++20, GCC 15.2 or Clang 17+, CMake 4.2 (minimum 3.25).
- PIN-02: SDL3 3.4.2 (system package, CMake config
SDL3). - PIN-03: SDL3_ttf 3.2.2 (CMake config
SDL3_ttf). - PIN-04: aiohttpcpp installed to
~/.local(find_package(aiohttpcpp CONFIG)), fallbackadd_subdirectory(../aiohttpcpp); carries libuv, llhttp, wolfSSL, zlib. - PIN-05: nlohmann/json 3.x (shipped by aiohttpcpp).
- PIN-06: stb_image (vendored
third_party/stb, public domain). - PIN-07: nanosvg and nanosvgrast (vendored
third_party/nanosvg, zlib license). - PIN-08: Inter 4.1 (SIL OFL,
assets/fonts), DejaVu Sans Mono (Bitstream Vera license), Noto Color Emoji (OFL). - PIN-09: Lucide icons (ISC,
assets/icons).
Key classes: NetworkService, SocketSession, DevPlaceRequest, DevPlaceApi (Prod, Mock), AppState, SettingsStore, SessionStore; UI: Canvas, TextEngine, View and wrappers, Host, Navigator, Overlays, TabBarView, Form controls, TextInput, Markdown, RemoteImages; app: DevPlaceApp : ui::App.
Screens are Screen objects (one per iOS View + ViewModel pair); they hold state, build views each frame and call the API with callbacks. See src/AGENTS.md for the file layout.
6. Data model, API, security, compliance, ops
6.1 Data model
Normative: docs/inventory/models.md. Code: src/model/.
6.2 API
Endpoint table: INV-posts 0.3 and INV-shell 6. Code: src/api/DevPlaceRequest.
6.3 Security and compliance
SEC-01 applies. Compliance: licenses of vendored assets are listed in THIRD_PARTY.md; the app collects nothing beyond what the iOS app sent.
6.4 Ops
Logs: $PREF/devplace.log rotating. Build: make, make test, make run, make smoke. Release: version in VERSION, tags vMAJOR.MINOR.PATCH.
6.5 Verification plan
- VER-01:
cmake -S . -B build && cmake --build buildwith-Werroronce per release. - VER-02:
tools/smoke.shwalks every--screenid headlessly with--mock, checks exit code and PNG, then runs the scripted flows in SMOKE_TEST.md. - VER-03:
tools/check-net.shgrepscurl|poco|beast|AFNetworking|Alamofire|getaddrinfo|socket(|SDL_netoversrc,tests,spec,toolsand fails on any hit outside the allowlist. - VER-04: PARITY_CHECKLIST.md rows with file:line and PNG paths; pixel numbers only from measured comparisons.
- VER-05:
tools/validate.py(IDs, changelog order, headers, forbidden patterns, AGENTS.md coverage, research format). - VER-06: Measured performance numbers recorded in docs/benchmarks.md with machine description.
7. Estimates
| Area | PW | Driver |
|---|---|---|
| Net, models, API, stores | 2,0 | 40 endpoints, 45 models, tolerant decoding, tests against local server |
| UI framework (layout, canvas, text, input, host) | 3,0 | SwiftUI protocol, rich text, text editing |
| Navigation, tabs, overlays, form controls | 1,5 | iOS 26 look without a toolkit |
| Markdown and images | 1,0 | GFM subset, SVG avatars |
| Screens (11 screens, 25 components) | 4,0 | ~9k lines of SwiftUI to reproduce |
| Verification, docs, smoke, parity | 1,5 | screenshots, scripts, checklists |
| Total | 13,0 | Sequential; parallel agent work compresses wall time, not cost |
Scope freeze: D-12.
8. Risks and mitigations
| ID | Risk | Mitigation |
|---|---|---|
| R-01 | iOS 26 native control metrics unknown | DIFF rows, tune against owner screenshots when supplied (A-02) |
| R-02 | Software canvas too slow on 4K | Dirty-rect redraw (A-04 fallback), scale cap 3 |
| R-03 | aiohttpcpp gaps (multipart upload) | Build multipart body ourselves over RawBytes (done in DevPlaceRequest) |
| R-04 | Backend change | Tolerant models, A-01 |
| R-05 | Parallel agent edits collide | D-08: disjoint directories, own build dirs, lead merges |
9. Decisions
- D-01: SDL3 with a software canvas and own widget layer; no GUI toolkit dependency. Rationale: SDL3 is mandated, pixel control and headless capture come free. (ADR 0002)
- D-02: Views are rebuilt every frame from presenter state (SwiftUI semantics), redraw on demand. Rationale: 1:1 port of SwiftUI code, no diffing bugs.
- D-03: Display-P3 asset colors are converted to sRGB once at port time (ADR 0004).
- D-04: Keychain becomes a 0600 JSON file, UserDefaults a JSON file, both in
SDL_GetPrefPath("devplace","DevPlaceApp"); DIFF-03. - D-05: APNs is replaced by polling unread counts every 60 s plus window title badge; DIFF-04.
- D-06: Inter replaces SF Pro; line heights follow the SF Pro table; DIFF-01.
- D-07: SF Symbols map to Lucide icons; DIFF-06.
- D-08: Build in the shared tree with disjoint directories per developer and separate build directories instead of git worktrees (ADR 0003).
- D-09: One network worker thread owning the aiohttp loop; results return through UiQueue.
- D-10: Emoji render from Noto Color Emoji at the bitmap strike and downscale; advance 1,17 em.
- D-11: Small view primitives may share a header (Views, Modifiers); domain classes keep one class per file pair.
- D-12: Scope is frozen to the iOS 1.1.0 source; new ideas go to a later release.
- D-13: Untested native metrics are not guessed twice: one value recorded in spec files, changed only with evidence.
- D-14: Unit/API tests use a dependency-free harness (tests/TestHarness.hpp), not GoogleTest, to keep the dependency count minimal.
Appendix A. Research log
| Date | Topic | Doc |
|---|---|---|
| 29-11-2026 | SDL3 + aiohttpcpp feasibility, emoji strike scaling | research/sdl3-aiohttpcpp-feasibility.md |