Skip to content

Windows build fails: internal/filetxn uses syscall.Stat_t without a Windows fallback #370

Open

Description

@barbatdev

Found during the manual verification of the directory-target mode (#363, check 9), from a clean checkout of tag v0.1.0-alpha.17 on Windows with go1.26.5 windows/amd64.

Problem

go build -o cortex.exe ./cmd/cortex fails on Windows:

# github.com/refactor-ia/cortex/internal/filetxn
internal\filetxn\directories.go:258:36: undefined: syscall.Stat_t
internal\filetxn\restart.go:406:35: undefined: syscall.Stat_t

internal/filetxn reads directory identity through info.Sys().(*syscall.Stat_t) (inode and device ID). That type does not exist on Windows, and the package has no build-constrained per-OS variant. Cross-compiling the same tag with GOOS=linux from Windows succeeds, so the failure is Windows-specific. Both call sites are still present on origin/main, plus two in restart_test.go.

Impact

Cortex cannot build natively on Windows. This pins the exact blocker for the Windows platform readiness gate (#332): the follow-up PowerShell smoke (install --target-dir + doctor) could not run either.

Expected direction

Extract the directory-identity read behind a build-tagged interface (a unix variant using syscall.Stat_t and a Windows variant using GetFileInformationByHandle or equivalent), or fall back to a portable identity source on Windows, so ./cmd/cortex builds on windows/amd64.

Refs #332 #363

Activity

  1. barbatdev commented on Oct 23, 2026

    @barbatdev
    ContributorAuthor

    Fleet issue review (glm)

    Recommendation: approve

    Precise build-breaker report: internal/filetxn uses syscall.Stat_t (unix-only) with no Windows build-constrained variant, so cmd/cortex does not build on windows/amd64. The compiler errors, call sites, and cross-compile control (GOOS=linux succeeds) are all stated. Acceptance is directly testable (go build succeeds on windows/amd64), scope is one identity-read abstraction, and every named path exists on the default branch.

    Item Pass Evidence
    clear problem yes go build -o cortex.exe ./cmd/cortex fails on windows/amd64 at internal/filetxn/directories.go:258 and restart.go:406 with undefined: syscall.Stat_t; package reads directory identity via info.Sys().(*syscall.Stat_t) with no per-OS variant.
    acceptance criteria present and testable yes Expected direction is testable: after extracting the identity read behind build-tagged variants (unix Stat_t vs Windows GetFileInformationByHandle or portable fallback), go build ./cmd/cortex succeeds under GOOS=windows/amd64; restart_test.go call sites also covered.
    scope bounded yes Single deliverable: one directory-identity read in internal/filetxn behind a build-tagged interface or portable fallback.
    no open questions yes Body gives problem, exact error output, impact (blocks #332 Windows readiness), and a concrete expected direction; comments empty.
    grounded in upstream yes All named paths exist on the default branch (verified with exists): internal/filetxn/directories.go, internal/filetxn/restart.go, internal/filetxn/restart_test.go, cmd/cortex.

    Juan merges; the fleet applies the status:approved label when a review recommends approve.

  2. barbatjuan commented on Oct 23, 2026

    @barbatjuan

    I'd like to take this one. I found it during the #363 verification and I'm on Windows 11 with go1.26.5 windows/amd64, so I can reproduce and test the fix natively.

    Plan: move the directory-identity read behind build-tagged variants (syscall.Stat_t on unix, GetFileInformationByHandle volume serial + file index on Windows), cover the restart_test.go call sites, and confirm go build ./cmd/cortex plus go test ./internal/filetxn/... pass on both windows/amd64 and linux.

    Could you assign it to me? If it's already in progress on your side, no problem, I'll pick another one.

  3. barbatdev commented on Oct 23, 2026

    @barbatdev
    ContributorAuthor

    Assigned to you, and the issue is approved. Go ahead with the plan: build-tagged directory identity (unix Stat_t vs GetFileInformationByHandle), coverage for the restart_test.go call sites, and green build/tests on both windows/amd64 and linux. Open a PR off main referencing this issue (issue-first; Fixes #370 on its own line in the PR body, the CI validates that format) and we review from there.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingstatus:approvedApproved for implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions