Skip to content

Latest commit

 

History

History
112 lines (88 loc) · 9.88 KB

13-phases.md

File metadata and controls

112 lines (88 loc) · 9.88 KB

13. Phases, branches and PRs

How the work is cut up from here to 0.1. One phase → one branch → one PR. Living document: a phase's row changes when it opens and when it merges.

Why phases and not a backlog. Every phase below is chosen so that the repository is runnable and demonstrable at its end, and so that the next phase is cheaper because of it. That is the same rule docs/11 §11.5 used, and it is the reason the renderer contract has survived four toolkits without changing.

13.1 The rules

  1. One phase, one branch, one PR. Branch name phase/<n>-<slug>, cut from main. Never commit to main directly; the user merges the PR.
  2. A phase is done when its exit criterion is a measured number, recorded in the PR description and in docs/12. "Works" fails the phase — the same rule phase 0's spikes used, and the reason phase 0's findings are trustworthy.
  3. Apple work is raised as a GitHub issue, never attempted on Linux. A phase may depend on an Apple issue; it may not contain one. Phases are sized so that a blocked Apple issue never blocks the whole phase.
  4. A widget is done on every renderer that exists, or it is not done. Adding a WidgetKind breaks every renderer's exhaustive match under -Werror, which is the design working: it makes falling behind impossible to do quietly.
  5. docs/12 is updated in the same PR as the code. A status doc updated afterwards is a status doc that is wrong for a while.

13.2 The phases

Phase Branch Scope Exit criterion (a number) Status
0 — Feasibility: nine spikes, four renderers, reconciliation, navigation, ZIO bridge GO gate S1 ∧ S2 ∧ S3 done 2026-09-19
1 phase/1-shim-generator One ABI description; generate the C header, the Scala externs and Swift signature scaffolding; check all four hand-written copies agree Hand-maintained declarations per function drop from 4 to 1; the generated header and externs declare exactly what the checked-in ones do; the consistency check runs on a machine with no Xcode adopted 2026-09-29 (#3): header and Scala externs are generated and checked byte-for-byte; the two Swift signatures per function stay hand-written and checked, so hand-maintained declarations went 4 → 3, all checked
2 phase/2-widget-breadth Slice 1: Toggle, Spacer, ProgressBar, ActivityIndicator. Slice 2: Slider, SecureField. Radio and Stepper were in this phase and were reclassified, not built — neither is a cross-platform widget (docs/12 §12.2a). IconButton and Link need an icon system and URL opening 15 of 32 on all four renderers, each with a unit test and a self-test check on every host; Apple landed in #4. Measured on both toolkits: progress bar 0.750, slider 7.0 of 0–11 both slices done
3 phase/3-* The ones that are platform chrome rather than tree nodes. Done: Alert, Sheet and the presented contract they forced; toolbar actions, which AppRoot had promised and no host honoured; Menu, as a prop. TabView was built later as a §12.2a exception (#61, #70): GTK and Android, Apple in #69 17 of 32 reachable, 15 on every renderer. GTK 57 self-test checks, Android 48, both green; Apple owes Alert, Sheet and ContextMenu (#18, #19) done (TabView in #70)
4 phase/4-* Native navigation containers and per-subtree Provide theming — the two places the framework still asks an app to accept something non-native met. Every renderer consumes AppRoot.pages, so the stack stays alive rather than being rebuilt on a pop: AdwNavigationView (#32), UINavigationController / macOS sidebar (#29), FrameLayout + android.transition.Slide. Back gesture and title bar are the platform's own on all four; the back gesture reports to Nav rather than diverging from it, checked on GTK and Android. Provide scopes a theme to a subtree with 5 tests (#23). Self-tests: GTK 66, Android 48, both green. Navigation is not a widget kind — §12.2a rejected it, three toolkits out of four do not model it as a view you place done
5 phase/5-release Publish dev.thicket artefacts, a getting-started, semver policy A developer who has not seen this repo builds and runs a new app on Android and one desktop in ≤ 30 minutes, measured by watching them partly done. Nine artefacts publish with complete POMs; early-semver declared; docs/14-releasing.md covers versions and compatibility. A new app outside the repo resolves, links and runs on GTK — checked by bin/verify-getting-started.sh, not asserted. Since then: sbt-thicket publishes the link settings (#40), the Apple jar carries the Swift shim (#41), v0.1.0 is tagged, and the group id is net.leibman (2026-10-20). 0.2.0 is on Maven Central (2026-11-09, 69 modules; bin/release.sh, docs/14 §14.5), and a template outside the repo builds and runs from Central alone on GTK, macOS and the iOS simulator (2026-11-12). Android: templates/hello-thicket-android and ThicketAndroidPlugin build an APK outside the repo that installs, runs and takes a tap on the emulator (2026-11-12, #164; not yet in a release). Still open: iOS device builds (#161); and the ≤30-minute measurement, which needs a person
6 phase/6-real-app The falsification test: the meal-planner client against its Caliban server Runs on Android, iOS and one desktop; startup and size still inside N-01/N-03

Out of scope for 0.1, each with nothing above it that depends on it: Windows (Win32/WinUI), Yoga / FrameBased layout, the Scala.js dev canvas, the thicket CLI, the inspector, and the cats-effect bridge.

13.3 Why phase 1 is first — and what measuring it changed

It is not the most visible work, and it is still first. But the first thing phase 1 did was disprove its own original framing, which is worth recording rather than quietly editing.

The plan was "generate the shim". The number behind that was 11.0 non-comment Swift lines per exported function across two shims, projecting ~5 200 lines of duplicated Swift for the full catalogue. Measured properly, per shim:

AppKit UIKit
Exported functions 34 35
Signature lines — generatable 80 82
Body lines — hand-written 211 212

Of the 34 functions in both shims, 7 have byte-identical bodies, 13 differ only in a type or property name, and 14 are genuinely different code. The bodies are real AppKit and UIKit logic: NSImageView.imageScaling is not UIView.contentMode, placeholderString is not placeholder, AppKit's coordinate system is flipped. A generator that emitted bodies would be emitting guesses, and the projected 5 200-line saving was never available.

What is available, and is worth more. Every boundary function is declared four times — C header, two @_cdecl signatures, one Scala extern. At 34 functions that is 136 declarations kept in step by hand, with nothing checking them: Swift compiles against its own signature, Scala Native against its own extern, and the linker matches them by name only. An Int32 against an Int64 links cleanly and reads a garbage register at runtime, in a callback, on a phone.

So phase 1's real deliverable is a described ABI plus the check that the four copies agree — and that check runs on a machine with no Xcode, which is exactly where the mistake gets made. Generation of the declaration layer falls out of the description for free.

Phase 1 is still first: it is what stops the remaining 23 widgets multiplying 4 undetected declarations each, and the catalogue is only 9 of 32.

13.4 Open Apple issues

Tracked on GitHub, done on the macOS laptop, referenced by the phase that needs them. The table below is the phase-1/2 history; what is open now, as of 2026-10-20:

Issue What
#66 Icon, IconButton and AccessibleLabel on AppKit and UIKit
#69 TabView and Tab on AppKit and UIKit
#72 An unbuilt kind crashes the whole macOS CI run
#73–#79 The Apple halves of the 2026-10-20 review: native safety, unbuilt kinds (D9), taps/labels/RTL, safe area and scroll, selection, virtual rows, Swift safety

The phase-1/2 issues:

Issue What Blocks
#1 A virtualising container, so LazyColumn stops mounting every row — done; 40 rows on AppKit, 34 on UIKit, of 10 000 phase 6 (a real app has real lists)
#2 ContentFit.Cover distorts instead of cropping on AppKit — done; UIKit confirmed already correct phase 2
#3 Generate shim, header and bindings from one description phase 1
#4 The six phase-2 widgets — done; self-test 43/43 macOS, 42/42 iOS. The sui_ prefix the rename left alone is still there phase 2

Renumbered when the project moved to GitHub. The horizontal Scroll issue, ContentFit.Cover and virtualised rows are done and closed. Forgejo issue numbers still appear inside the issue bodies and in older commit messages — they are historical.

13.5 On the estimates

There are deliberately no dates here. docs/08 budgeted phase 0 at 6–8 weeks; it took roughly one working day across two machines, and its own recalibration note says the milestone figures were produced by the same reasoning and should be treated as equally inflated.

The phases are ordered and sized relative to one another. They are not scheduled. Steer by working software and re-estimate from the actual slope.