Skip to content

M6 (opportunistic earlier): hygiene sweep — reuse/simplification/tooling-perf leftovers (R1-R3 R5 R6, S1-S8, P6 P7) #24

Description

@Blind-Striker

Source: multi-agent review of PR #16; all R/S items UNVERIFIED-FINDER (maintenance/drift observations), P6/P7 CONFIRMED tooling-only. 2026-08-13. M-anchor: swept opportunistically whenever a listed file is touched (most live in binder/emitters M2 reworks anyway); anything still open at M6 operational closure is resolved there — nothing on this list survives the M series.

Reuse / drift:

  • R1 compile probe re-types the provenance header (tests/OpenCode.Sdk.Tools.Tests/Support/GeneratedSourceCompiler.cs:50-53) instead of GenerationProvenance.HasHeader → wording change causes false duplicate-type reds. Use the shared helper (or a shared byte/span helper).
  • R2 PipelineTests reimplements UserAgentPolicy.Compose (PipelineTests.cs:307-315) — derive expectations through the policy; keep one metadata-integration test.
  • R3 Basic-auth tests rebuild the header with hard-coded opencode (PipelineTests.cs:52,69) vs Pipeline.BasicUser — centralize the expected wire credential in a test contract constant/builder; do not expose production privates solely for tests.
  • R5 nullable readonly field emission duplicated (ClientEmitter.cs:99-105, EnvelopeEmitter.cs:53-60) → EmissionSyntax if both stay structurally identical.
  • R6 SchemaNameResolver reparses GraphKeyBuilder.UnionBranch's marker=value format ad hoc with silent whole-token fallback (SchemaNameResolver.cs:102-113) → centralize branch-key format/parse; refuse malformed identities.

Simplification (maintainer picks scope; none delays correctness):

  • S1 one-field PendingOperationPlan → IReadOnlyList<string> · S2 primary-ctor mirror fields (OperationPlanBinder.cs:200-207) · S3 RefuseNull/RefuseNullTags → one generic (:529-539) · S4 unused client param in EmitPipelineAssignments (ClientEmitter.cs:194-204) · S5 unused client in EmitHandleFactory (:283-307) · S6 duplicated ctor guard/assignment syntax (:181-230) · S7 stored IsHandleOperation derivable from Plan.Parameters (OperationPlanBinder.cs:186-197,237) · S8 constant ClientPlan.Namespace (ClientPlan.cs:7).

Tooling perf (speed matters in tooling — standing posture; fix when in the file):

  • P6 GenerationWriter triple-reads every owned file + whole-file HasHeader split + repeated ResolveOwnedPath normalization (GenerationWriter.cs:40,48,57,250) → fold provenance into the before-snapshot read, span header compare, cache validated paths per run.
  • P7 WriteSourcesAsync copies every ReadOnlyMemory<byte> via ToArray() (:149) before the formatter rewrites files → stream/memory write seam on IFileSystem; only skip formatting with proof of canonical bytes.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentSpecified enough that the work is mechanical

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions