refactor(agentic): improve AX naming and context propagation

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 06:10:33 +00:00
parent 652548a60a
commit 9a8aa2bfac
4 changed files with 18 additions and 18 deletions

View file

@ -90,7 +90,7 @@ func parseForgeArgs(options core.Options) (org, repo string, num int64) {
return
}
func fmtIndex(n int64) string { return strconv.FormatInt(n, 10) }
func formatIndex(n int64) string { return strconv.FormatInt(n, 10) }
// c.Command("issue/get", core.Command{Description: "Get a Forge issue", Action: s.cmdIssueGet})
// c.Command("pr/merge", core.Command{Description: "Merge a Forge PR", Action: s.cmdPRMerge})

View file

@ -13,7 +13,7 @@ func Example_parseForgeArgs() {
// Output: core go-io 42
}
func Example_fmtIndex() {
core.Println(fmtIndex(42))
func Example_formatIndex() {
core.Println(formatIndex(42))
// Output: 42
}

View file

@ -54,13 +54,13 @@ func TestCommandsforge_ParseForgeArgs_Bad_InvalidNumber(t *testing.T) {
assert.Equal(t, int64(0), num, "invalid number should parse as 0")
}
// --- fmtIndex ---
// --- formatIndex ---
func TestCommandsforge_FmtIndex_Good(t *testing.T) {
assert.Equal(t, "1", fmtIndex(1))
assert.Equal(t, "42", fmtIndex(42))
assert.Equal(t, "0", fmtIndex(0))
assert.Equal(t, "999999", fmtIndex(999999))
func TestCommandsforge_FormatIndex_Good(t *testing.T) {
assert.Equal(t, "1", formatIndex(1))
assert.Equal(t, "42", formatIndex(42))
assert.Equal(t, "0", formatIndex(0))
assert.Equal(t, "999999", formatIndex(999999))
}
// --- parseForgeArgs Ugly ---
@ -84,20 +84,20 @@ func TestCommandsforge_ParseForgeArgs_Ugly_NegativeNumber(t *testing.T) {
assert.Equal(t, int64(-5), num, "negative numbers parse but are semantically invalid")
}
// --- fmtIndex Bad/Ugly ---
// --- formatIndex Bad/Ugly ---
func TestCommandsforge_FmtIndex_Bad_Negative(t *testing.T) {
result := fmtIndex(-1)
func TestCommandsforge_FormatIndex_Bad_Negative(t *testing.T) {
result := formatIndex(-1)
assert.Equal(t, "-1", result, "negative should format as negative string")
}
func TestCommandsforge_FmtIndex_Ugly_VeryLarge(t *testing.T) {
result := fmtIndex(9999999999)
func TestCommandsforge_FormatIndex_Ugly_VeryLarge(t *testing.T) {
result := formatIndex(9999999999)
assert.Equal(t, "9999999999", result)
}
func TestCommandsforge_FmtIndex_Ugly_MaxInt64(t *testing.T) {
result := fmtIndex(9223372036854775807) // math.MaxInt64
func TestCommandsforge_FormatIndex_Ugly_MaxInt64(t *testing.T) {
result := formatIndex(9223372036854775807) // math.MaxInt64
assert.NotEmpty(t, result)
assert.Equal(t, "9223372036854775807", result)
}

View file

@ -308,7 +308,7 @@ func (s *PrepSubsystem) handleContentFromPlan(ctx context.Context, options core.
// core.Option{Key: "title", Value: "Set up the workspace"},
//
// ))
func (s *PrepSubsystem) handleContentSchemaGenerate(_ context.Context, options core.Options) core.Result {
func (s *PrepSubsystem) handleContentSchemaGenerate(ctx context.Context, options core.Options) core.Result {
input := ContentSchemaInput{
Type: optionStringValue(options, "schema_type", "schema-type", "type", "kind"),
Title: optionStringValue(options, "title", "headline"),
@ -327,7 +327,7 @@ func (s *PrepSubsystem) handleContentSchemaGenerate(_ context.Context, options c
input.Steps = contentSchemaStepsValue(value)
}
_, output, err := s.contentSchemaGenerate(context.Background(), nil, input)
_, output, err := s.contentSchemaGenerate(ctx, nil, input)
if err != nil {
return core.Result{Value: err, OK: false}
}