feat(job): declarative YAML job files for named relspec workflows (#20) #24
Merged
warkanum
merged 1 commits from 2026-09-02 04:16:40 +00:00
issue-20-job-files into master
No Reviewers
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Low
4
The priority is low
Priority
Medium
3
The priority is medium
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
No labels
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: wdevs/relspecgo#24
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Implements issue #20: declarative YAML job files for named RelSpec workflows.
Adds
relspec job listandrelspec job run <name>so multi-file merge andconversion workflows are expressed in a
relspec.ymlmanifest instead of longshell command lines.
pkg/jobs/— side-effect-free discovery, parsing, validation and planning.cmd/relspec/job.go— thejobcommand tree and the vetted executionadapters (
convert,merge,scripts-list).docs/JOB_FILES.md— full contract and schema reference.examples/jobs/— runnable example project (relspec job list/run).jobsection.v1 contract
Not a shell.
commandis a closed allow-list —convert,merge,scripts-list. No field accepts a shell string, executable path or arbitraryarguments. New commands require a vetted adapter in source.
Discovery / precedence. No
--file: scan--dir(default.) forrelspec.yml/.yamlfirst, thenrelspec.<name>.yml/.yaml, each groupsorted lexically; order is stable across runs.
--file(repeatable) loadsexplicit files and skips discovery. All files merge into one namespace; a job
name defined by more than one file is a hard error naming both files.
Paths. Every path (
inputs[].path,output.path,script_dirs[],logfile) resolves relative to the directory of the job file that declared thejob — not the process CWD. Absolute,
~-relative and directory-escaping paths(
../,a/../../b) are rejected during validation, before anything runs.SafeJoinis the single choke point turning a manifest path into a filesystempath.
Credentials. Database inputs (
format: pgsql/mssql) and databaseexecution output (
format: pgsql+conn_env) reference an environmentvariable name via
conn_env:. Connection strings are never stored in themanifest; a
conn_envvalue that looks like a connection string is rejected.Missing env vars are reported during pre-flight. Logs and
--planshowenv:<NAME>; resolved secret values and connection-string passwords areredacted (
***) from the logfile and diagnostics.Validation before execution. Both
job listandjob runfully validatethe selected set first; nothing is read/written/connected/executed on failure.
Checks: schema
version== 1, unknown YAML fields, duplicate names acrossfiles, unknown/missing
command, per-command input/output shape(
convert≥1 input + output;merge≥2;scripts-listneedsscript_dirs,forbids inputs/output), unknown formats, path traversal,
depends_ontargetsexist, dependency cycles (reported
a -> b -> c -> a). Per-job pre-flight thenchecks input file existence, script-dir existence,
conn_envset, andoutput.pathoverwrite policy across the whole plan — if any check fails forany job, no job runs.
Execution / exit codes.
job run <name>runs thedepends_onclosure indeterministic topological order, then the job.
--no-depsruns only the namedjob.
--dry-run(alias--plan) prints the resolved plan and exits 0 withouttouching inputs/outputs/databases. A failing job returns the underlying
non-zero status (process exits 1), the error names the job, the logfile records
FAILED: <error>(neverOK), and no success-marker file is written.Acceptance coverage (issue #20)
TestDiscoverDeterministicOrderjob liststable names + source filesTestJobList_DeterministicOutputTestJobRun_ConvertMultiFileMergeTestLoadRejectsDuplicateJobAcrossFilesTestValidateUnknownCommand,TestValidateShellStringCommandRejectedTestValidateMissingInputs,TestJobRun_MissingInputNoExecutionTestValidatePathTraversalRejected,TestValidateOutputTraversalRejected,TestJobRun_ValidationFailureNoExecutionTestValidateUnknownFormatTestValidateDependencyCycleTestSafeJoinStaysInsideRoot+ CLI plan output (absolute paths rooted at fixture dir)TestJobLogger_Redaction,TestJobRun_ConnEnvRedactedInPlanTestJobRun_ExitCodePropagationTestJobRun_ConvertMultiFileMerge,examples/jobs/relspec.ymlTestJobRun_ScriptsListMultipleDirs,TestScriptsListValidationTestJobRun_DependencyChainExecutes,TestPlanTopologicalOrderTestJobRun_DryRunDoesNotExecuteconn_envreported pre-flightTestJobRun_MissingConnEnvNoExecutionTestShippedExampleIsValidVerification
gofmt -lon changed dirs — cleango vet ./...— cleango build ./...— okgo test ./...— all passgo test -race ./pkg/jobs/... ./cmd/relspec/...— all pass (17 + 11 new tests)git diff --check— cleanexamples/jobs/—job list,job run --plan,job run build-json(dependency chain),job run migration-order(scripts-list across 2 dirs) all behave as documented.
golangci-lintnot run: the installed binary is v1 but the repo config isv2 (pre-existing environment mismatch, unrelated to this change).
Limitations / deferred scope
scripts executeagainst a database from a job is deferred (needs livecredentials, not offline-testable);
relspec scripts executestill covers it.split,inspect,diff,templjob commands deferred.depends_ononly orders execution.filepath.Rel-based; symlink-escape hardening deferred.Refs #20
🤖 Generated with Claude Code