gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2f9e29ff2f9e29ffreports/MK-mobile.md, deploy.sh GATES: tests/mobile.mjs, theme check markermre2f9e29ff/plugins/fs/server.hl

5.8 KB

  1. file(String path) {
  2. return __native("fs.file", path)
  3. }
  4. readFile(String path) {
  5. return __native("fs.read_file", path)
  6. }
  7. \* `readFile`, but a path that is not there answers null instead of failing: for what
  8. another process may delete between a probe and the read (the shared build cache). *\
  9. tryReadFile(String path) {
  10. return __native("fs.try_read_file", path)
  11. }
  12. \* Read a whole file as Bytes (ticket #88): every byte as it is on disk,
  13. nothing decoded — the way back for what writeFile stored from a Bytes. *\
  14. readBytes(String path) {
  15. return toBytes(__native("fs.read_file", path))
  16. }
  17. \* Name the file every path read, listed or probed is appended to (one line,
  18. `r|l|e <path>`), or stop with null — the build cache's record of what a
  19. build depends on (326 rung 12). *\
  20. traceReads(path) {
  21. return __native("fs.trace", path)
  22. }
  23. \* The SHA-256 of a file's bytes, 64 hex digits, or null when it cannot be
  24. read; `textDigest`, of a text's. Hashed natively (the build cache). *\
  25. fileDigest(String path) {
  26. return __native("fs.digest", path)
  27. }
  28. textDigest(String text) {
  29. return __native("fs.digest_text", text)
  30. }
  31. \* The path's last status change (ctime) in milliseconds since the epoch, or null
  32. when it is not there (#195): what the build cache compares with the moment a
  33. build began. *\
  34. changeTime(String path) {
  35. return __native("fs.change_time", path)
  36. }
  37. listDir(String path) {
  38. return __native("fs.list_dir", path)
  39. }
  40. \* Does this path exist? (mission 077) The one call in hl:fs that cannot fail:
  41. it answers true/false, never an Error event — probing a path is a question,
  42. not an operation. Relative paths resolve against the SCRIPT's directory like
  43. every other hl:fs path. *\
  44. exists(String path) {
  45. return __native("fs.exists", path)
  46. }
  47. \* Watch a directory tree for changes (the dev-reload bell): an ordinary
  48. event-loop source — register it and every save arrives as an event.
  49. __native("eventloop.register", watch("."), "changed")
  50. on changed(ev) { … ev.name … }
  51. `exclude` (2026-08-30) names directories the descent must NOT enter — a
  52. path string, or a list of them. Omit it and the whole tree is watched, as
  53. it always was. The paths are compared RESOLVED (relative ones against the
  54. script's directory, like every hl:fs path) and normalised, so `./sessions`,
  55. `sessions` and `var/../sessions` are the same directory, and a sibling
  56. named `sessions-old` is NOT inside `sessions`.
  57. watch(".", "./sessions")
  58. watch(".", ["./sessions", "/var/cache/app"])
  59. A program that writes to a directory it also watches needs this: without
  60. it the only escape was that the walker skips dot-directories (which it
  61. still does — `.git` is the reason), i.e. renaming the directory. *\
  62. watch(String path, exclude) {
  63. return __native("fs.watch", path, exclude)
  64. }
  65. \* Write a whole file, ATOMICALLY (2026-08-28). Everything above this line
  66. reads; hl:fs could report a file's `chmod` and never set one, which is why
  67. nothing in this language could persist anything until now.
  68. The write goes to a sibling temp file, is fsynced, and is then renamed over
  69. the target — so a concurrent reader sees the whole OLD file or the whole NEW
  70. one, never a half of either. That matters more than it sounds: the first
  71. caller is the session store, and a truncated session file does not read as
  72. an error, it reads as a logged-out user.
  73. `mode` defaults to 0600 — a file this program wrote, for this program. Pass
  74. one to loosen it; nothing here consults the umask on your behalf.
  75. `contents` is a String or a Bytes (ticket #88): a Bytes is written raw,
  76. byte for byte — an uploaded image stays an image. *\
  77. writeFile(
  78. String path
  79. contents \\ a String or a Bytes
  80. Number mode
  81. ) {
  82. if (hlTypeName(contents) == 'Bytes') {
  83. return __native("fs.write_file_hex", path, contents.hex(), mode)
  84. }
  85. return __native("fs.write_file", path, contents, mode)
  86. }
  87. \* Append to a file — the log's shape, not the session store's (2026-09-27, a
  88. creator ask after routger's two). Opened O_APPEND, never truncated: the file
  89. is created (at `mode`, default 0600, same as writeFile) if it is not there
  90. yet, and every call after that lands its bytes after whatever is already on
  91. disk. `writeFile`'s atomicity is a RENAME over a temp file — there is no
  92. "old" or "new" whole file to swap here, since an append MUTATES the one
  93. that is already there — but O_APPEND carries its own, narrower guarantee:
  94. the kernel positions a single write() at the CURRENT end of file and
  95. performs it as one operation, so two processes each appending one line
  96. never interleave their bytes mid-line, and a reader never sees a torn
  97. append. That is what "a single write of a line lands whole" buys — call it
  98. once per line (or per record) you want that guarantee for.
  99. `contents` is a String or a Bytes (ticket #88), same as writeFile: a Bytes
  100. is appended raw, byte for byte. *\
  101. appendFile(
  102. String path
  103. contents \\ a String or a Bytes
  104. Number mode
  105. ) {
  106. if (hlTypeName(contents) == 'Bytes') {
  107. return __native("fs.append_file_hex", path, contents.hex(), mode)
  108. }
  109. return __native("fs.append_file", path, contents, mode)
  110. }
  111. \* Make a directory and every missing parent. Already-there is SUCCESS: the
  112. caller wants the directory to exist, not to be the one who created it.
  113. `mode` defaults to 0700. *\
  114. mkDir(String path, Number mode) {
  115. return __native("fs.mk_dir", path, mode)
  116. }
  117. \* Delete a file or an empty directory. IDEMPOTENT: true when the path is gone on return, and a path
  118. that was already gone counts. A sweep must not fail because something else
  119. deleted the file first. *\
  120. remove(String path) {
  121. return __native("fs.remove", path)
  122. }
  123. \* The canonical absolute path of `path` (symlinks resolved, `.`/`..` folded;
  124. realpath(3)), or null when it is not there. `realPath('/proc/self/exe')` is
  125. the running binary. *\
  126. realPath(String path) {
  127. return __native("fs.real_path", path)
  128. }

Branches

Latest commits

  • 2f9e29ffreports/MK-mobile.md, deploy.sh GATES: tests/mobile.mjs, theme check markermre
  • 7cfc8ab5a season of more than 150 episodes starts closed on its title page; the phone gate checks itmre
  • 59095c59tests/mobile.mjs: the phone gate (390 px touch, tap targets, /franchises paging)mre
  • 105309detap targets: every row link, the TMDB/IMDb badges, the widget links, the franchise names and the login-failed link are 44 px high on a phonemre
  • f0b86c8efranchises: 40 loose timelines per page (/franchises/page/N) and a merge sort for the names (1,546 timelines: 20 s and 54,000 px before)mre
  • b9e841a7Merge branch 'sy-sync'mre
  • d1ae2701sync components.hybriel 4922f9c: modal and pagination 44 px targets (vendored copies, verbatim) (SY)mre
  • 043624b2theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
  • 05d89fd0deploy: security gate (tests/security.mjs)mre
  • 2ae8a47bMerge branch 'sk-sec'mre
  • 8fee5d52sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • 944ad51eSK: report reports/SK-sec.md, LOGsk
  • 415487c1SK: import budget per user + id type check, gate checkssk
  • 7b8a4f74security audit SK: nosniff + image sandbox headers, face id checks, adult follow, login budget + new session at login, guest-link budget, tests/security.mjssk
  • f0f26c5areports: T18 section (gates, boot-gate, 3x3 table, search + short-id compare)mre
  • 2a8682a1deploy.sh GATES: tests/warmstart.mjsmre
  • 3761338breports/T17-boot.md: handoff (phase table, fix, numbers so far, open proof)mre
  • 52e09eb2boot: sync window 1000 ms (the gates ask for a complete start), README boot-time sectionmre
  • c87149e8tests/warmstart.mjs: the progressive start proven over HTTP (note in the window, 503 short id, after: everything); bootBeginmre
  • 593a6350boot: resumable start-up scan, the server listens first (T17)mre