Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/patches/1950e04f69345a8f # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aien-architecture-mv#172 (code only) closed derived `1950e04f69345a8f` #172 Imported from GitHub aien-dev/aien-architecture-mv#172 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `c3bc5a3c2bc72a7bdd664828db0b433fe0024647` · Head `01324f580a2aca0ecc5e6ef17675ebd2d5810aac` ### Apply it ``` git checkout -b patch-1950e04f69345a8f c3bc5a3c2bc72a7bdd664828db0b433fe0024647 curl -fsSL https://interplane.io/drakestapleton/aien-architecture-mv/patches/1950e04f69345a8f.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aien-architecture-mv 172 01324f580a2aca0ecc5e6ef17675ebd2d5810aac ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-architecture-mv","number":172,"url":"https://github.com/aien-dev/aien-architecture-mv/pull/172","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:52Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index a8ef65e..3f5afb0 100644 --- a/.crumb +++ b/.crumb @@ -22,7 +22,7 @@ "children": [ { "digest": "f9abea949630af2c7c284c2b08ef77a5ec6926a07303a1a39478823ea3c38e57", - "last_commit": "7fcf799", + "last_commit": "c3bc5a3", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -39,21 +39,21 @@ "purpose": "Directory scripts. Purpose not yet described by a human." }, { - "digest": "cdd14c4842f34bc96327321a87f1cd8a17a074966e0e25421da072bdbc249f8c", + "digest": "ec76c5bf9076b78f83c172599f929ae8eee117d11ad90bf6bb94f59d25652984", "last_commit": "d0f0b95", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:326f6ed80c3df69d6a1a41a8abf0c58ad1356944d3f5ed3d14b91251224480c3", - "compiled_at": "2026-10-08T23:41:16Z", + "children_root": "sha256:b88004f8a5b3819b076bf3b124f0b6a4229991c40bae55a20199ea396f65b318", + "compiled_at": "2026-10-09T01:09:28Z", "compiler": "crumb-compile/1", - "digest": "sha256:35ff19e1e64d88cf256eb67929ce5291d2af26a73fd62e301613f4977f815d45", + "digest": "sha256:3cbc6954989acb245e5cfa60b65ee0d8071b2c0154b594b93451cf29755dab96", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 238, - "generated_at_commit": "7fcf799018e76c4ee8f7810f9c0a78a45dc5fc9d", - "source_tree": "sha256:0b8ce0c530316d99077cbe13a584809a9b5455ecc1e47ee04996a960a54629e1" + "generated_at_commit": "c3bc5a3c2bc72a7bdd664828db0b433fe0024647", + "source_tree": "sha256:d6ca4403802201f5fe18095721010e22e69cf29091512af4990c45531f080ae2" }, "owner_lane": "", "provenance": { diff --git a/tools/.crumb b/tools/.crumb index 7ad7811..b4aece9 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -13,21 +13,21 @@ "generated": { "children": [ { - "digest": "29b5375d03b699b7684d62c36fd2e8a4568953a291aff7f040b119fa47f27515", - "last_commit": "5994859", + "digest": "58e74c10e99c73369ebd8dae453b0afe3308578aabbade98981638e4df23763a", + "last_commit": "d0f0b95", "name": "crumb", "purpose": "Directory tools/crumb. Purpose not yet described by a human." } ], - "children_root": "sha256:a2606ec45edc3ed58b193bccc7c3a0a125bb435114cdc6b4b53bfb0d564fa379", - "compiled_at": "2026-10-04T13:46:06Z", + "children_root": "sha256:dc2f609be26e2e39d14f194de5ec76a193eb86298468d749f731f07ab4f6caac", + "compiled_at": "2026-10-09T01:09:28Z", "compiler": "crumb-compile/1", - "digest": "sha256:cdd14c4842f34bc96327321a87f1cd8a17a074966e0e25421da072bdbc249f8c", + "digest": "sha256:ec76c5bf9076b78f83c172599f929ae8eee117d11ad90bf6bb94f59d25652984", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 6, - "generated_at_commit": "5994859af1aedf77834a8cbdf7bf3f8b4d7127e6", - "source_tree": "sha256:9587ca41028610fe08d594ad42e01d5ee5e0fc1fff70fe538c4184ca93f2393d" + "generated_at_commit": "c3bc5a3c2bc72a7bdd664828db0b433fe0024647", + "source_tree": "sha256:46f41f9e084d4116e2074c3eb12a04e3476730f1e47dc6057b5b530d76d38cee" }, "owner_lane": "", "provenance": { diff --git a/tools/crumb/.crumb b/tools/crumb/.crumb index e15d487..214d4e5 100644 --- a/tools/crumb/.crumb +++ b/tools/crumb/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-04T13:46:06Z", + "compiled_at": "2026-10-09T01:09:28Z", "compiler": "crumb-compile/1", - "digest": "sha256:29b5375d03b699b7684d62c36fd2e8a4568953a291aff7f040b119fa47f27515", + "digest": "sha256:58e74c10e99c73369ebd8dae453b0afe3308578aabbade98981638e4df23763a", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 6, - "generated_at_commit": "5994859af1aedf77834a8cbdf7bf3f8b4d7127e6", - "source_tree": "sha256:9587ca41028610fe08d594ad42e01d5ee5e0fc1fff70fe538c4184ca93f2393d" + "generated_at_commit": "c3bc5a3c2bc72a7bdd664828db0b433fe0024647", + "source_tree": "sha256:46f41f9e084d4116e2074c3eb12a04e3476730f1e47dc6057b5b530d76d38cee" }, "owner_lane": "", "provenance": { diff --git a/tools/crumb/crumb.c b/tools/crumb/crumb.c index 03a043f..d31df1c 100644 --- a/tools/crumb/crumb.c +++ b/tools/crumb/crumb.c @@ -898,6 +898,45 @@ static int ignored_subtree(const char *rel) { return 0; } static void reset_ignore(void) { for (size_t i = 0; i < g_nign; i++) free(g_ign[i]); free(g_ign); g_ign = NULL; g_nign = 0; } + +/* Traversal policy for compile/verify/status (issue sovereign-core#355). ONE function decides whether a directory + * takes part, and find_crumbs, the children list and the tracked-crumb pass all call it, so the three commands cannot + * disagree. A directory is excluded when it is (a) under a .crumbignore entry (D10), (b) a directory git itself + * ignores and that holds no tracked file (build output such as target/ listed in .gitignore), or (c) a conventional + * generated-output directory (target, node_modules, __pycache__) that holds no tracked file. A directory with any + * tracked file is real source and always takes part (except via .crumbignore), so no integrity check is weakened. */ +static char *shq(const char *s); static char *cap_cmd(const char *cmd, size_t *len); /* defined with the compiler below */ +static char **g_trk; static size_t g_ntrk; /* tracked paths (git ls-files) */ +static char **g_gign; static size_t g_ngign; /* wholly untracked+ignored directories, "dir/" */ +static void policy_load(const char *top) { + for (size_t i = 0; i < g_ntrk; i++) free(g_trk[i]); + for (size_t i = 0; i < g_ngign; i++) free(g_gign[i]); + free(g_trk); free(g_gign); g_trk = NULL; g_gign = NULL; g_ntrk = g_ngign = 0; + char *tq = shq(top), cmd[PATH_MAX + 96]; size_t n; char *raw; + snprintf(cmd, sizeof cmd, "git -C %s ls-files -z 2>/dev/null", tq); + raw = cap_cmd(cmd, &n); + for (char *s = raw; s < raw + n; s += strlen(s) + 1) { g_trk = xrealloc(g_trk, (g_ntrk + 1) * sizeof *g_trk); g_trk[g_ntrk++] = xstrdup(s); } + snprintf(cmd, sizeof cmd, "git -C %s ls-files -z --others --ignored --exclude-standard --directory 2>/dev/null", tq); + raw = cap_cmd(cmd, &n); + for (char *s = raw; s < raw + n; s += strlen(s) + 1) { + size_t l = strlen(s); if (!l || s[l - 1] != '/') continue; /* directories only */ + g_gign = xrealloc(g_gign, (g_ngign + 1) * sizeof *g_gign); g_gign[g_ngign++] = xstrdup(s); + } +} +static int tracked_under(const char *rel) { + size_t n = strlen(rel); + for (size_t i = 0; i < g_ntrk; i++) if (!strncmp(g_trk[i], rel, n) && g_trk[i][n] == '/') return 1; + return 0; +} +static int skip_generated_dir(const char *rel) { /* rel: repo-relative directory, no trailing slash */ + if (ignored_subtree(rel)) return 1; + const char *b = strrchr(rel, '/'); b = b ? b + 1 : rel; + if (!strcmp(b, ".git")) return 1; + if (tracked_under(rel)) return 0; + size_t n = strlen(rel); + for (size_t i = 0; i < g_ngign; i++) if (strlen(g_gign[i]) == n + 1 && !strncmp(g_gign[i], rel, n)) return 1; + return !strcmp(b, "target") || !strcmp(b, "node_modules") || !strcmp(b, "__pycache__"); +} static Node *scan(const char *path, const char *rel, int isroot) { Node *n = xmalloc(sizeof *n); memset(n, 0, sizeof *n); n->path = xstrdup(path); n->rel = xstrdup(rel); n->name = xstrdup(base_of(path)); @@ -1715,7 +1754,7 @@ static J *comp_object(Comp *c, const char *d, char *dig_out) { /* the generate J *kids = jnew(JARR); Sha crs; sha_init(&crs); for (size_t i = 0; i < nn; i++) { char *kd = root ? xstrdup(names[i]) : pjoin(d, names[i]), *kc = pjoin(kd, ".crumb"), *kcf = pjoin(c->top, kc); struct stat sb; - if (ignored_subtree(kd)) continue; /* D10 */ + if (skip_generated_dir(kd)) continue; /* D10 + #355: same policy as the walker */ if (stat(kcf, &sb) || !S_ISREG(sb.st_mode)) continue; const char *kdig = dig_of(c, kd); char *kdig_own = NULL; if (!kdig) { /* not compiled in this run: fall back to what the crumb says */ @@ -1761,11 +1800,11 @@ static void find_crumbs(const char *top, const char *rel, CDir **out, size_t *n, if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, "..")) continue; char *r = *rel ? pjoin(rel, e->d_name) : xstrdup(e->d_name), *f = pjoin(top, r); struct stat st; if (lstat(f, &st) == 0) { - if (S_ISDIR(st.st_mode) && ignored_subtree(r)) { free(r); free(f); continue; } /* D10 */ + if (S_ISDIR(st.st_mode) && skip_generated_dir(r)) { free(r); free(f); continue; } /* D10 + #355 */ if (!strcmp(e->d_name, ".crumb") && !S_ISDIR(st.st_mode)) { if (*n == *cap) { *cap = *cap ? *cap * 2 : 32; *out = xrealloc(*out, *cap * sizeof **out); } (*out)[*n].d = *rel ? xstrdup(rel) : xstrdup("."); (*n)++; - } else if (S_ISDIR(st.st_mode) && strcmp(r, ".git")) find_crumbs(top, r, out, n, cap); + } else if (S_ISDIR(st.st_mode)) find_crumbs(top, r, out, n, cap); } free(r); free(f); } @@ -1779,7 +1818,7 @@ static int compile_engine(char mode, const char *root, int quiet, int *total_out char *top = cap_cmd(cmd, NULL); chomp(top); if (!*top) die("crumb %s: not inside a git repository: %s", mode == 'c' ? "compile" : mode == 'v' ? "verify" : "status", root); c.top = top; - reset_ignore(); load_ignore(top); /* D10: /.crumbignore subtrees never participate */ + reset_ignore(); load_ignore(top); policy_load(top); /* D10: /.crumbignore subtrees never participate */ char *head = run_git(top, "rev-parse HEAD"); if (strlen(head) != 40) head = xstrdup("0000000000000000000000000000000000000000"); if (head_out) strcpy(head_out, head); comp_load_files(&c); diff --git a/tools/crumb/test.sh b/tools/crumb/test.sh index 84140f0..958a70d 100644 --- a/tools/crumb/test.sh +++ b/tools/crumb/test.sh @@ -186,6 +186,27 @@ echo 'int b3;' > src/deep/b.c; git add -A; st=$("$C" verify . | grep '^STALE' | "$C" compile . >/dev/null; [ "$(cat src/deep/.crumb)" = "$ev0" ] && ok "C3 D10 ignored crumb still untouched after that compile" || bad "C3 D10 ignored crumb touched" rm .crumbignore; "$C" compile . >/dev/null; "$C" verify . >/dev/null && ok "C3 D10 removing .crumbignore and recompiling returns to OK" || bad "C3 D10 remove ignore" git add -A; git -c user.name=t -c user.email=t@t commit -qm "post-ignore" +# sovereign-core#355: generated build directories never take part in compile/verify/status (one shared policy) +SAVE=$(pwd); cd "$T" || exit 1; rm -rf g355; mkdir g355 && cd g355 && git init -q -b main . +mkdir -p src target/debug/build/x/out/auth node_modules/pkg out/cache keep/target +echo 'int main(void){return 0;}' > src/a.c; echo 'fn x(){}' > target/debug/build/x/out/auth/a.rs; echo 'y' > node_modules/pkg/i.js; echo 'z' > out/cache/o.c; echo 's' > keep/target/real.c +for d in . src target/debug/build/x/out/auth node_modules/pkg out/cache keep/target; do printf '{"schema_version":1,"purpose":"p %s"}\n' "$d" > "$d/.crumb"; done +printf 'out/\n' > .gitignore +git add .gitignore .crumb src keep; git -c user.name=t -c user.email=t@t commit -qm init # target/ and node_modules/ stay untracked and NOT gitignored: the built-in names must suffice +tgt0=$(sha256sum target/debug/build/x/out/auth/.crumb node_modules/pkg/.crumb out/cache/.crumb) +"$C" compile . >/dev/null +[ "$(sha256sum target/debug/build/x/out/auth/.crumb node_modules/pkg/.crumb out/cache/.crumb)" = "$tgt0" ] && ok "355 .crumb under target/, node_modules/ and a gitignored dir are byte-identical after compile" || bad "355 build-dir crumbs rewritten" +jq -e '.extensions.generated' src/.crumb >/dev/null && jq -e '.extensions.generated' .crumb >/dev/null && ok "355 source crumbs are still compiled" || bad "355 source crumb not compiled" +jq -e '.extensions.generated' keep/target/.crumb >/dev/null && ok "355 a directory named target that holds tracked files is real source and is still compiled" || bad "355 tracked target skipped" +"$C" status . | grep -Eq 'target/debug|node_modules|out/cache' && bad "355 status lists a build dir" || ok "355 status ignores the build dirs" +"$C" verify . | grep -Eq 'target/debug|node_modules|out/cache' && bad "355 verify lists a build dir" || ok "355 verify ignores the build dirs" +"$C" status . | grep -q 'keep/target' && ok "355 status still lists the tracked target dir" || bad "355 status lost tracked target" +jq -e '[.extensions.generated.children[].name] | (index("node_modules") == null and index("out") == null and index("target") == null)' .crumb >/dev/null && ok "355 build dirs are not children of the root crumb" || bad "355 build dir listed as child" +git add .gitignore .crumb src keep; git -c user.name=t -c user.email=t@t commit -qm compiled +"$C" verify . >/dev/null && ok "355 verify OK after compile" || bad "355 verify after compile" +echo 'int q;' >> target/debug/build/x/out/auth/a.rs; echo 'more' > out/cache/more.c +"$C" verify . >/dev/null && ok "355 changing files inside build dirs does not stale anything" || bad "355 build-dir change staled crumbs" +cd "$SAVE" || exit 1 # differential vs the shell reference (needs jq, git, sha256sum) REF="$HERE/crumb-compile.sh" if command -v jq >/dev/null 2>&1 && [ -f "$REF" ]; then ```