Skip to content

Commit e820a16

Browse files
authored
Merge pull request #222 from KubaO/staging
BETA 997 re-check with five new pages, 15 new bug reproducers, the help add-in offline, and a smaller offline site
2 parents 75e95f1 + 4192f10 commit e820a16

381 files changed

Lines changed: 5849 additions & 3904 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ indexer/.packages/
2828
# docs/assets/fonts/ -- only the archives are throwaway.
2929
/.font-cache/
3030

31+
# The help add-in's documentation archive is built by scripts/build_help_archive.mjs
32+
# from docs/_site-offline, and is too large to commit.
33+
/add-in/Resources/HELP/
34+
3135
# A bug reproducer's zip is only for attaching to its GitHub issue (see
3236
# BUGS-TO-REPORT.md); the .twinproj beside it is committed.
3337
/bugs/**/*.zip

‎BUGS-TO-REPORT.md‎

Lines changed: 678 additions & 82 deletions
Large diffs are not rendered by default.

‎WIP.ExamplesBuild.md‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,14 @@ All are forced by putting unrelated samples in one compilation unit:
451451
- **`Sub Main` comes from the template, and a fence may bring its own as well.** Two
452452
`Public Sub Main`s in different modules compile, so the WinServicesLib `Module Startup`
453453
samples build as written. (A *build* adds a rule; see [`--build` and `--llvm`](#--build-and---llvm-what-a-compile-does-not-ask).)
454-
- **A generated module must not share a name with the project.** `project.name = "ProbeWS"`
455-
beside `Module ProbeWS` makes `[RunAfterBuild]`'s `ProbeWS.ProbeWS.Probe` ambiguous, and
456-
the IDE refuses it at *execution* time, so the build is green and nothing runs.
454+
- **No generated module may be named like the project, in any letter case.** With
455+
`project.name = "ProbeWS"`, a `Module ProbeWS` or a `Module probews` stops the
456+
`[RunAfterBuild]` Sub from running, even when it is empty and the Sub is in another module.
457+
Nothing reports it: the build is green, and the DEBUG CONSOLE ends at `[BUILD] Executing
458+
'<project>.<module>.<Sub>'...` (BETA 995 and 997; the BUGS-TO-REPORT.md entry with the
459+
reproducer `bugs/module-named-like-project/`). The tool names each project `DocSamples<n>`
460+
and every module it generates `tbx...`, so the two cannot meet; a sample that declared
461+
`Module DocSamples3` would.
457462

458463
**What collides is narrower than it looks, and guessing it wide is expensive.** Two
459464
generated modules may each declare `Public Function Foo`, `Public Type Rec` and `Public Const
@@ -746,12 +751,10 @@ that fails only the second is one LLVM cannot generate code for.
746751
reads the DEBUG CONSOLE, which nothing removes an entry from, and exits 4 naming the file
747752
the compiler died parsing. **Treat any tooling that infers "finished" from "stopped
748753
changing" as suspect on this compiler.**
749-
- **A two-line syntax skeleton crashes the compiler**, and it is in the corpus:
750-
`Interface <name> Extends <base-interface>` / `End Interface`, in
751-
`Reference/Attributes.md`. The placeholder name does it, given any `Extends` clause:
752-
`Extends IBase` crashes it too. Recorded in [BUGS-TO-REPORT.md](BUGS-TO-REPORT.md). The
753-
classifier refuses a `<placeholder>` as a declaration name, so it takes an explicit
754-
`slot=` to reach the compiler with one.
754+
- **The classifier refuses a `<placeholder>` as a declaration name**, so a syntax skeleton
755+
such as `Interface <name> Extends <base-interface>` / `End Interface` (in
756+
`Reference/Attributes.md`) takes an explicit `slot=` to reach the compiler. Through BETA
757+
995 that skeleton crashed the compiler (twinbasic/twinbasic#2453, fixed in 997).
755758
- **`project.buildPath` must be an explicit file.** The default `${SourcePath}\Build\...`
756759
template opens a native Save dialog, which on the private desktop is invisible and
757760
unreachable, so the build silently never happens --- and the WebView2 renderer stays

‎WIP.Harness.md‎

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,10 @@ other 193 are refused at every site.
216216
one form able to pass never compiled is inconclusive, not refused, and the same holds for a
217217
run cut short.
218218

219-
**It found a compiler crash the documentation never would:** a bare `[PopulateFrom]` on an
220-
Enum kills the compiler, at all three Enum sites; the tool isolated it by halving to one
221-
probe beside the canaries. It is in [BUGS-TO-REPORT.md](BUGS-TO-REPORT.md).
219+
**It finds compiler crashes the documentation never would:** a crash in a batch is
220+
isolated by halving down to one probe beside the canaries, which is how a bare
221+
`[PopulateFrom]` on an Enum was found to kill the compiler (twinbasic/twinbasic#2450, fixed
222+
in BETA 997).
222223

223224
**Read the report's "accepted at most sites" section before believing an acceptance.**
224225
`[Description]` is taken at 53 of 61 sites and `[Hidden]` and `[Restricted]` at 42: either
@@ -245,8 +246,23 @@ override that, and one of the two is needed for an install kept anywhere else. *
245246
path is hardcoded**, here or anywhere in the tooling: an install path contains a username.
246247

247248
`--json` gives the same thing as one object and `--keep` leaves the IDE running. Exit codes
248-
are 0 clean, 1 the project has errors, 2 the harness failed, 3 the compile never settled, 4
249-
the project crashes the compiler.
249+
are 0 clean, 1 the project has errors, 2 the harness failed or the project file cannot be read,
250+
3 the compile never settled, 4 the project crashes the compiler.
251+
252+
**A project file the IDE cannot read is refused before an IDE starts.** `tbbuild` reads the
253+
container with impexp's reader (`checkProject`, in
254+
[scripts/lib/tb-project.mjs](scripts/lib/tb-project.mjs)) and exits 2 within a moment,
255+
naming the file and the fault. Without that, BETA 995 gave exit 0, a clean compile with no
256+
rows, after the whole `--timeout` (66 s at `--timeout 60`) for an empty file, a file cut off
257+
halfway and a file with its first byte changed, and exit 3 for a text file. The IDE answers
258+
such a file with a message box, which nobody can see or answer on the private desktop. The
259+
status bar never settles, and a wait that ends at its deadline is read as a compile with no
260+
diagnostics, because `waitForCompile` does not report that it ran out of time. Only the
261+
container is checked: a file that reads as a project and that the IDE still cannot load is
262+
not covered. `launchOnDesktop`'s `dialogs: "close"` can record a box, but only by pressing OK
263+
on it, `launchIde` does not ask for it, and the job it matches boxes against is absent under
264+
`--keep`. Making `waitForCompile` say that it ran out of time would cover every such wedge,
265+
and is not done.
250266

251267
**`--show` / `--hide`, and `TBBUILD_SHOW` for a whole session.** Hidden is the default. Its
252268
cost shows only when something goes wrong: a wedged IDE on a private desktop is invisible to
@@ -434,27 +450,29 @@ other thirty their run.
434450

435451
### Why it drives the WebView rather than the compiler directly
436452

437-
The obvious improvement is to cut the browser out --- the compiler has websockets, so why go
438-
through a UI at all? **It cannot be done, and the reason is structural.**
453+
The obvious improvement is to cut the browser out: the compiler has websockets, so why go
454+
through a UI at all? **It can be done, and the harness does not do it yet.**
439455

440456
The IDE is three processes, and their command lines say how they relate:
441457

442458
| process | command line | role |
443459
|---|---|---|
444460
| `twinBASIC.exe` | `<project.twinproj>` | shell; hosts the WebView2, and the only one given the project |
445461
| `twinBASIC_win32.exe` | `--ide=<shell pid>` | serves `ide/` over HTTP on an ephemeral port |
446-
| `twinBASIC_win32_noDEP.exe` | `--compiler=<opaque token>` | the compiler; the page talks to it over websockets |
462+
| `twinBASIC_win32_noDEP.exe` | `--compiler=<window handle>` | the compiler; the page talks to it over websockets |
447463

448464
The page's websockets carry everything the window shows about a compile, the diagnostics and
449465
their counts included.
450466

451-
**But what a connection needs, its address and its key, is minted inside the WebView**, by
452-
host objects the shell gives its page --- reachable only from a page the shell has loaded.
453-
Starting the compiler directly is no way round it either: `--compiler=` is not a port but
454-
an opaque handle the shell hands it. So a proxy between the WebView and the HTTP server is
455-
possible --- the page and its scripts come over plain HTTP, and a patched `main2.js` could
456-
be served --- but it would not remove the WebView, it would only change what runs inside it.
457-
The thing you would want to delete is the thing that mints the connection.
467+
**The compiler chooses its own address and key, and tells the process that started it.** So
468+
a program that starts a compiler itself can connect to it, and `--compiler=` need not name a
469+
real window for a compile or a build (BETA 995).
470+
471+
What stands in the way is the work the page does over those connections. It loads the
472+
project, gives the compiler every package the project needs, answers what the compiler asks,
473+
and works out when a compile has finished. A client without the WebView has to do all of
474+
that itself, in a protocol that is the IDE's own and may change with any beta, while the IDE
475+
always speaks its own build's. So the harness drives the IDE.
458476

459477
Watching the page's traffic is another matter: CDP shows it to the harness with no key, and
460478
the wait for a compile ends on it (*How the wait for the compile ends*, above). The
@@ -517,6 +535,19 @@ Rules it follows:
517535

518536
- **`element.click()` on `#buildIcon` does nothing.** It is a plain DIV behind the IDE's own
519537
pointer handling and needs real `Input.dispatchMouseEvent` presses at its centre.
538+
- **Build is pressed through `pressBuild` (`tb-ide.mjs`), which waits up to 60 s for the
539+
page globals `licenceIsSet` to be true and `lockUICount` to be 0.** `tbBuild_Start` waits
540+
only about five seconds for the compiler to answer the licence key's validation, which
541+
`afterSocketsAreConnected` resets on every compiler connection, and then writes "[BUILD]
542+
failed due to licence error" and builds nothing. `#appOverlay` is a transparent element
543+
over the whole page, shown while `lockUICount` is above zero: by every modal dialog, the
544+
"Compiling..." and project-loading progress dialogs among them, and by an open menu. A press
545+
then fails with "its centre is covered by #appOverlay" (both were seen once each in a full
546+
`bug_repro verify`). A licence still unset after the wait throws; an overlay still up is
547+
left to `click`, which names it.
548+
- **A click that fails saves a picture of the page** (`pagePicture` in `tb-click.mjs`, CDP
549+
`Page.captureScreenshot`, which works on the private desktop) under `%TEMP%\tb-click\`, and
550+
its error names the file.
520551
- **Read the console's backing array, not the pane.** The DEBUG CONSOLE is a
521552
`createListView()`, which keeps only the rows that fit in the DOM, so scraping its
522553
`innerText` returns the *tail* of a long probe and looks exactly like a complete capture
@@ -763,6 +794,22 @@ variable left set in a shell would switch tidying off for good. Under `--keep` n
763794
tidied, because the kept IDE is still writing. `shutdownIde` waits for the IDE's process to
764795
be gone before anything is tidied, because `taskkill` only asks.
765796

797+
**The last of several runs puts back for all of them.** Two runs at once --- two `ide_test`,
798+
a `tbrun` beside a lane run, another session's --- cannot each put back on their own. An IDE
799+
holds the recent list in memory and writes all of it back when it opens a project, so a run
800+
whose IDE is still open writes the other run's entries back after that run removed them (two
801+
`ide_test` runs failed with exit 3 this way, each naming the other's lane folder). So the runs
802+
share one record in `%TEMP%\tb-registry\<key>`, read and written one run at a time under its
803+
`busy` folder: the first run to start records the recent list, the association and the theme
804+
(`base.json`); every run adds its folders and named projects (`<pid>-<n>.json`); a run that
805+
ends while another is running marks its record finished, puts nothing back and gets `{
806+
deferred: [pids] }` from `finishTidy`, which the lane runner reports instead of checking the
807+
lists; and the last run to end puts back for all, a named project from its oldest record. A
808+
record whose process died unfinished is swept by folder when the next run starts alone, and
809+
its record of the theme and recent list is dropped, since it may be days old.
810+
`check_tb_registry.mjs` plays out both. `tbbuild --keep` takes no part, so its IDE can still
811+
write the lists after the last run has put them back.
812+
766813
**Why .NET through PowerShell and not `reg.exe`.** Node has no registry API. `reg.exe`
767814
prints value names in the console code page when its output is piped, so a path containing a
768815
character outside that code page (an accented user name in `%TEMP%` is enough) comes back
@@ -1197,6 +1244,8 @@ leave the registry alone, and `finishTidy` once the last has ended. Then it chec
11971244
than trusts: no project-state or recent-list entry may name a lane's folder, a second sweep
11981245
of the remembered build targets must find none, and the add-ins' settings must be as
11991246
recorded. Any failure is exit code 3, which wins over a lane's failure (1): the registry is what to repair.
1247+
While another harness run is still running, the lists and targets are that run's to put back
1248+
and are not checked; the report line says which pid.
12001249

12011250
**An add-in's own settings are the runner's too.** `SaveSetting` writes under
12021251
`HKCU\Software\VB and VBA Program Settings\<app>`, the same key as any installed copy of the

0 commit comments

Comments
 (0)