Reject invalid legacy release selectors
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Release tooling review findings
|
# Release tooling review findings
|
||||||
|
|
||||||
Status: two open findings. Review baseline:
|
Status: R1 complete; R2 open. Review baseline:
|
||||||
`124a9fa57fb3f815bedbafe2d4819f6aa265ee7d`, covering the implementation commits
|
`124a9fa57fb3f815bedbafe2d4819f6aa265ee7d`, covering the implementation commits
|
||||||
after `cb40f1d`. This record requests corrections; no implementation was changed
|
after `cb40f1d`. This record requests corrections; no implementation was changed
|
||||||
during review.
|
during review.
|
||||||
@@ -13,6 +13,13 @@ complete.
|
|||||||
|
|
||||||
## R1 — P2: Reject raw helper command names as legacy module selectors
|
## R1 — P2: Reject raw helper command names as legacy module selectors
|
||||||
|
|
||||||
|
**Completed.** The legacy entry point now checks its three module selectors
|
||||||
|
before delegating to the helper, retaining the single profile/module mapping
|
||||||
|
there. Regression cases cover all three raw-command collisions and require
|
||||||
|
usage status 2 with no Go invocation. The new regression failed before the fix;
|
||||||
|
the complete focused scripts suite and shell syntax checks passed afterward
|
||||||
|
with Go 1.26.8, including valid legacy and direct raw-command forwarding.
|
||||||
|
|
||||||
**Location:** [scripts/release](../../scripts/release), lines 9–10, delegating to
|
**Location:** [scripts/release](../../scripts/release), lines 9–10, delegating to
|
||||||
the first-argument dispatch in [scripts/releasekit](../../scripts/releasekit),
|
the first-argument dispatch in [scripts/releasekit](../../scripts/releasekit),
|
||||||
lines 10–15. The invalid-form cases in
|
lines 10–15. The invalid-form cases in
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [ "$#" -ne 2 ]; then
|
usage() {
|
||||||
printf '%s\n' 'usage: ./scripts/release MODULE VERSION' >&2
|
printf '%s\n' 'usage: ./scripts/release MODULE VERSION' >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
[ "$#" -eq 2 ] || usage
|
||||||
|
case "$1" in
|
||||||
|
core|ckconfig|ckprompt) ;;
|
||||||
|
*) usage ;;
|
||||||
|
esac
|
||||||
|
|
||||||
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
|
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
|
||||||
exec "$script_dir/releasekit" "$1" publish "$2"
|
exec "$script_dir/releasekit" "$1" publish "$2"
|
||||||
|
|||||||
@@ -187,7 +187,19 @@ func TestInvalidForms(t *testing.T) {
|
|||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
script string
|
script string
|
||||||
args []string
|
args []string
|
||||||
}{{"releasekit", nil}, {"releasekit", []string{"unknown"}}, {"releasekit", []string{"core"}}, {"releasekit", []string{"core", "version"}}, {"release", nil}, {"release", []string{"core"}}, {"release", []string{"core", "v1", "extra"}}, {"release", []string{"unknown", "v1"}}} {
|
}{
|
||||||
|
{"releasekit", nil},
|
||||||
|
{"releasekit", []string{"unknown"}},
|
||||||
|
{"releasekit", []string{"core"}},
|
||||||
|
{"releasekit", []string{"core", "version"}},
|
||||||
|
{"release", nil},
|
||||||
|
{"release", []string{"core"}},
|
||||||
|
{"release", []string{"core", "v1", "extra"}},
|
||||||
|
{"release", []string{"unknown", "v1"}},
|
||||||
|
{"release", []string{"version", "v1.2.3"}},
|
||||||
|
{"release", []string{"publication-attempts", "v1.2.3"}},
|
||||||
|
{"release", []string{"reconcile", "v1.2.3"}},
|
||||||
|
} {
|
||||||
f := newFixture(t)
|
f := newFixture(t)
|
||||||
_, stderr, status := f.run(t, tc.script, 0, tc.args...)
|
_, stderr, status := f.run(t, tc.script, 0, tc.args...)
|
||||||
if status != 2 || !strings.Contains(stderr, "usage:") {
|
if status != 2 || !strings.Contains(stderr, "usage:") {
|
||||||
|
|||||||
Reference in New Issue
Block a user