A module's directory is never shared code, held or not (hq issue 278)
The merge of mesh-catalog 7f99fb4a rebuilt 103 modules with the build agent in tier 0, and ADR 0236 recorded it as "a change to the build agent rebuilds most of the catalogue". The agent had not changed: modules/showcase/index.ts had. showcase is the catalogue's reference module, held by no machine, and its manifest was not in the merge, so whatTheMergeTouched read the file as shared code and rebuilt everything built from the repository (88 came out byte-identical). The agent stood first only because everything is built by it. Whether a directory is a module is a fact of the repository at the merge commit, so the forge's announcer now says it: module_dirs, the changed files' directories holding a module.json there, with module_dirs_said. A changed file inside one is that module's business; only a file in no such directory is shared. An announcer that does not say keeps the old rule. `plans` what-if takes the same list as module-dirs. And a regression for the open question: nothing depends on the build agent except by being built by it, and built-by never widens a plan, so a change to the agent - manifest or program - rebuilds the agent alone; what moved beside it is ordered after it.
This commit is contained in:
@@ -120,3 +120,37 @@ func TestAToolchainStandingOnTheSDKFollowsIt(t *testing.T) {
|
||||
t.Errorf("no edge from the toolchain to the SDK: %v", edges)
|
||||
}
|
||||
}
|
||||
|
||||
// novox/hq issue 278: nothing depends on the build agent but by being built by it. A plan is widened
|
||||
// only along the other kinds (reachableFrom), so this is what keeps a change to the build agent — its
|
||||
// manifest or its program — from rebuilding what it builds: the relation holds no edge to it that could.
|
||||
func TestNothingStandsOnTheBuildAgentOnlyIsBuiltByIt(t *testing.T) {
|
||||
const catalogueRepo = "http://forge/novox/mesh-catalog.git"
|
||||
agent := Entry{Manifest: catalogue.Manifest{Module: "build-agent",
|
||||
Claims: []catalogue.Claim{{Name: "node-build-agent", Scope: catalogue.ScopeNode}}},
|
||||
Source: Source{Repository: catalogueRepo, Path: "modules/build-agent"}}
|
||||
bundle := Entry{Manifest: catalogue.Manifest{Module: "redis", Build: &catalogue.Build{
|
||||
Artifacts: []catalogue.Artifact{{Name: "code", Kind: catalogue.ArtifactBundle, Language: "typescript"}}}},
|
||||
Source: Source{Repository: catalogueRepo, Path: "modules/redis"}}
|
||||
entries := []Entry{
|
||||
agent, bundle,
|
||||
{Manifest: catalogue.Manifest{Module: "postgres"}, Source: Source{Repository: catalogueRepo, Path: "modules/postgres"}},
|
||||
{Manifest: catalogue.Manifest{Module: "mesh-tools"}, Source: Source{Repository: "http://forge/novox/mesh-tools.git"}},
|
||||
{Manifest: catalogue.Manifest{Module: TheControlPlane}, Source: Source{Repository: "http://forge/novox/mesh-controller.git"}},
|
||||
}
|
||||
// A module packaging another repository depends on what is built from it, never on the agent.
|
||||
read := map[string][]ReadRepository{"postgres": {{Repository: "http://forge/novox/mesh-tools.git"}}}
|
||||
builtBy := 0
|
||||
for _, e := range dependenciesOf(entries, nil, read) {
|
||||
if e.To != "build-agent" {
|
||||
continue
|
||||
}
|
||||
if e.Kind != EdgeBuiltBy {
|
||||
t.Errorf("%s depends on the build agent as %s: a change to the agent would rebuild it", e.From, e.Kind)
|
||||
}
|
||||
builtBy++
|
||||
}
|
||||
if builtBy != 4 {
|
||||
t.Errorf("everything source-built is built by the agent: %d edges", builtBy)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user