Currently, for a node in PRIMARY state, lastApplied is set to each write's optime when each write commits, as long as the time being set moves forward. (It might not otherwise always move forward because writes can commit out of optime order.)
This method of setting lastApplied is problematic for consumers of this value, as it can be set ahead of writes that are still in-flight and have yet to commit. For one-voting-node replica sets, this can result in the majority point moving ahead of uncommitted, in-flight writes.
Instead, we can use WiredTiger's all_committed value to set lastApplied. After each write commits, we can query the current all_committed value and set lastApplied to that.
The all_committed value is the greatest (latest) timestamp value with no existing in-flight writes with lower (earlier) timestamps. This value has been used in the past to implement oplog visibility, preventing oplog readers from reading past "holes" in the oplog left by uncommitted, in-flight writes.