Skip to content

feat(annotations): complete DSL — composite tests, See selectors, P0 bugfixes (v0.9.6)#109

Merged
pbertsch merged 1 commit into
mainfrom
feat/dsl-completion
May 13, 2026
Merged

feat(annotations): complete DSL — composite tests, See selectors, P0 bugfixes (v0.9.6)#109
pbertsch merged 1 commit into
mainfrom
feat/dsl-completion

Conversation

@pbertsch
Copy link
Copy Markdown
Contributor

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)

  • Mock path now quoted in when the app calls … — was unquoted, so Mock(path: '/api/products') silently became /api.
  • See suffixes compose additivelystate + containing + matching can coexist; was previously overwriting last-wins.

P1 — major missing feature

  • @ProbeCompositeTest annotation plus Device, OnDevice, Sync classes. The multi-device feature shipped in v0.9.0 finally has a DSL surface.

P1 — incoherent surface

  • Press and Pinch are now @Deprecated until the Go parser supports them. Use GoBack() for the back gesture.

P2 — under-modeled

  • See.id / See.selector factories (+ same on DontSee) — assertions can target by ValueKey or any rich selector.
  • WaitUntil.idAppears / .idDisappears — emits unquoted #key for the parser's WaitSelector branch.

P3 — robustness

  • Emitter reads enum constant identifiers (_name) instead of indexing arrays by .index — reordering an enum no longer silently corrupts output.

Strict testing (per the user's ask)

Suite Result
go test ./... 16/16 packages pass
staticcheck ./... zero issues
dart analyze probe_annotation no issues
dart test probe_annotation 3/3 const tests pass
dart analyze probe_gen no issues
dart test probe_gen 11/11 builder tests pass (5 existing + 6 new)
Cross-language TestGoldenIntegration_DartEmittedFiles 10/10 Dart goldens parse cleanly through Go parser
dart pub publish --dry-run × 2 zero errors on both packages
Astro npm run build 37 pages built, new annotations page included

New golden fixtures (test/fixtures/)

Fixture What it exercises
mock_and_call Mock with body, Mock without body, CallHttp with/without body — catches P0 #1 regression
see_states every SeeState variant, combined state+containing, See.id, See.selector, DontSee.id — catches P0 #2 regression
composite_chat every composite construct: devices, OnDevice, Sync barriers, tags
wait_variants every WaitFor*/WaitUntil* including new id factories
examples_inline data-driven Examples with multi-column rows
kitchen_sink one of every step (31+ verbs), every selector kind (6), every control-flow construct

Every fixture round-trips through internal/parser/parser.go via the existing TestGoldenIntegration_DartEmittedFiles. If the Dart emitter regresses, the Go test fails the build.

Docs

  • New website page: 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.md version refs bumped.
  • README.md annotation section updated to mention composite tests.
  • Per-package CHANGELOGs detail the user-facing changes.

🤖 Generated with Claude Code

…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
@pbertsch pbertsch requested a review from a team as a code owner May 13, 2026 00:41
@pbertsch pbertsch merged commit 61f0a17 into main May 13, 2026
15 checks passed
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