cashapp/zipline

`FreshnessChecker` broke the ability to embed online applications

Opened this issue · 1 comments

The Redwood test+sample apps want this behavior for application loading:

  • Guest code is bundled into binaries at build time
  • Guest code is loaded from the network, if available
  • Network code always takes precedence over embedded code
  • Newer network code always takes precedence over cached network code

This worked prior to 1.7.0 with embedded code and using the built-in development server push Flow operator.

Now, with FreshnessChecker, we seem to only be able to toggle between two modes: the embedded application is considered fresh so the network is never checked, or nothing is fresh so the network is only used.

If a real application was relying on an offline-capable, first-run experience with an embedded copy, this behavior change means that functionality was broken.

It seems like the capability of the freshness checker needs expanded to differentiate the embedded code from the network code. Either with a different policy for the cutover between the two, or just with its own policy.

The EventListener also should probably propagate the source of the code (embedded, cache, or network) in its callbacks around code loading. This should make it possible to also monitor when embedded code has successfully loaded but network code has failed, or perhaps that requires additional callbacks.

Internally we agreed on the need for a stale-while-revalidate behavior that can be opted into.

I don't remember if we said anything else was needed.