v0.8.1 1f54f61

output_state.go RawHistoryFolder

1package client
2
3import (
4	"github.com/bnema/vev/internal/ports"
5	"github.com/bnema/vev/internal/protocol"
6)
7
8// outputApplyState is the client-side dependency chain for one attachment.
9// Cells and captured semantic context are admitted together and committed only
10// after the corresponding terminal transaction succeeds.
11type outputApplyState struct {
12	epoch        uint64
13	state        uint64
14	viewRevision uint64
15	initialized  bool
16	context      protocol.ViewContext
17}
18
19func (s outputApplyState) next(output protocol.Output) (outputApplyState, bool) {
20	if output.Epoch == 0 {
21		return outputApplyState{}, false
22	}
23	// Ordered side effects cross replay reset gates, but cannot advance or
24	// overwrite committed state. Handoff cleanup must not invent a destination.
25	if output.New == 0 {
26		if output.Base != 0 || output.Full || output.Context != nil {
27			return outputApplyState{}, false
28		}
29		return s, true
30	}
31	if output.Context == nil || output.Context.Validate() != nil || output.Context.Publication <= s.context.Publication {
32		return outputApplyState{}, false
33	}
34	if !s.initialized {
35		if output.Base != 0 || !output.Full {
36			return outputApplyState{}, false
37		}
38	} else {
39		if output.Epoch < s.epoch {
40			return outputApplyState{}, false
41		}
42		if output.Epoch == s.epoch {
43			if output.ViewRevision != s.viewRevision || output.Context.Route.Target.LifecycleID != s.context.Route.Target.LifecycleID {
44				return outputApplyState{}, false
45			}
46			if output.Full || output.Base != s.state || output.New != output.Base+1 {
47				return outputApplyState{}, false
48			}
49		} else if !output.Full || output.Base != 0 {
50			return outputApplyState{}, false
51		}
52	}
53	return outputApplyState{
54		epoch: output.Epoch, state: output.New, viewRevision: output.ViewRevision,
55		initialized: true, context: *output.Context,
56	}, true
57}
58
59// nextView returns accepted and reset-needed separately: old updates are
60// harmless, while missing/future dependencies use the existing coalesced reset
61// request rather than retaining an unbounded metadata reorder queue.
62func (s outputApplyState) nextView(update protocol.UIViewUpdate) (next outputApplyState, accepted, reset bool) {
63	if update.Context.Validate() != nil || update.Epoch == 0 || update.State == 0 || !s.initialized {
64		return s, false, true
65	}
66	if update.Epoch < s.epoch || update.Epoch == s.epoch && update.State < s.state || update.Context.Publication <= s.context.Publication {
67		return s, false, false
68	}
69	if update.Epoch != s.epoch || update.State != s.state || update.Context.Route.Target.LifecycleID != s.context.Route.Target.LifecycleID {
70		return s, false, true
71	}
72	s.context = update.Context
73	return s, true, false
74}
75
76// uiContext composes one publication context from the captured identity and a
77// presentation. It applies the published-context shape rule: only Attached
78// carries the session route, the focus, and the committed output boundary;
79// Picker and Connecting carry the handle and their status with every session
80// field zeroed, so an unattached capture can never present session metadata.
81func (s outputApplyState) uiContext(identity ports.UIContext, status ports.UIPresentationStatus) ports.UIContext {
82	if status != ports.UIStatusAttached {
83		return ports.UIContext{AttachmentHandle: identity.AttachmentHandle, Status: status}
84	}
85	return ports.UIContext{
86		AttachmentHandle: identity.AttachmentHandle, Generation: identity.Generation,
87		Route: s.context.Route, TabID: s.context.TabID, FocusedPaneID: s.context.FocusedPaneID,
88		OutputEpoch: s.epoch, OutputState: s.state, ViewRevision: s.viewRevision,
89		ViewPublication: s.context.Publication, Status: status,
90	}
91}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close