Skip to content

Write binary text to a buffer writer - #141

Merged
polewskm merged 25 commits into
mainfrom
worktree-issue-140
Nov 29, 2026
Merged

polewskm merged 25 commits into
mainfrom
worktree-issue-140

Conversation

@polewskm

@polewskm polewskm commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds BinaryTextEncoding.WriteEncoded and WriteDecoded, which write encoded text or decoded bytes in every BinaryTextFormat, from a span or a ReadOnlySequence<T>, with one GetSpan and one Advance, and return the number of elements written. They write to a caller's IBufferWriter<T>, or, through a generic ref TWriter overload constrained allows ref struct, to a writer of any type: a ref struct such as FixedSpanBufferWriter<T>, a mutable struct, or a stackalloc span through GetFixedBufferWriter().

  • Each method checks the writer, then the format, before it rents anything or asks the writer for memory. A failed decode throws FormatException with RentDecoded's messages, leaves the writer unadvanced, and zeroes the whole span the writer handed out.
  • ADR-1034 makes "the public API takes every kind of memory destination, ref structs included" a rule. Following it, Secret.Create<T, TState> takes a ref struct state, such as a ReadOnlySpan<T>, and PooledTextBuilder.Append<T> formats a ref struct value. AGENTS.md names ADR-1034 under Conventions.
  • ADR-1033 records the writer methods, amends ADR-1027, and follows ADR-1034. Tests cover every format with span, single-segment and one-element-segment input, class, struct and ref struct writers, every failure and every argument check.
  • The README, the encode-a-secret guide, its site sample and the API map show the new methods. Releases as 5.6.0.

Protected paths changed:
AGENTS.md

Release: v5.6.0
Closes #140

@polewskm polewskm self-assigned this Nov 29, 2026
@polewskm
polewskm marked this pull request as ready for review November 29, 2026 16:01
@polewskm
polewskm deployed to code-review November 29, 2026 16:01 — with GitHub Actions Active
Comment thread src/NCode.Buffers/BinaryTextEncoding.cs Resolved

@ncode-review ncode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 NCode Review at bd5641d: 6 new findings on the changed lines.

Comment thread src/NCode.Buffers/PublicAPI.Shipped.txt Resolved
Comment thread src/NCode.Buffers/BinaryTextEncoding.cs Resolved
@ncode-review

ncode-review Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Superseded by the review at d50634d.

@polewskm

Copy link
Copy Markdown
Contributor Author

/review

@ncode-review

ncode-review Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Superseded by the review at d50634d.

@polewskm

Copy link
Copy Markdown
Contributor Author

/review

@ncode-review ncode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 NCode Review at d50634d: 5 new findings on the changed lines.

Comment thread src/NCode.Buffers/PublicAPI.Shipped.txt Resolved
Comment thread src/NCode.Buffers/BinaryTextEncoding.cs Resolved
Comment thread src/NCode.Buffers/Secret.cs Resolved
Comment thread src/NCode.Buffers/BinaryTextEncoding.cs Resolved

@ncode-review-approver ncode-review-approver Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved at d50634d: no blocker or should-fix finding remains.

@ncode-review

ncode-review Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Superseded by the review at 0c91d11.

@polewskm

Copy link
Copy Markdown
Contributor Author

/review

@ncode-review-approver ncode-review-approver Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved at 0c91d11: no blocker or should-fix finding remains.

@ncode-review

ncode-review Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🤖 Review complete

Verdict: ✅ Approve — Re-review of what changed since the last review at d50634d: 2 hunks in 2 files and changes taken back in 2 files, by correctness only. Earlier findings: F1 answered, F2 answered, F3 answered, F4 fixed, F5 fixed. No further findings above nits.

Approval: Approved — no blocker or should-fix finding remains.

1 reviewer run — 0 findings (run details)

Reviewer Model Findings Top
correctness sonnet-5-5 0 🟢

Trial: findings are posted as review threads and in the check run. $0.08 on Amazon Bedrock, 12s, at 0c91d11. (how to interact)

📋 Outcomes

Merged at 0c91d11: 7 fixed, 4 dismissed, 0 acknowledged, 0 ignored.

Finding Reviewer Severity Outcome
F1 at bd5641d hygiene, intent, completeness 🟠 Should fix 👎 dismissed
F2 at bd5641d conventions, rule-check 🟡 Nit ✅ fixed
F3 at bd5641d rule-check 🟡 Nit ✅ fixed
F4 at bd5641d rule-check 🟡 Nit ✅ fixed
F5 at bd5641d conventions, rule-check 🟡 Nit ✅ fixed
F6 at bd5641d rule-check 🟡 Nit ✅ fixed
F1 at d50634d hygiene, api-compat, rule-check 🟡 Nit 👎 dismissed
F2 at d50634d intent 🟡 Nit 👎 dismissed
F3 at d50634d completeness 🟡 Nit 👎 dismissed
F4 at d50634d rule-check 🟡 Nit ✅ fixed
F5 at d50634d rule-check 🟡 Nit ✅ fixed

@polewskm
polewskm merged commit 0ccf847 into main Nov 29, 2026
15 checks passed
@polewskm
polewskm deleted the worktree-issue-140 branch November 29, 2026 16:42
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.

BinaryTextEncoding writes encoded and decoded output to an IBufferWriter<T>

1 participant