Skip to content

refactor(file): the resource is a sealed interface named Resource - #624

Merged
David-Noble-at-work merged 5 commits into
developfrom
any-entry-claims
Aug 23, 2026
Merged

David-Noble-at-work merged 5 commits into
developfrom
any-entry-claims

Conversation

@David-Noble-at-work

@David-Noble-at-work David-Noble-at-work commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Phase 1 of any-entry-claims.md. Closes #617. Feature: #616.

The file provider's resource is now a sealed interface named Resource.

Before After
file.Entry (interface) file.Resource
file.Resource (exported base struct) file.resource (unexported)
sealedEntry() sealedResource()
EntryKind / EntryKindEntry ResourceKind / ResourceKindAny
kind="entry" kind="any"
— file.Any — the unasserted claim

Two changes in one, because they are one thought.

The unasserted claim. file.Any asserts existence and nothing else — what a kind-indifferent
operation needs, since a move moves whatever is there and the author should not have to name a kind the
operation does not care about. Its predicate is lstat plus "any taxonomy kind admits": a dangling
symbolic link counts (the link is the entry, and a following stat would wrongly call it absent), and a
FIFO does not (no variant could resolve to it). Digest/Etag delegate to the observed kind, so an
unasserted claim does not silently lose drift detection while it is unresolved.

The naming. Every other resource-bearing provider names its type Resource; file named its
interface Entry, which made it the one provider a newcomer has to learn an exception for. It is now
Resource — an interface rather than a struct, because file has a kind axis — and the base beneath it
is the unexported resource, unnameable and un-hand-buildable outside the package. That also makes file
the template for #625, where the other nine providers adopt the same sealed shape for correctness
reasons.

The generator needed no prompting throughout: a resource type is identified by an exported
func(*op.RuntimeEnvironment, any) (*T, error) constructor, so any.gen.go was emitted automatically —
and the base stays unannounced precisely because it has no such constructor, which is what makes hiding
it possible at all.

The finding — this was expected to be behavior-neutral and was not. Unexporting the base silently
removed every promoted field from the Starlark surface; TestLintCopyright caught it with
"Regular" object has no attribute "source_path". The bridge's collectFieldInfo skipped all
unexported fields, anonymous ones included, so an unexported embed took its whole field set out of the
attribute surface.

Fixed at the bridge rather than by re-exporting the base, because the bridge was the thing that was
wrong: the attribute surface should mirror Go's promotion rules, under which outer.Field resolves
through an unexported embed. Verified empirically before writing the fix — reflection's read-only flag,
which blocks reads through an unexported NAMED field, is deliberately not set for an anonymous one, so
the promoted value is readable (CanInterface() == true). Pinned in go_receiver_test.go.

Three consumers outside the package follow the rename (archive, its test, starcode), and two named
returns stopped shadowing the new lowercase type. File moves went through git mv, so history follows.

Gate: make test 103 ok / 0 fail; make vet clean under darwin, windows, and linux; gofmt -l clean.

@David-Noble-at-work David-Noble-at-work self-assigned this Aug 23, 2026
@David-Noble-at-work David-Noble-at-work changed the title docs(plan): AnyEntry claims; the resource-construction campaign converges feat(file): the taxonomy reshape -- unexported base, AnyEntry variant Aug 23, 2026
@David-Noble-at-work David-Noble-at-work changed the title feat(file): the taxonomy reshape -- unexported base, AnyEntry variant refactor(file): the resource is a sealed interface named Resource Aug 23, 2026
@David-Noble-at-work
David-Noble-at-work merged commit 9425d29 into develop Aug 23, 2026
8 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the any-entry-claims branch August 23, 2026 22:43
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.

The taxonomy reshape: unexported base, AnyEntry variant

1 participant