Archive for November 28, 2023

Tuesday, November 28, 2023

Composable Architecture and Swift Observation

Brandon Williams and Stephen Celis (Mastodon):

But now with the Observation framework you get to forget about almost all of that complexity, and just build your features in the most naive way, with basically zero adornments, and it just works. And it works in the most efficient way possible, where only the data accessed in the view is observed by the view.

That was pretty revolutionary for SwiftUI, but we think it can be just as revolutionary for the Composable Architecture. The Observation framework allows us to get rid of many concepts that were needed prior to the framework, most importantly the ViewStore concept, but also even things like IfLetStore, ForEachStore, SwitchStore, and a whole plethora of view modifiers for showing sheets, fullscreen covers, popovers, and more.

JP Simard:

What the @pointfreeco folks have managed to pull off here is pretty amazing.

They’ve re-implemented the Swift 5.9 Observable machinery, backported it all the way to iOS 13, and are leveraging that to supercharge the composable architecture.

Previously:

Swift Proposal: Typed Throws

SE-0413:

Swift is known for being explicit about semantics and using types to communicate constraints that apply to specific APIs. From that perspective, the fact that all thrown errors are of type any Error feels like an outlier. However, it reflects the view laid out in the original error handling rationale that errors are generally propagated and rendered, but rarely handled exhaustively, and are prone to changing over time in a way that types are not.

[…]

The loss of information between types like Result and Task and the language’s error-handling system provides partial motivation for the introduction of typed throws, and is discussed further below.

Typed throws also provides benefits in places where clients need to exhaustively handle errors. For this to make sense, the set of potential failure conditions must be relatively fixed, either because they come from the same module or package as the clients, or because they come from a library that is effectively standalone and unlikely to evolve to (e.g.) pass through an error from another lower-level library. Typed throws also provides benefits in generic code that will propagate errors from its arguments, but never generate errors itself, as a more flexible alternative to the existing rethrows. Finally, typed throws also open up the potential for more efficient code, because they avoid the overhead associated with existential types (any Error).

Even with the introduction of typed throws into Swift, the existing (untyped) throws remains the better default error-handling mechanism for most Swift code.

Rob Napier (2016):

I was an early proponent of typed errors in Swift. This is how the Swift team convinced me I was wrong.

Strongly typed errors are fragile in ways that can lead to poor API evolution. If the API promises to throw only one of precisely 3 errors, then when a fourth error condition arises in a later release, I have a choice: I bury it somehow in the existing 3, or I force every caller to rewrite their error handling code to deal with it. Since it wasn’t in the original 3, it probably isn’t a very common condition, and this puts strong pressure on APIs not to expand their list of errors, particularly once a framework has extensive use over a long time (think: Foundation).

Of course with open enums, we can avoid that, but an open enum achieves none of the goals of a strongly typed error. It is basically an untyped error again because you still need a “default.”

[…]

Last of all, for strongly typed errors to be of much use, Foundation would need to throw them since it is the largest producer of errors in the system.

Previously:

Update (2024-02-23): Donny Wals:

At the time of writing this post SE-0413 has been accepted but not yet implemented.

[…]

Personally, I think typed throws are a nice feature but that we won’t see them used that much.

The fact that we can only throw a single type combined with having to try calls in a do block erasing our error back to any Error means that we’ll still be doing a bunch of switching and inspecting to see which error was thrown exactly, and how we should handle that thrown error.

Apple Cash Escheat Heads-up

Dana E. Stevens:

I had a small balance in Apple Cash and had not made any transactions in a bit over 3 years. I received a text message notice of a “Balance Adjustment” resulting in a $0 balance in Apple Cash. Called Apple Support. They said the balance had been escheated to the state I live in. Approximately 6 weeks later the balance showed up on the state website for unclaimed property. […] I see I’m not the only one to have this experience.

I didn’t realize that financial-but-non-bank accounts like Apple Cash could be counted as abandoned/unclaimed simply because you haven’t used them in a while. You’d think Apple could send a notification before removing the funds.

See also: More than you want to know about gift cards.

Previously:

Google Drive Loses Months of Customer Data

Yeonjoong (via Hacker News):

My Google Drive files suddenly disappeared. The Drive literally went back to condition in May 2023. data from May until today disappeared, and the folder structure went back to status in May.

Google Drive activity doesn’t show any changes (only show activity that was in May) No files was deleted manually, so no files in Trash.

[…]

I followed recovery process that Google support team ask me to (South Korea team). They put a recovery program and failed.

Richard Speed (via Hacker News):

Google Drive users are reporting files mysteriously disappearing from the service, with some netizens on the goliath's support forums claiming six or more months of work have unceremoniously vanished.

There is little information regarding what has happened; some users reported that synchronization had simply stopped working, so the cloud storage was out of date. Others could get some of their information back by fiddling with cached files, although the limited advice on offer for the affected was to leave things well alone until engineers come up with a solution.

A message purporting to be from Google support also advised not to make changes to the root/data folder while engineers investigate the issue. Some users speculated that it might be related to accounts being spontaneously dropped.

Google is not officially communicating about this.

Previously:

Update (2023-12-06): Bill Toulas:

A notable aspect of the situation is that Google’s support forums are backed by volunteers with limited insight or understanding of the cloud service, so the lack of effective assistance in critical problems like this makes it all the worse.

BleepingComputer has contacted Google for an update on the status of the internal investigation and whether the lost files are recoverable or irreversibly lost, but we have not received a response by publication time.

Update (2023-12-08): Ron Amadeo (Hacker News):

Google acknowledged the issue on November 27, and a week later, it posted what it called a fix.

It doesn’t feel like Google is describing this issue correctly; the company still calls it a “syncing issue” with the Drive desktop app versions 84.0.0.0 through 84.0.4.0. Syncing problems would only mean files don’t make it to or from the cloud, and that doesn’t explain why people are completely losing files. In the most popular issue thread on the Google Drive Community forums, several users describe spreadsheets and documents going missing, which all would have been created and saved in the web interface, not the desktop app, and it’s hard to see how the desktop app could affect that. Many users peg “May 2023" as the time documents stopped saving. Some say they’ve never used the desktop app.

[…]

Google locked the issue thread on the Drive Community Forums at 170 replies before it was clear the problem was solved. It’s also marking any additional threads as “duplicates” and locking them. Taking away the space to diagnose the issue and communicate fixes adds to the sense that Google is more interested in PR damage control than helping users. It also doesn’t allow people to reply to the “solution” post, so it’s hard to evaluate the fix’s efficacy since Google shut down the easiest avenues for user feedback and support.

Of the few replies before Google locked the thread, most suggested that Google’s fix did not work.

Nick Heer:

I think Google’s dependence on support forums is a huge part of this problem. The company has notoriously poor service. Only people who pay for a support plan are able to get help from a real person, and not by phone or even live chat. For most people, Google’s primary suggestion is to post on its forum. Google even frames it as an instruction to “contact us via our forum” — but you are not really contacting Google, are you? You are contacting some person named Alex who lives in Springfield and has no idea what is going on, either, but says you should try restarting your computer.

Sorry, but that will not do — not for precious files, and especially not for one of the richest corporations anywhere. Google is supposed to be good at internet services — and, historically, it has been — but it is not good at customer service. Google’s abdication in this case should be a reminder that even near-perfect reliability is irrelevant the moment there is a problem as serious as this, and when that happens, a real person being helpful will matter more than anything else. We need to have higher standards. Think about it this way: if the first couple of people to see this problem could have talked to a real person at Google, that person could have escalated this and flagged it as the big problem it is. Instead, a forum thread lingered for a week until someone at Google bothered to check on it.

Previously:

YouTube’s Ad Blocker Crackdown

Paresh Dave (Hacker News, Reddit):

In early October, the people who make ad blocking tools convened in Amsterdam for their industry’s annual conference. One session was a welcome pitch from Google product leaders about tweaks made to address fears that a security update to the company’s Chrome browser could hamper ad zapping. Google, which draws nearly 80 percent of its revenue from ads, even cosponsored the event, at an airy venue along the water.

Emma Roth:

YouTube is broadening its efforts to crack down on ad blockers. The platform has “launched a global effort” to encourage users to allow ads or try YouTube Premium, YouTube communications manager Christopher Lawton says in a statement provided to The Verge.

If you run into YouTube’s block, you may see a notice that says “video playback is blocked unless YouTube is allowlisted or the ad blocker is disabled.” It also includes a prompt to allow ads or try YouTube Premium. You may get prompts about YouTube’s stance on ad blockers but still be able to watch a video, though, for one Verge staffer, YouTube now fully blocks them nearly every time.

Ryan McNeal (via Hacker News):

YouTube recently expanded its ad-blocking efforts, transitioning from just a small experiment to a global launch. The move appears to have had some success, as users are uninstalling the software in record numbers. But you can also argue it has had the opposite effect, as even higher numbers of users are turning to better ad blockers.

[…]

Some people are even turning to solutions like Newpipe, a YouTube-like website that’s capable of running videos from the platform without ads.

[…]

If you’re looking alternatives, extensions like uBlock Origin still work when used on Firefox. Adblock Plus has also offered some suggestions on how to get past the anti-ad block wall. There’s also the option of biting the bullet and paying for YouTube Premium.

uBlock Origin (2019):

It will not possible for uBlock Origin to work with the upcoming Safari 13 / macOS Catalina release.

Nick Heer:

I am not signed into YouTube and I, too, have seen the anti-adblock campaign.

YouTube is in a unique position — one I imagine is enviable for pretty much any other ad-supported product. It is the web’s video host — well, the web’s general purpose video host, I suppose — and has no equal, so it can do basically anything it wants. It has spent years ratcheting up the ad load. It is now typical that any video you watch will be preceded by two unskippable ads, with more ads often appearing every few minutes.

Alec Watson:

Seemingly few people know (or understand completely) that YT Premium is a good deal for all parties involved - it kills ads, creators get a cut of the membership, and (in my experience anyway) it neutralizes many of the platform’s weird tendencies because serving relevant ads to the viewer is no longer a concern.

I would advocate for it much more strongly (and I say 100% truthfully that Premium views pay me more than ad-supported views do) except YT continues to lump YT music into it.

Jay Bonggolto (via Hacker News):

Several Reddit posts have highlighted a five-second delay when loading YouTube videos on Firefox, which disappeared when the user agent was switched to Chrome, revealing a potential browser-specific issue.

Investigation by users suggests that the delay isn’t a Firefox bug but an intentional addition in the JavaScript code of YouTube’s desktop client.

Discussions speculate that the added delay might be linked to ad display, possibly as a workaround for users employing ad blockers.

Aamir Siddiqui (via Hacker News):

Here is the complete statement sent to us by a YouTube spokesperson:

To support a diverse ecosystem of creators globally and allow billions to access their favorite content on YouTube, we’ve launched an effort to urge viewers with ad blockers enabled to allow ads on YouTube or try YouTube Premium for an ad free experience. Users who have ad blockers installed may experience suboptimal viewing, regardless of the browser they are using.

Google’s statement squarely marks the delay as an intentional change targeted toward users who continue to use ad blockers.

hackhive-io (Hacker News):

YouTube is now blocking Ad Blockers - So I just make ads run 16x faster

See also: Hacker News, Reddit.

Pieter Arntz (Hacker News):

Google has announced it will shut down Manifest V2 in June 2024 and move on to Manifest V3, the latest version of its Chrome extension specification that has faced criticism for putting limits on ad blockers. Roughly said, Manifest V2 and V3 are the rules that browser extension developers have to follow if they want their extensions to get accepted into the Google Play Store.

Previously:

Update (2023-12-06): Thomas Claburn:

Today those Chrome extensions by and large adhere to an API specification known as Manifest V2: that’s what they use to, for example, inspect pages for stuff to filter out. Googlers feel that API puts too much power in the hands of extension developers: someone could make an add-on that offers to do things like block annoying ads on a page, and then later use those powers to steal or manipulate sensitive data on your internet profiles.

The Chocolate Factory’s answer to this was to develop Manifest V3, which has been supported by Chrome for a while now: it’s an alterative way for extensions to drill into pages and filter out bad content, for instance. Google says V3 is safer - giving users more protection from wayward extensions - but some developers argue the switch from V2 to V3 cripples their extensions and makes them less effective. That would mean less effective ad blocking.

See also: Slashdot and Does uBlock Origin (uBO) bypass the latest YouTube anti-adblock script? (via Hacker News).

Update (2023-12-08): Nick Heer:

If you watch a lot of YouTube, Premium looks like a great choice, though I find it requires a reorientation of your headspace: think of YouTube Premium as “YouTube”, and YouTube sans Premium as the “free trial” or “lite” version. That framing also puts Google’s strategy for YouTube into a more understandable context, I think. Google has increased the per-video ad load and it delivers fewer skippable ads, and it is becoming more strict about ad blocking in the same way many software companies limit free trials.

But I can understand why people block ads, too, because the quality of ads I get on YouTube sucks. Part of this is my fault because I am a more privacy-conscious user and, so, take steps to prevent specific targeting. That means I get an awful lot of ads with deep-faked celebrities hawking sketchy investments, garbage supplements, gambling, diet scammers, and other bottom-of-the-barrel crap. I understand my restrictions reduce my likelihood of seeing things which interest me. On the other hand, why is Google accepting ads like these in the first place?

Colin Devroe:

I do not intentionally block ads. I do, however, intentionally block ad tracking. And I think this distinction is important.