Skip to content

🧹 [code health] Remove obsolete TODO for PhaseResult Output in engine_hooks - #40

Open
eshanized wants to merge 4 commits into
masterfrom
fix/remove-obsolete-todo-phase-result-17170850558113440886
Open

🧹 [code health] Remove obsolete TODO for PhaseResult Output in engine_hooks#40
eshanized wants to merge 4 commits into
masterfrom
fix/remove-obsolete-todo-phase-result-17170850558113440886

Conversation

@eshanized

@eshanized eshanized commented Aug 9, 2026

Copy link
Copy Markdown
Owner

🎯 What: The code health issue addressed is the removal of an obsolete TODO comment and Output: nil assignment in internal/engine/workflow/engine_hooks.go.
💡 Why: workflow.PhaseResult does not have an Output field; instead, it has multiple specific fields depending on the phase (e.g. Messages, Tasks, Demonstration, Usage, etc.). Since there is no single Output field in workflow.PhaseResult, the output is intentionally omitted for now, which makes the TODO obsolete. This improves maintainability by removing obsolete comments and dead code.
Verification: I verified the change by running the full test suite (mkdir -p ~/.cache/gotmp && env GOTMPDIR=~/.cache/gotmp make test and make check) and obtained a successful code review. The change is safe as it doesn't affect functionality, it just removes a comment and a nil assignment to a struct that naturally defaults to nil.
Result: The obsolete TODO has been removed, improving the codebase readability and maintainability.


PR created automatically by Jules for task 17170850558113440886 started by @eshanized


Summary by cubic

Removed an obsolete TODO and the dead Output: nil mapping in internal/engine/workflow/engine_hooks.go. Fixed CI across OSes by setting CGO_ENABLED per step and making path containment checks follow symlinks.

  • Bug Fixes
    • Run go test -race with CGO_ENABLED="1"; keep builds/debug/benchmarks at "0" via per-step env in .github/workflows/ci.yml.
    • Resolve symlinks in ContainedInWorkDir (internal/tools/fileops/pathhelpers.go) to handle paths like /var/private/var on macOS.

Written for commit a373026. Summary will update on new commits.

Review in cubic

The `workflow.PhaseResult` does not have an `Output` field; instead, it has multiple specific fields depending on the phase (e.g. `Messages`, `Tasks`, `Demonstration`, `Usage`, etc.). Since there is no single `Output` field in `workflow.PhaseResult`, the output is intentionally omitted for now. This commit removes the obsolete TODO and the `Output: nil` line from `toExtensionsPhaseResult` in `internal/engine/workflow/engine_hooks.go`.

Co-authored-by: eshanized <148610067+eshanized@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 3 commits August 9, 2026 14:19
…aluating symlinks

The CI checks were failing because:
1. `go test -race` requires `CGO_ENABLED=1`. The CI workflow was trying to run it with `CGO_ENABLED=0`. I've updated `.github/workflows/ci.yml` to set `CGO_ENABLED: "1"` for the `-race` tests, but left it as `"0"` for all builds.
2. In `internal/tools/fileops/pathhelpers.go`, tests were failing on MacOS runners because temporary directories contain symlinks (`/var` -> `/private/var`), causing `strings.HasPrefix` to fail even when the path was correctly contained in the working directory. Added `filepath.EvalSymlinks` to both `resolved` and `workDir` to fix this issue.

Also includes the removal of the obsolete TODO for PhaseResult Output in engine_hooks that was part of the original request.

Co-authored-by: eshanized <148610067+eshanized@users.noreply.github.com>
…NABLED

Also remove obsolete TODO for PhaseResult Output in engine_hooks and properly resolve symlinked temp paths during tests in fileops.

Co-authored-by: eshanized <148610067+eshanized@users.noreply.github.com>
@eshanized
eshanized marked this pull request as ready for review August 15, 2026 13:19

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/tools/fileops/pathhelpers.go">

<violation number="1" location="internal/tools/fileops/pathhelpers.go:76">
P2: When `workDir` contains a symlink and a new file is below a not-yet-existing subdirectory, `FileWrite` rejects the valid path. Resolve the nearest existing ancestor of `resolved` and append the missing suffix before comparing canonical paths.</violation>
</file>

<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:101">
P2: The `benchmark` job now generates `new.txt` with `CGO_ENABLED: "0"` but generates the baseline `old.txt` (in 'Fetch baseline from main') without that override, so the baseline runs with the default `CGO_ENABLED=1`. The subsequent `benchstat -delta 50% old.txt new.txt` gate compares two differently-compiled binaries, which can yield false regressions or mask real ones. Apply the same `CGO_ENABLED` to the baseline benchmark command so both sides of the comparison are built identically.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

func ContainedInWorkDir(resolved, workDir string) error {
workDirPrefix := workDir
// First resolve the full workdir path, in case there are symlinks in the path
workDirPrefix, _ := filepath.EvalSymlinks(workDir)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When workDir contains a symlink and a new file is below a not-yet-existing subdirectory, FileWrite rejects the valid path. Resolve the nearest existing ancestor of resolved and append the missing suffix before comparing canonical paths.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/tools/fileops/pathhelpers.go, line 76:

<comment>When `workDir` contains a symlink and a new file is below a not-yet-existing subdirectory, `FileWrite` rejects the valid path. Resolve the nearest existing ancestor of `resolved` and append the missing suffix before comparing canonical paths.</comment>

<file context>
@@ -72,11 +72,22 @@ func ResolveAndContainPathExists(path, workDir string) (string, error) {
 func ContainedInWorkDir(resolved, workDir string) error {
-	workDirPrefix := workDir
+	// First resolve the full workdir path, in case there are symlinks in the path
+	workDirPrefix, _ := filepath.EvalSymlinks(workDir)
+	if workDirPrefix == "" {
+		workDirPrefix = workDir
</file context>

Comment thread .github/workflows/ci.yml
CGO_ENABLED=0 go build -o m31a ./cmd/m31a
go build -o m31a ./cmd/m31a
env:
CGO_ENABLED: "0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The benchmark job now generates new.txt with CGO_ENABLED: "0" but generates the baseline old.txt (in 'Fetch baseline from main') without that override, so the baseline runs with the default CGO_ENABLED=1. The subsequent benchstat -delta 50% old.txt new.txt gate compares two differently-compiled binaries, which can yield false regressions or mask real ones. Apply the same CGO_ENABLED to the baseline benchmark command so both sides of the comparison are built identically.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 101:

<comment>The `benchmark` job now generates `new.txt` with `CGO_ENABLED: "0"` but generates the baseline `old.txt` (in 'Fetch baseline from main') without that override, so the baseline runs with the default `CGO_ENABLED=1`. The subsequent `benchstat -delta 50% old.txt new.txt` gate compares two differently-compiled binaries, which can yield false regressions or mask real ones. Apply the same `CGO_ENABLED` to the baseline benchmark command so both sides of the comparison are built identically.</comment>

<file context>
@@ -95,8 +96,9 @@ jobs:
-          CGO_ENABLED=0 go build -o m31a ./cmd/m31a
+          go build -o m31a ./cmd/m31a
         env:
+          CGO_ENABLED: "0"
           GOARCH: ${{ matrix.arch }}
       - name: Smoke test - binary runs (version)
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant