Sync only the declaring module before a run; skip git-ignored paths

`fluksio run` walked the working directory and imported every module in
it, which ran a research repository's analysis scripts before the run was
submitted. A flow's origin now records the file and module name that
declared it, and run/sweep import just that, under the same name so the
generated node bodies do not change. A flow with no record still walks,
now skipping what .gitignore covers.

Every code-defined flow reports `flow` changed once on its next sync,
since the origin gained two fields.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QgG6TJw5qBZzaLghQSRVrq
This commit is contained in:
2026-09-16 16:55:02 +02:00
co-authored by Claude Opus 5
parent 7dfe646e2b
commit fccf89f849
9 changed files with 246 additions and 22 deletions
+20
View File
@@ -708,6 +708,26 @@ def repo_root(start: str | Path) -> str:
return found or str(directory)
def ignored(directory: Path) -> frozenset[Path]:
"""What the repository ignores below a directory, as git itself reads it.
Directories come back whole rather than file by file, so an ignored
`mlruns/` costs one entry instead of a walk. Empty outside a repository.
"""
listed = _git(
str(directory),
"ls-files",
"--others",
"--ignored",
"--exclude-standard",
"--directory",
"-z",
)
return frozenset(
directory / entry.rstrip("/") for entry in (listed or "").split("\0") if entry
)
def sync(
flows: Iterable[Flow],
client: Client,