Artifact 5aeb13f6bba0d6fffcbeae965afa7df5e9762598f870617a6a16158d55f0a7ee:
- File
src/store_fs.c
— part of check-in
[c3b2afcdc0]
at
2026-11-13 02:12:51
on branch trunk
— Phase 3: the User scope, placed by links that suit owns and nothing else
suit reads suit.conf from the store, works out which links should exist for the User scope, and makes each harness's folders match. suit plan, apply, status and off. suit run now applies when something changed.
The ledger is a text file listing every link suit made. A link is made under a temporary name and renamed into place. A real file, a real folder or someone else's link at a destination is left byte-identical and reported as a clash. suit off leaves a home folder exactly as it was before the first apply.
Proven with a real harness: Claude Code, run against a scratch home through a local proxy on a DeepSeek model, returned the marker word from the instruction file suit placed, listed the skill suit placed, returned a new marker after the file was edited in the store with no suit command run, and no longer saw it after suit off. make live runs this on purpose; it is not part of the automatic gates.
385 unit checks, 227 shell cases, 146 store cases, 157 placement cases. 100% of functions, lines, regions and branches in all 14 source files. The no-change run costs 0.45 to 0.72 ms over an empty program with the stamp now watching 128 paths.
Not yet done in this phase: live proof with Codex and pi, and the document of each harness's paths. (user: dmestas, size: 1119) [annotate] [blame] [check-ins using]
#include "store_fs.h" #include "platform.h" #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <unistd.h> // libfossil writes every file through this. static int fs_write(void *state, char const *zName, void const *src, fsl_size_t n) { int err = sys_write_atomic(zName, src, n); return err == 0 ? 0 : fsl_cx_err_set((fsl_cx *)state, FSL_RC_IO, "cannot write %s: %s", zName, strerror(err)); } typedef struct { fsl_ckout_fs_dir_f cb; void *state; } DirFilter; static int dir_filter(void *p, char const *entry) { const DirFilter *d = p; bool ours = strncmp(entry, SUIT_TMP_PREFIX, strlen(SUIT_TMP_PREFIX)) == 0; return ours ? 0 : d->cb(d->state, entry); } static int fs_dirlist(void *state, char const *zDir, fsl_ckout_fs_dir_f cb, void *cbState) { DirFilter d = {cb, cbState}; return fsl_ckout_fs_os.xDirList(state, zDir, dir_filter, &d); } int store_fs_install(fsl_cx *f) { fsl_ckout_fs fs = fsl_ckout_fs_os; fs.xWrite = fs_write; fs.xDirList = fs_dirlist; fs.state = f; return fsl_cx_ckout_fs(f, &fs, nullptr); }