Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FileSystemObserver explainer #163

Merged
merged 5 commits into from
Jun 28, 2024

Conversation

dslee414
Copy link
Collaborator

  • Updates FileSystemChangeType names from created/deleted/unsupported to appeared/disappeared/unknown:
    • When a file or directory has been moved into (or out of) the watched scope, the file/dir is to be reported as "created" or "deleted" with respect to the scope; however, this naming may be confusing as it is not really newly created file/dir (or deleted). Therefore, new names "appeared" and "disappeared" are suggested instead.
    • "unsupported" is renamed to "unknown" to indicate a general use case where a type is not known or not to be specified to the site for various reasons.
  • Change the data type of FileSystemChangeRecord.relativePathMovedFrom
    • Providing a FileSystemHandle to a non-existing file would not make much sense, but it would be still useful for sites to know where a file/dir has been moved from. It should return an array of path components instead (similar to relativePathComponents).
  • Update stakeholder signal

dslee414 added 3 commits June 25, 2024 17:33
- Rename some of FileSystemChangeType
- Add Gecko position
Update the explanation for unknown change type
Remove trailing dot
@dslee414 dslee414 requested a review from a-sully June 27, 2024 14:41
@@ -374,7 +374,7 @@ await observer.observe(directoryHandle, { recursive: true });
// corresponding to `directoryHandle`, then `touch file.txt`)
```

User agents may also use the `"unsupported"` `FileSystemChangeType` to explicitly indicate that change types are not supported.
User agents may also use the `"unknown"` `FileSystemChangeType` to indicate that a change has occurred but the type of change is unknown or is not to be specified to the site. This could mean that the change type does not belong to any other values defined in `FileSystemChangeType` due to cross-platform differences, or a change has occurred while the site was not fully active (i.e. site in back/forward cache becomes fully active again).
Copy link
Contributor

@nathanmemmott nathanmemmott Jun 27, 2024

Choose a reason for hiding this comment

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

I really don't think you should say it could be a change type that doesn't belong to any other values. Currently unknown is being used to say it is "unknown" if zero or more events have occurred, so that the developer will trigger a poll.

Sending out "unknown" for OS events that are specific to some platform would be a confusing signal to developers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rephrased this section into a new section about interactions with BFCache, as it is not related to cross-platform differences.

Explain the interactions with Back/forward Cache
case 'unsupported':
// Change types may not be supported on all platforms.
case 'unknown':
// Change type is not known.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be updated to zero or more changes may have been missed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can't be zero, can it? In any case, updated this comment to indicate the possibility of multiple events

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it can. On Windows, if the scope of the OS watch is larger than the observation's scope, then it can buffer overflow for file events outside the observation's scope. But we can't know that, and have to assume that there could have been events in the observation's scope, so we'll have to send an unknown. There could be a similar scenarios on Mac.

Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW this is just an explainer (not a spec) so I don't think it's necessary to enumerate all the possible scenarios the implementation may choose to use this change type. This document already has several hedges about how changes are "best-effort" etc., so this seems fine to me ¯\(ツ)

Update the comment for unknown change type
@a-sully
Copy link
Collaborator

a-sully commented Jun 28, 2024

Please ensure to follow the guidelines at https://github.com/whatwg/meta/blob/main/COMMITTING.md when you submit this PR. Thanks!

@dslee414 dslee414 merged commit db5f3ba into whatwg:main Jun 28, 2024
2 checks passed
@annevk
Copy link
Member

annevk commented Jun 29, 2024

It seems the guidelines were not followed. :-( This should have been a "Meta: " change as it doesn't change the standard. The commit body also repeats the commit title and the commit title contains a redundant reference to the PR...

@dslee414
Copy link
Collaborator Author

dslee414 commented Jul 1, 2024

Apologies! I misunderstood what "Meta: " prefix is for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants