AtlatestRepositoryfolio
1
;;; The native half of the revision conformance pair.2
;;;3
;;; Emits `<filename>\t<revision>` for every `.sgd` in a vector directory, using4
;;; `(folio doc revision)` -- the implementation a native folio server actually5
;;; uses to feed `(folio doc inspect)`. The WASM half is6
;;; `test/f2b-revision-webcrypto.js`; `test/gate-f2b.sh` compares them.7
;;;8
;;; This file does NOT use `(sigil test)`: a direct `sigil <file>` run REGISTERS9
;;; test forms and never executes them -- measured by F2a, where `1 = 2` printed10
;;; nothing and exited 0. Everything here either prints or raises.11
(import (sigil core)12
(sigil string)13
(sigil list)14
(sigil fs)15
(sigil process)16
(sigil path)17
(folio doc revision))19
(define (args-after-script rest)20
(cond21
((null? rest) '())22
((string-ends-with? (car rest) ".sgl") (cdr rest))23
(else (args-after-script (cdr rest)))))25
(define vector-dir26
(let ((rest (args-after-script (command-line))))27
(if (null? rest)28
(begin (display "f2b-revision-native: usage: <script> <vector-dir>\n") (exit 2))29
(car rest))))31
(unless (directory-exists? vector-dir)32
(display (format "f2b-revision-native: no such directory: ~a~%" vector-dir))33
(exit 2))35
(define files36
(list-sort string<?37
(filter (lambda (f) (string-ends-with? f ".sgd"))38
(or (directory-list vector-dir) '()))))40
;; A FLOOR ON THE POPULATION. An empty vector set produces no output, and a41
;; comparison of two empty outputs succeeds -- so the harness would report the42
;; two implementations agreeing when neither had hashed anything. Refusing here43
;; is the difference between "they agree" and "nothing was measured".44
(when (null? files)45
(display (format "f2b-revision-native: no .sgd vectors in ~a~%" vector-dir))46
(display "REFUSING to report success over an empty vector set.\n")47
(exit 3))49
(for-each50
(lambda (f)51
(display (format "~a\t~a~%" f (revision-of-file (path-join vector-dir f)))))52
files)