Repository navigation
fix(file): Replace Read with ReadText/ReadBytes, fix Link param (#222) - #223
Merged
Merged
Conversation
…222) file.Provider.Read returned a Resource struct (metadata) but never read file content. Replace with ReadText (returns string) and ReadBytes (returns []byte), both backed by Resource.WriteTo. Also fixes a latent bug: the Link method's second parameter was renamed from "path" to "target" in Go but the generated params still used "path", causing Starlark callers to fail after regeneration. Additional changes: - Add Parameters/Returns doc comments to all Compensate* methods - Rename readlink → readLink for camelCase consistency - Update plan.source() to use file.read_text action - Commit completed structured-document-io plan (issue #218) - Update architecture docs for new Read path and migration tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #222 (partial — addresses the "Broken: Read returns Resource metadata, not file content" section).
Read → ReadText + ReadBytes
file.Provider.Readremoved. Replaced withReadText(Resource) → (string, error)andReadBytes(Resource) → ([]byte, error).readhelper that usesResource.WriteToto stream content into a*bytes.Buffer.plan.source()now wires tofile.read_text(wasfile.read).pathtoresourceto match the Go parameter name.Link param fix
Linkmethod's second Go parameter was renamedpath→targetin a prior commit, but the generatedparams.gen.gowas stale. Regeneration exposed the mismatch, causing allfile.linkStarlark calls to fail with "unexpected keyword argument path".target=.Doc compliance
Parameters:/Returns:sections to all 9Compensate*methods that were missing them.Linkdoc comment for clarity.readlink→readLink(camelCase consistency).Housekeeping
structured-document-ioplan (issue Consolidate code around coherent helpers/packages #218, PR refactor: Extract internal/document package, simplify manifest format (#218) #221) — was left untracked after merge.docs/architecture/4-resource-management.md: section 4.3 Read Path, migration status table, before/after signature table.Test plan
make vetpassesmake testpasses — all packages greenmake checkrequiresgolangci-lint)