feat(gatorwalk-factory): the factory definition lives in the factory model, with its schema (swamp-club #2884) #408
Loading…
Reference in a new issue
No description provided.
Delete branch "cue/2884-gatorwalk-factory-factory"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes swamp-club #2884.
A factory's definition now lives in the factory model itself, with the definition schema as the factory type's schema, so swamp validates it like any model. This replaces #2803's
factories/<factory>.yamlfile, following Adam's review: "I don't understand why the definition is not itself a model."What changed
globalArgumentsare{ definition, tracker, scenarios }.definitionis the definition schema, nested under that key. Nesting avoids a collision between the definition'stracker: { kind }and the factory'stracker: <instance>, and it keeps swamp's shallowpartial()checking the whole definition.definitionis optional, becauseswamp model createchecks the full schema and the factory is created with only its tracker.definitionandscenariosare markedforeignTemplate, so swamp's template scan leaves gatorwalk's{{name}}placeholders alone. That includes a placeholder named like a swamp namespace, such as{{run}}.scenarioslist, instead ofscenarios/<factory>/*.yaml(decided in triage). swamp checks their shape, and they reach a remote worker. Thefactory:key is gone, and two scenarios can't share a name.validate,design_page,new_key,start,reset repin=trueand the trackers'claimall read the raw model definition throughloadFactory, in both the local and the remote (_globalArguments) shape.startstill pins a copy with its digest.init,factories/files,scenarios/files,definition_file.ts,starters.ts,gen_starters.--global-arg tracker=<instance>, then writes an example'sdefinition:andscenarios:blocks underglobalArguments:, right aftertracker:and beforemethods:. It never replaces an existing definition.swamp model validatereports versus gatorwalk'svalidate, the foreign-template marker, why${{stays rejected, the studio, and saved scenarios, plus a decision-log entry.swamp model validate vs gatorwalk validate
Checked on real swamp:
swamp model validate <factory>reports a schema error in the definition or a scenario, with its path, for exampletargets unknown stage 'missing' at "definition.stages.1.transitions.0.to". Every factory method stops on the same error first (Global arguments validation failed: ...).${{ }}expression.validatechecks the raw definition again, which also refuses${{. Then it checks the tracker binding, runs the graph analysis and the saved scenarios, and says where to write a missing definition.Swamp-native
${{ }}(vault or env references) stays rejected. Allowing it later would mean reading those specific fields from the evaluated arguments, and accepting that swamp then skips the schema check for the whole definition.For #2808 (Simulate mode)
The studio now reads one file per factory: its model definition,
models/@swamp/gatorwalk-factory/factory/<factory>.yaml, at the path swamp's definition repository gives (getPath).GET /api/factories/<factory>returns that file's text.globalArguments.definition.loadDefinitioninstudio/src/model.tshandles the prefix, and paths inside the page stay definition-relative (stages.2).globalArguments.scenarios.Loaded.scenarioslists them with their source text.scenariosevent: onedefinitionevent reloads both.Testing
examples_testchecks every example against the factory type's full schema, its graph and its scenarios.factory_testcoverspartial()staying shallow, the foreign-template marker, and the scenario errors.work_item_testcovers a start from the remote shape.factories/orscenarios/path anywhere.swamp model validatereports a definition error with its path.{{run}}placeholder and CEL gates survive save-and-run.${{ }}expression in a prompt is refused and pins nothing.# agent: write <example> into <factory>step in the command runner stands in for the agent's file edit.swamp model validatePASSED →validate(2 saved scenarios passed) →new_key→start→statusatplan.The dogfood factory is not migrated; it gets reset after this lands.
🤖 Generated with Claude Code
A factory's globalArguments are { definition, tracker, scenarios }: the definition inline and checked by swamp against the factory type's schema, beside its tracker and its saved scenarios. factories/ and scenarios/ files, init, the embedded starters and definition_file.ts are removed. Every reader (validate, design_page, new_key, start, reset repin, claim) reads the raw model definition, in either the local or the remote-worker shape. The studio reads each factory's model definition file, with Copy reference naming globalArguments.definition paths. The skill's examples are definition and scenarios blocks the agent writes into a factory. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>