Repository navigation
Description
What is true today
internal/tui3/framedisk_law_test.go walks everything app.View can reach and
fails on a call that reads a file, starts a process, globs a directory or
touches the network. It landed in #875 and it works — it caught two live reads
nobody knew about (.loadNoticeLedger, .readJobLogTail, both deleted) and it
catches all three of the defects that lane was opened for when they are planted
back.
But its walk makes a surface edge out of x.method() only where x is
spelled the same as the enclosing method's own receiver name
(surfaceGraph.callsIn). A package function that takes the surface as a
PARAMETER therefore severs the graph at its own door: the function's body is
walked, because a bare call is resolved to the package function of that name,
and then every a.… call inside it is read as "a method on some other value the
frame happens to hold" and dropped.
The reviewer of #875 traced a live one:
app.View → app.placeDraw → placeFrameWithBar(a, …) ⊘
a.composerRows → a.composerWhereLine → a.composerWhere
→ a.composerOpensAt → a.errandPlace → errandHomeDir → os.Getwd
os.Getwd is in that law's own forbidden set as of #875, and the law cannot see
this call. pages.go:1130 is the cut.
This is written down as the fifth blind spot in the file's head comment
(d8cd923b1) because the comment opens by saying that a law whose reach a
reader cannot predict is a law that lies by omission. Writing it down is not
closing it.
What to do
Make callsIn parameter-aware: alongside receiverName(fn), collect the names
of the function's parameters whose type is *app, and treat a call on any of
them as the same surface edge. It is about eight lines off fn.Type.Params, and
the same names feed nodeName(recv, …) with "app" as the receiver type.
internal/tui3 has a lot of func f(a *app, …), so expect this to turn things
up — that is the point, and it is why it was not done in the same commit as the
law itself. Each one is then a real question with three honest answers: the read
moves to open/tick behind the memo (learned[T]), or the call is deleted, or
it goes on frameDiskDoors with the line saying why it is once-per-epoch rather
than per-frame. The allowlist is one entry today and should stay short.
TestTheLawSeesEveryShapeOfIndirectionItClaims is where the proof goes: plant
func planted(a *app) calling a forbidden thing and assert the walk reaches it,
so deleting the parameter case turns the test red naming that shape.
Two smaller holes are named in the same head comment and are cheaper to leave
alone for now: a local holding a NAMED function (run := startOpener), and a
command built in one body and started in another.
While you are in there: the picture decode
PERF.md and #875's head comment say the frame takes no disk read but the one
allowlisted decode, and that the decode "cannot be learned because cols,
maxRows and the palette are frame facts no arrival knows". That is half
wrong, and the wrong half is the expensive half.
renderPicture (imagepreview.go:301) is two stages:
os.Open→image.DecodeConfig→Seek→image.Decode→source, which is
shape-independent: it depends on the file and nothing else;pictureGrid+pictureCells, which are the only consumers ofcols,
maxRowsand the palette.
So the DISK half can be learned per (path, mod, size) — the key
app.pictures already carries — and only the render half stays keyed on shape in
app.previews. A resize drag would then re-cell what is on screen without
re-reading or re-decoding any of it, which is the case the current bound exists
to excuse. The memory cost is a decoded image per learned picture rather than a
stat, so this needs a bound of its own (bytes, not entries) — that is the real
design question and the reason it is a separate change.
Do the law first: it is what says whether the answer stayed true.
Drafted with CodeAF · reviewed and owned by the author
Activity
The leaf's grant is one number, measured against real work
The leaf's grant is one number, and the measurement saying it is too …
exec: the leaf's grant is 220,000, and the band it sits in is written…
frame law: a closure the paint files for a press is the loop's, not t…
the home an errand opens at is read once at open, and stays absolute
tui3: the frame law sees a function that takes the surface as a param…