Integrate history prefixes into load handoffs

This commit is contained in:
2026-10-26 17:15:30 +00:00
parent 738c8a9cc7
commit 408dd13c24
7 changed files with 200 additions and 20 deletions

View File

@@ -13,6 +13,16 @@ type Metadata struct {
historyModel *historyModel
}
func (m Metadata) currentHistoryModel() *historyModel {
if m.historyModel != nil {
return m.historyModel
}
if m.historyBuilder != nil {
return m.historyBuilder.model
}
return nil
}
// Lookup returns information for an effective path. Unknown and invalid paths
// return false.
func (m Metadata) Lookup(path Path) (FieldInfo, bool) {
@@ -152,6 +162,21 @@ func finalizeMetadataPaths(m *Metadata, final *document.Node, applications []his
func finalizeMetadataPathsWithResolution(m *Metadata, final *document.Node, applications []historyApplication, snapshots []resolutionSnapshot, earlier ...*document.Node) {
finalizeEffectiveMetadataPaths(m, final)
builder := m.historyBuilder
if builder != nil && builder.prefixReady {
if len(snapshots) != 0 && builder.model.resolutionPayload == nil {
if len(earlier) != 0 {
builder.setScratch(earlier[len(earlier)-1])
}
builder.observeResolutionEvidence(snapshots)
}
if builder.model.final != final {
builder.model.final = final
builder.registerDocumentRoot(final)
}
m.historyModel = builder.freeze()
m.historyBuilder = nil
return
}
if builder == nil {
builder = newHistoryBuilder()
}