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:
@@ -376,3 +376,23 @@ def test_the_registry_and_the_builder_come_with_the_authoring_import():
|
||||
assert fluksio.FLOWS is fluksio.sdk.FLOWS
|
||||
assert fluksio.FLOWS["train"] is flow
|
||||
assert fluksio.build(flow) == fluksio.sdk.build(flow)
|
||||
|
||||
|
||||
def test_a_flow_records_the_module_that_declared_it():
|
||||
"""What `fluksio run` imports by default, rather than the whole tree."""
|
||||
from pathlib import Path
|
||||
|
||||
here = Path(__file__).resolve()
|
||||
flow = a_flow()
|
||||
|
||||
assert flow.declared_in == str(here)
|
||||
assert flow.module == __name__
|
||||
|
||||
origin = flow.document({"kind": "python", "repo": str(here.parents[2])})["origin"]
|
||||
assert origin["declared_in"] == "tests/sdk/test_build.py"
|
||||
assert origin["module"] == __name__
|
||||
assert FlowDef.model_validate(flow.document(origin)).origin.module == __name__
|
||||
|
||||
# A repository the file is not in has no path to give it.
|
||||
elsewhere = flow.document({"kind": "python", "repo": "/elsewhere"})["origin"]
|
||||
assert (elsewhere["declared_in"], elsewhere["module"]) == ("", "")
|
||||
|
||||
Reference in New Issue
Block a user