Skip to content

feat: move dashboard's dev_cocoon to integration tests#4961

Merged
jtmcdole merged 4 commits intomainfrom
defang
Feb 27, 2026
Merged

feat: move dashboard's dev_cocoon to integration tests#4961
jtmcdole merged 4 commits intomainfrom
defang

Conversation

@jtmcdole
Copy link
Member

Updates the dashboard code to use a "real" server in the browser. Currently, DevelopmentCocoonService in dashboard/lib/service/dev_cocoon.dart generates fake data manually. While effective, it doesn't test end-to-end with the backend logic or API surface, leading to a false sense of security (and having caused multiple 'push to prod to fix'). By using IntegrationServer, we can run the real app_dart logic against in-memory fakes (Firestore, BigQuery, etc.), ensuring the frontend is tested against the same logic the production server uses.

  1. defangs app_dart/lib/** by removing app_engine and dart:io.
    • gae_server.dart passes in the needed "dart:io" handlers
    • server.dart now handles an abstract Request, which can be real (app engine, local server) or fake (tests / dashboard local).
    • "dynamic config" no longer looks up the config.yaml from the read only filesystem and instead we build dynamic config with build hooks - generated_config.dart.
  2. Removes dev_cocoon and its hardcoded mockery (partial reason for the image diffs)
  3. Adds IntegrationServerAdapter (which is an AppEngineCocoonService) to wrap and make fake http calls to the IntegrationServer.

@jtmcdole jtmcdole requested a review from Piinks as a code owner February 27, 2026 00:09
@jtmcdole jtmcdole requested review from ievdokdm and removed request for Piinks February 27, 2026 00:09
@jtmcdole
Copy link
Member Author

@gemini-cli /review

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only file that uses dart:io in the app_dart/lib/src folder since its shared between gae_server and local_server.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the "what's missing from non-dart:io" types.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is the big "load real data into firestore" chunk, which tries to match dev_cocoon.dart. However, dev_ccoon.dart was very loose with its data. Since we're using a real backend, we have to have commits from flutter and cocoon. This changes the UI and so the screenshots are to be updated.

@jtmcdole
Copy link
Member Author

I'm going to move the gemini change out and see if that helps run review.

Updates the dashboard code to use a "real" server in the browser. Currently, `DevelopmentCocoonService` in `dashboard/lib/service/dev_cocoon.dart` generates fake data manually. While effective, it doesn't test end-to-end with the backend logic or API surface, leading to a false sense of security (and having caused multiple 'push to prod to fix'). By using `IntegrationServer`, we can run the real `app_dart` logic against in-memory fakes (Firestore, BigQuery, etc.), ensuring the frontend is tested against the same logic the production server uses.

1. defangs app_dart/lib/** by removing app_engine and dart:io.
    * gae_server.dart passes in the needed "dart:io" handlers
    * server.dart now handles an abstract Request, which can be real (app engine, local server) or fake (tests / dashboard local).
    * "dynamic config" no longer looks up the config.yaml from the read only filesystem and instead we build dynamic config with build hooks - `generated_config.dart`.
    * dynamic_config with compield defaults means some tests need to
      ensure the flags they are testing are set correctly.
2. Removes dev_cocoon and its hardcoded mockery (partial reason for the image diffs)
3. Adds `IntegrationServerAdapter` (which is an `AppEngineCocoonService`) to wrap and make fake http calls to the `IntegrationServer`.
@jtmcdole
Copy link
Member Author

Fixed failing tests in app_dart: dynamic_config being defaulted to compile-time settings means some tests were assuming the flags were in a different state - fixed.

@jtmcdole
Copy link
Member Author

@gemini-cli /review

/// A collection of HTTP status codes.
///
/// This is used instead of 'dart:io' to keep the library platform-neutral.
class HttpStatus {
Copy link
Contributor

@ievdokdm ievdokdm Feb 27, 2026

Choose a reason for hiding this comment

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

can we use https://api.flutter.dev/flutter/dart-html/HttpStatus-class.html or something similar instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

This core library is deprecated, and scheduled for removal in late 2025. It has been replaced by package:web. The migration guide has more details.

package:web looks like it only supports web: https://pub.dev/packages/web -- via imports of import 'dart:js_interop';

@kevmoo - is there a platform agnostic HttpStatus library?

Copy link
Contributor

Choose a reason for hiding this comment

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

Great question! Short answer, no. Although I wonder if we should add one to https://github.com/dart-lang/http/tree/master/pkgs/http

CC @brianquinlan

Copy link
Member Author

Choose a reason for hiding this comment

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

We should. Consty-data-only types should be platform agnostic :)

@jtmcdole jtmcdole requested a review from ievdokdm February 27, 2026 19:25
Copy link
Contributor

@ievdokdm ievdokdm left a comment

Choose a reason for hiding this comment

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

LGTM

@jtmcdole jtmcdole merged commit 8009533 into main Feb 27, 2026
56 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.

3 participants