feat(annotations): complete DSL — composite tests, See selectors, P0 bugfixes (v0.9.6)#109
Merged
Conversation
…ors, P0 bugfixes (v0.9.6)
Closes every gap identified in the v0.9.5 audit of flutter_probe_annotation
and flutter_probe_gen. Goes from ~70% coverage of the ProbeScript surface
to full parity, with comprehensive golden tests cross-validated against
the Go parser.
P0 correctness bugs (would silently break user tests at runtime):
* Mock path is now quoted in the emitted 'when the app calls ...' line.
Was unquoted, so the Go lexer split on '/' and the parser only kept
the first IDENT segment — Mock(path: '/api/products') silently became
/api. Now emits 'when the app calls GET "/api/products"' and the
full path round-trips.
* See suffixes (state + containing + matching) now compose additively
instead of overwriting. See('x', state: SeeState.enabled, containing:
'y') used to silently drop the state; now emits both.
P1 missing feature:
* @ProbeCompositeTest DSL — Device, OnDevice, Sync classes. Emitter
walks devices then body, rendering <alias>: groups and sync "label"
barriers. Round-trips through the Go parser's full composite test
machinery (parser.go:1433+).
P1 incoherent surface:
* Press and Pinch are now @deprecated — the Go parser has no case for
them, emitted text fell through to parseRecipeCall. Use GoBack() in
place of Press('back').
P2 under-modeled assertions:
* See.id(key) / See.selector(Selector) factories — assertions can now
target by ValueKey or any rich selector (Ordinal, Below/Above/
LeftOf/RightOf, InContainer, TypeSel). Same on DontSee. The Go
parser always supported this; the DSL just didn't expose it.
* WaitUntil.idAppears(key) / .idDisappears(key) — emits unquoted #key
so the Go parser's WaitSelector branch (parser.go:846) matches.
P3 robustness:
* Emitter no longer indexes hard-coded arrays by enum.index. Reads
the enum constant identifier via _name. Reordering Direction,
HttpMethod, or SeeState no longer silently corrupts output.
Comprehensive tests (the user's strictness ask):
* 6 new golden fixture pairs in probe_gen/test/fixtures/:
- mock_and_call (catches P0 #1 regression)
- see_states (catches P0 #2 regression + new selector forms)
- composite_chat (exercises every composite construct)
- wait_variants (every wait kind + id-based)
- examples_inline (data-driven Examples)
- kitchen_sink (one of every step + selector + control flow)
* Builder tests: 5 → 11 (one per golden + existing 5).
* Cross-language goldens: 4 → 10. Every Dart-emitted .probe round-
trips through internal/parser/parser.go via golden_integration_test.
Docs:
* New website page: website/src/content/docs/probescript/annotations.md
— full reference for the DSL with every step class, selector kind,
and composite syntax. Added to Starlight sidebar.
* docs/wiki/Annotations.md version refs bumped.
* README.md highlights composite tests in the annotation section.
* Per-package CHANGELOGs detail the changes.
Versions bumped to 0.9.6:
probe_agent, probe_annotation, probe_gen pubspec.yaml + CHANGELOG.md
vscode/package.json
docs/wiki/Home.md
website/src/content/docs/tools/mcp.md verify snippet
probe_gen depends on flutter_probe_annotation: ^0.9.6
Verification (all green before commit):
go test ./... 16/16 packages pass
staticcheck ./... zero issues
dart analyze (annot) no issues found
dart test (annot) 3/3 const tests pass
dart analyze (gen) no issues found
dart test (gen) 11/11 builder tests pass (5 existing + 6 new)
go test ...GoldenIntegration 10/10 Dart goldens parse cleanly
dart pub publish --dry-run both packages 0 errors
Astro build 37 pages generated successfully
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes every gap from the v0.9.5 audit of
flutter_probe_annotation+flutter_probe_gen. The DSL goes from ~70% coverage of the ProbeScript surface to full parity, with strict golden tests cross-validated by the Go parser.What's in
P0 — correctness bugs (silently broke user tests)
Mockpath now quoted inwhen the app calls …— was unquoted, soMock(path: '/api/products')silently became/api.Seesuffixes compose additively —state+containing+matchingcan coexist; was previously overwriting last-wins.P1 — major missing feature
@ProbeCompositeTestannotation plusDevice,OnDevice,Syncclasses. The multi-device feature shipped in v0.9.0 finally has a DSL surface.P1 — incoherent surface
PressandPinchare now@Deprecateduntil the Go parser supports them. UseGoBack()for the back gesture.P2 — under-modeled
See.id/See.selectorfactories (+ same onDontSee) — assertions can target byValueKeyor any rich selector.WaitUntil.idAppears/.idDisappears— emits unquoted#keyfor the parser's WaitSelector branch.P3 — robustness
_name) instead of indexing arrays by.index— reordering an enum no longer silently corrupts output.Strict testing (per the user's ask)
go test ./...staticcheck ./...dart analyzeprobe_annotationdart testprobe_annotationdart analyzeprobe_gendart testprobe_genTestGoldenIntegration_DartEmittedFilesdart pub publish --dry-run× 2npm run buildNew golden fixtures (test/fixtures/)
mock_and_callsee_statescomposite_chatwait_variantsexamples_inlinekitchen_sinkEvery fixture round-trips through
internal/parser/parser.govia the existingTestGoldenIntegration_DartEmittedFiles. If the Dart emitter regresses, the Go test fails the build.Docs
website/src/content/docs/probescript/annotations.md(will be at https://flutterprobe.dev/probescript/annotations/) — full reference with every step class, selector kind, and composite syntax. Added to Starlight sidebar.docs/wiki/Annotations.mdversion refs bumped.README.mdannotation section updated to mention composite tests.🤖 Generated with Claude Code