Skip to content

feat(apps): line editor for in-guest source authoring (refs #769) - #779

Merged
rwrife merged 2 commits into
mainfrom
feature/guest-editor-769
Sep 18, 2026
Merged

rwrife merged 2 commits into
mainfrom
feature/guest-editor-769

Conversation

@rwrife

@rwrife rwrife commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds user/apps/edit/main.c: a minimal line-oriented editor (commands o p a c d w q ?) staged as the signed app /apps/edit.bin, so a user can create, view, change, delete, save, and cancel a small C program from the ordinary guest console (DEMO-05 / DEMO-05: Add minimal multiline source creation and editing inside SecureOS #769).
  • Line input is verbatim (spaces, quotes, backslashes preserved byte-for-byte); oversize lines are rejected explicitly (EDIT:ERR:LINE_LONG, no silent truncation); quitting with unsaved changes writes nothing; a denied save leaves persistent content untouched.
  • New booted-guest evidence gate run_qemu --test kernel_edit (wired through test.sh, validate_bundle.sh, build scripts): session 1 creates demo.c (4-line C source with quotes/escapes), edits, saves twice, has a save denied and quits discarding the dirty buffer; cat demo.c then proves the persisted bytes match the last saved version; session 2 reopens (EDIT:OPEN:EXISTING) and prints the exact stored lines before a final append+save+clean quit. Consent prompts are keyed individually (6 allow + 1 deny).
  • dev/building.txt documents the actual on-device commands (with its pinned /apps/dev sha256 updated).

Verification

  • Booted-guest evidence (CI run 35370308351): QEMU_PASS:kernel_edit — the ordinary booted image ran both editor sessions with byte-exact EDIT:BUF:* readback including os_console_write("hi"); and os_console_write("bye");, denied-save no-mutation (EDIT:SAVE:DENIED + cat proving unchanged storage), cancel (EDIT:QUIT:DISCARD), and clean quit (EDIT:QUIT:CLEAN).
  • Host-side strict freestanding compile (cc -std=c11 -Wall -Wextra -Werror -ffreestanding -nostdinc) passes.
  • Ad-hoc logic harness (stubbed os_* bridge + scripted key queue) exercised open-new/open-existing/append/print/change/delete/save/denied-save/oversize-line/quit-discard/quit-clean paths: 17/17 assertions PASS.
  • lint.sh green; heredoc Python and all five validate_bundle.sh surfaces parse-checked.

Remaining acceptance gap (why refs, not closes)

The oversize-input acceptance bullet is implemented in the app (explicit EDIT:ERR:LINE_LONG, no silent truncation; harness-proven) but is not yet driven through the scripted boot gate — a 64+ byte typed console line may hit the kernel console line buffer before reaching the app, which needs its own investigation. Leaving #769 open for the user to decide on that final bullet.

Adds /apps/edit, a minimal line-oriented editor so a user can create,
inspect, change, save, and cancel a small C program from the ordinary
guest console without host assistance (DEMO-05 slice).

- user/apps/edit/main.c: freestanding app; commands o/p/a/c/d/w/q/?;
  verbatim line input (spaces, quotes, backslashes preserved), explicit
  oversize rejection (EDIT:ERR:LINE_LONG, no silent truncation), dirty
  quit performs no write, denied saves leave storage untouched, and all
  observable results emit deterministic EDIT:* markers.
- Staged + signed like binfs: build.sh, build_disk_image.sh app mapping.
- run_qemu kernel_edit gate: two editor sessions on the booted image
  with per-prompt consent driving (create/append/print/save/change/
  delete/save/deny-save/quit, then reopen + append + save), a cat of
  the persisted file, and marker assertions including byte-exact
  EDIT:BUF/EDIT:CHANGE lines.
- test.sh dispatcher kernel_edit (90s window) + validate_bundle wiring
  (TEST_TARGETS, artifact copy, aliases, meta list, serialLogs).
- dev/building.txt documents the actual in-guest commands.

Ad-hoc host verification (stubbed-bridge harness, 17/17 checks): open
new/existing, append fidelity with quotes+backslashes, print, save,
change, delete, denied-save no-mutation, oversize line rejection, and
quit discard/clean paths.

Refs #769
dev/building.txt gained the in-guest editor usage section; update the
pinned /apps/dev/building.txt sha256 in tools/disk_image_apps_dev_sha.json
(new=9d4db296798c15d0b8dbcb5ae49d530120831c296eee328d7cf9d49e6bc06f0f).

Refs #769
@rwrife
rwrife merged commit 0c43162 into main Sep 18, 2026
3 checks passed
@rwrife
rwrife deleted the feature/guest-editor-769 branch September 18, 2026 16:53
rwrife added a commit that referenced this pull request Sep 19, 2026
… gate (#780)

The #769 editor shipped with the oversize-input bullet implemented in
the app (EDIT:ERR:LINE_LONG, host-harness-proven in #779) but not
driven through the booted gate. Close that final gap:

- run_qemu kernel_edit session 2 now appends a 70-char line after the
  reopen print: the editor must reject it with EDIT:ERR:LINE_LONG, end
  append mode, drain the remainder to the terminator, and the
  following print must show the buffer byte-unchanged at the
  pre-append line count (new expected markers EDIT:ERR:LINE_LONG +
  EDIT:PRINT:3). No consent-prompt count change; the existing 90s
  window covers the two extra steps.
- dev/building.txt documents the visible limit for users; repin the
  /apps/dev/building.txt sha256 in tools/disk_image_apps_dev_sha.json.

App source unchanged. Ad-hoc host verification (stubbed-bridge
scripted-key harness replaying the exact new session-2 flow, 12/12
checks PASS): open-existing, print(3), 70-char append -> ERR, second
print still 3 byte-exact lines, exactly one write for the whole
session (the later legitimate save), append/save/quit proceed after
the error.

Closes #769

Co-authored-by: Ryan Rife <1685329+rwrife@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant