shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
1.97k stars 118 forks source link

fix: extremely low link percentage when deleting Flutter code #1870

Closed felangel closed 4 days ago

felangel commented 1 month ago
  1. Clone and release on iOS using the Flutter & Friends app
  2. Replace the contents of main.dart with the following:
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
  1. Create a patch

Expected

A reasonable link percentage given we've mainly deleted code.

Actual

A really low link percentage:

πŸ“± App: flutter_and_friends (34a794b6-db2a-489c-9a47-405ae4c0bb44)
πŸ“¦ Release Version: 0.0.0+1
πŸ•ΉοΈ  Platform: ios [aarch64 (1016.76 KB)]
🟒 Track: Production
πŸ”— Running 4.7% on CPU
eseidel commented 1 month ago

I think the interesting question is what things in the new app can't it link.

felangel commented 1 month ago

As discussed, this is probably an extreme case of #1825

eseidel commented 1 month ago

Yeah, since the class id tables (assuming that's a thing?) wont' look at all alike, where as when you add/remove a single class only the indices after that classid would differ.

ismail-mufin commented 1 month ago

We added new package that does not include any native code changes, but after the patch the link percentage is quite unsuccessful.

πŸ“± App: ... (prod) (5be7858a-e211-44f2-8120-5d21ce6bf5eb)
🍧 Flavor: prod
πŸ“¦ Release Version: 1.6.3+94
πŸ•ΉοΈ  Platform: ios [aarch64 (3.81 MB)]
🟒 Track: Production
πŸ”— Running 4.6% on CPU

Maybe it can help, the package we added: https://pub.dev/packages/crop_your_image

ismail-mufin commented 1 month ago

Considering that we created a new .dart file to use the package and wrote class in it, I think this is still related to #1825

eseidel commented 4 days ago

I believe this is mostly done and we can track the remaining work in https://github.com/shorebirdtech/shorebird/issues/1892.