CLI task create/fork: check payload task_env locally and tidy up the --env check
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with orcaster/cmd/task.go at buildTaskBody, runTaskCreate, and runTaskFork, then read the existing environment validators and server/tests/test_env_names_parity.py. Trace how Run in orcaster/cmd/root.go captures errors and requests, and use the shared fixture in Go and Python tests. Done means the acceptance criteria pass, including the CHANGELOG and README updates.
Written by the indexing model from the issue text.
Description
Problem
orcaster task create and orcaster task fork check each --env entry locally before any request (orcaster/cmd/task.go:802-807, task.go:865-884). Some gaps remain.
task_envinside--payloadis not checked.buildTaskBodyvalidates only the--envlist (task.go:805). A credential typed in the payload, for example--payload '{"task_env":["NAME=value"]}', is sent to the server. The server answers 422 and does not echo it, but the value has already left the machine. The CLI README documents this as a known gap (orcaster/README.md:332-336).--envsilently replaces the payload list. When both are given,pm["task_env"] = p.taskEnvoverwrites the payloadtask_envwith no message (task.go:824-826).task createaccepts stray positional arguments.taskCreateCmdhas noArgs(task.go:96-100).--env NAME value(a value typed after the name) creates the task withNAME, ignoresvalueand exits 0.cobra.NoArgsis not a safe fix, because its error message repeats the argument.- The profile is loaded before the flags are checked.
runTaskCreateandrunTaskForkcallnewClient()beforebuildTaskBody(task.go:401-409,task.go:427-435). With no active profile, an invalid--envreports the profile error first. - The
--envhelp does not say how to get an empty strict list.--env ''fails the name check, sotask_env: []is only possible through--payload. The help text (task.go:176) does not say this. The comment "A PRESENT flag (even empty)" (task.go:809-810) is not accurate for--env. - Nothing keeps the Go rules equal to the server rules. The Go regexes (
task.go:847-854) mirror the server ones, and their comment still points to an old path (task.go:842-843).server/tests/test_env_names_parity.pycompares the server with the worker, not with the CLI.orcaster/cmd/secret.go:127reuses the same token-prefix rule for secret names.
The task_env count and length bounds in the CLI are tracked in a separate issue.
Proposed change
- Run
validateTaskEnvEntriesonpayload.task_envwhen it is a list of strings. Report the position aspayload.task_env[N], counted from 0 like the server. Never print the entry. - Handle
--envtogether with a payloadtask_envas decided in the open question below. - Add an
Argsfunction totaskCreateCmdthat rejects positional arguments with a fixed message, for exampletask create takes no positional arguments; did you mean --env NAME?. It never prints the argument. - Call
buildTaskBodybeforenewClient()in both commands. - Add to the
--envhelp: use--payload '{"task_env":[]}'for an explicit empty list. Fix the comments attask.go:809-810andtask.go:842-843. - Add one shared fixture of entries with the expected result (
ok,token,name,orch). Run it from a Go test againstvalidateTaskEnvEntriesand the secret-name check, and from a Python test against the server validators. - Add tests through
Run(orcaster/cmd/root.go:48-65) that assert exit code 1, theerror: ...line on stderr and zero requests. - Update
orcaster/README.md:325-340.
Compatibility
- Every request that the server accepts today is still sent unchanged, as long as only one of
--envand a payloadtask_envis given. - New local errors replace a server 422 that the same command already gets today: invalid payload entries, and positional arguments on
create(which the CLI ignores today). - The only possible break is a script that passes both
--envand a payloadtask_envand relies on--envwinning. See the open question.
Acceptance criteria
-
orcaster task createandorcaster task forkwith--payload '{"task_env":["NAME=value"]}'exit 1, send no request and print no part of the entry. - A valid payload
task_envwithout--envis sent unchanged. -
--envplus a payloadtask_envfollows the decided behavior, with a test. -
orcaster task create --payload '{}' --env NAME valueexits 1, sends no request and does not printvalue. - With no active profile, an invalid
--envor payloadtask_envreports the flag error, not the profile error. - The
--envhelp explains the empty list, and the comments intask.goare correct. - A shared fixture passes in the Go and the Python suites. Changing one regex on either side makes a suite fail.
- Tests through
Runcover the stderr line and exit code 1. - Existing scripts that use
--payloador--envalone keep working without changes. - CHANGELOG entry under Unreleased.
Open questions
--envtogether with a payloadtask_env:- Option A: print a warning to stderr and keep
--envwinning. Existing scripts keep working. The warning is easy to miss in logs. - Option B: exit with an error. Two sources for one field cannot be missed. It breaks scripts that rely on the override, so it needs a CHANGELOG note, or a warning for one release first.
Option A keeps existing deployments and scripts working.
- Option A: print a warning to stderr and keep
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
daniel-ospina/tortoise#15308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day