Skip to content

fix(build): Validate platform is arm64 or x86_64#535

Merged
ssiyad merged 1 commit into
developfrom
fix/builder/validate_platform
Jun 9, 2026
Merged

fix(build): Validate platform is arm64 or x86_64#535
ssiyad merged 1 commit into
developfrom
fix/builder/validate_platform

Conversation

@ssiyad

@ssiyad ssiyad commented Jun 8, 2026

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a runtime platform validation guard to ImageBuilder.__init__, raising ValueError for any value outside "arm64" and "x86_64", correctly ordered before self.platform is assigned.

  • The allowed values match the Literal["arm64", "x86_64"] annotation already on ContextManager, keeping the two classes consistent.
  • The platform parameter in __init__ is still annotated as str; narrowing it to the same Literal type would surface invalid call sites to the type checker.

Confidence Score: 5/5

The change is a small, focused guard in a constructor with correct ordering — validation before assignment — and allowed values consistent with the existing codebase.

The guard is placed correctly before self.platform is assigned, the allowed values match the Literal type already used in ContextManager, and no existing code paths are altered.

No files require special attention.

Important Files Changed

Filename Overview
agent/builder.py Adds a runtime guard in ImageBuilder.__init__ that raises ValueError when platform is not "arm64" or "x86_64", correctly placed before self.platform is assigned.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ImageBuilder.__init__ called] --> B{platform in 'arm64', 'x86_64'?}
    B -- No --> C[raise ValueError]
    B -- Yes --> D[self.platform = platform]
    D --> E[ContextManager created with platform]
    E --> F[docker buildx build --platform platform]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
agent/builder.py:523
The `platform` parameter is typed as `str`, but the guard restricts it to the same two values already expressed as `Literal["arm64", "x86_64"]` in `ContextManager` (line 117). Using the `Literal` type here lets the type checker catch bad call sites statically instead of only at runtime.

```suggestion
        platform: Literal["arm64", "x86_64"],
```

Reviews (2): Last reviewed commit: "fix(build): Validate platform is arm64 o..." | Re-trigger Greptile

Comment thread agent/builder.py Outdated
@ssiyad ssiyad force-pushed the fix/builder/validate_platform branch from 5413e55 to 904124b Compare June 8, 2026 17:58
@ssiyad ssiyad merged commit 37e2bcf into develop Jun 9, 2026
4 of 5 checks passed
@ssiyad ssiyad deleted the fix/builder/validate_platform branch June 9, 2026 05:04
ssiyad added a commit that referenced this pull request Jun 10, 2026
fix(build): Validate platform is arm64 or x86_64 (backport #535)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant