Skip to content

fix(plugin-sdk): stabilize tuple-derived API baseline ordering - #119635

Merged
steipete merged 1 commit into
mainfrom
codex/loc-0805-sdk-determinism-dmvazq
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-0805-sdk-determinism-dmvazq

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where maintainers making behavior-neutral plugin refactors can encounter false Plugin SDK API contract drift even though the public SDK has not changed. TypeScript 6.0.3 orders resolved union members by compiler-assigned type IDs, so discovering an unrelated literal earlier can change the printed order and hash of a tuple-derived public type.

Why This Change Was Made

Normalize numeric-indexed constant-tuple aliases at their API-baseline generator owner by printing string and numeric literal union members in declared tuple order. Preserve duplicate reduction, verify every constituent still matches the resolved union, and leave non-tuple or non-literal types on the existing checker path. TypeScript's hidden global stableTypeOrdering option is unsuitable because it changes established union spelling across the entire program and would require protected baseline churn. Simplifying the existing symbol-kind dispatch and declaration comparators keeps the generator at its existing 700-line limit, with only six net new production lines.

User Impact

Plugin authors and operators see no runtime, protocol, or public SDK API changes. Maintainers can refactor unrelated code without a spurious SDK contract failure caused solely by TypeScript traversal order. All 149 existing protected API baseline hashes and all 4,831 public SDK exports remain unchanged; no generated baseline, native relay, protocol, or public declaration was edited.

Evidence

  • pnpm test src/plugin-sdk/api-baseline.test.ts: 8/8 passed, including deterministic string and numeric literal prewarming regressions and duplicate tuple coverage.
  • pnpm plugin-sdk:api:check: all 149 existing docs/.generated/plugin-sdk-api-baseline.sha256 entrypoint hashes unchanged.
  • pnpm plugin-sdk:surface:check: unchanged 149 public entrypoints and 4,831 public exports, with zero forbidden subpaths.
  • pnpm check:changed: passed all core/core-test/plugin/plugin-test typechecks, dead-export and architecture guards, core lint, and lint across 8,213 plugin files.
  • Reviewed with a fresh independent gpt-5.6-sol/xhigh autoreview: clean, confidence 0.99.
  • Trusted Blacksmith Testbox proof: https://github.com/openclaw/openclaw/actions/runs/31009517597 (lease stopped and verified).
  • AI-assisted; production delta +6 lines, regression tests +56 lines, generator 700/700 effective lint lines.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 5, 2026
@steipete
steipete marked this pull request as ready for review August 5, 2026 13:56
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 5, 2026, 10:04 AM ET / 14:04 UTC.

ClawSweeper review

What this changes

The branch preserves declared tuple order when rendering string- and numeric-literal unions for Plugin SDK API-baseline hashes.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this maintainer-labeled PR open. Current main still has the traversal-dependent alias renderer; the branch adds a narrow, guarded normalization with focused regressions and no identified functional defect.

Priority: P3
Reviewed head: 10438d870035851a92f26ec58e5fa19f1d8d71c2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch and regression coverage are strong for a narrow internal determinism repair, with no actionable source finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-labeled internal tooling PR includes a linked Testbox validation run; the external-contributor real-behavior-proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labeled internal tooling PR includes a linked Testbox validation run; the external-contributor real-behavior-proof gate does not apply.
Evidence reviewed 5 items Current-main behavior: Current main renders type aliases directly through the TypeScript checker and does not contain the tuple-order normalization.
Narrow owner-boundary repair: The branch handles only direct numeric tuple indexing whose deduplicated elements exactly match a string/number literal union; every other alias uses the existing checker renderer.
Focused regression coverage: The added fixtures prewarm an unrelated literal and verify stable string, numeric, and duplicate tuple rendering.
Findings None None.
Security None None.

How this fits together

The Plugin SDK baseline generator reads public TypeScript declarations and serializes them into hashes that guard plugin API compatibility. This change affects only deterministic baseline rendering, not runtime plugin behavior or exported SDK surfaces.

flowchart LR
  A[Public SDK declarations] --> B[TypeScript checker]
  B --> C[Baseline generator]
  C --> D[Tuple literal ordering]
  D --> E[API baseline hashes]
  E --> F[Contract check]
Loading

Before merge

  • Add real behavior proof - Not applicable: This maintainer-labeled internal tooling PR includes a linked Testbox validation run; the external-contributor real-behavior-proof gate does not apply.
  • Resolve merge risk (P1) - The exact TypeScript 6.0.3 checker source was unavailable because dependencies are absent and upstream DNS failed, so its type-identity internals were not independently inspected; the narrow runtime guard and committed regression fixture mitigate this evidence gap.
  • Complete next step (P2) - No mechanical repair is needed; wait for the in-progress exact-head checks before ordinary maintainer handling.
Agent review details

Security

None.

PR surface

Source +6, Tests +56. Total +62 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 54 48 +6
Tests 1 56 0 +56
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 110 48 +62

Review metrics

Metric Value Why it matters
Production versus regression-test delta production +6 net, tests +56 The small production increase is justified by the deterministic API-baseline ownership boundary and is covered by focused regressions.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the generator-level normalization once the in-progress exact-head checks finish green, retaining the existing fallback for non-literal and non-tuple aliases.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the generator-level normalization once the in-progress exact-head checks finish green, retaining the existing fallback for non-literal and non-tuple aliases.

Do we have a high-confidence way to reproduce the issue?

Yes: the checked-in fixture creates separate TypeScript programs, prewarms an unrelated literal, and shows the direct tuple-derived alias path that the formatter stabilizes.

Is this the best way to solve the issue?

Yes: applying the ordering rule in the baseline generator is the narrowest canonical owner boundary; a compiler-wide ordering option would broaden output changes beyond the affected literal tuple aliases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 03a9e022ed83.

Labels

Label changes:

  • add P3: This is internal Plugin SDK baseline determinism maintenance with no runtime, configuration, or public API change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled internal tooling PR includes a linked Testbox validation run; the external-contributor real-behavior-proof gate does not apply.

Label justifications:

  • P3: This is internal Plugin SDK baseline determinism maintenance with no runtime, configuration, or public API change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled internal tooling PR includes a linked Testbox validation run; the external-contributor real-behavior-proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current patch and several prior Plugin SDK baseline-stabilization changes. (role: feature owner and recent area contributor; confidence: high; commits: c26655d3975f, 221f876c3f81, b0a2d0242777; files: src/plugin-sdk/api-baseline.ts, src/plugin-sdk/api-baseline.test.ts)
  • Vincent Koc: Authored the recent source-path and full-public-baseline improvements that shape this generator's compatibility contract. (role: historical area contributor; confidence: medium; commits: 41e56d56fcae, ddbec923d4ee; files: src/plugin-sdk/api-baseline.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 1b4a60b into main Aug 5, 2026
186 checks passed
@steipete
steipete deleted the codex/loc-0805-sdk-determinism-dmvazq branch August 5, 2026 14:15
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to VACInc/openclaw that referenced this pull request Aug 5, 2026
* origin/main: (130 commits)
  refactor(qa): consolidate scenario runtime helpers (openclaw#119623)
  fix(telegram): bind Mini App auth to dashboard launches
  refactor(agent-core): unify session projection and compaction summaries (openclaw#119639)
  fix(codex): allow natural reactions in the current conversation (openclaw#119649)
  refactor(providers): deduplicate bundled model catalogs (openclaw#119627)
  fix(ui): observe the active service worker after asset refresh (openclaw#119622)
  fix(agents): strip echoed base64 image payloads so photo-heavy turns no longer hit the per-turn output cap (openclaw#119488)
  improve: make state-heavy test suites faster (openclaw#119617)
  perf(agents): add concurrency benchmark (openclaw#119569)
  fix(browser): visibly report failed pairing and tab-sharing actions (openclaw#119526)
  refactor(lobster): consolidate embedded workflow execution (openclaw#119630)
  fix(plugin-sdk): stabilize tuple-derived API baseline ordering (openclaw#119635)
  docs(skills): make full-authority maintainer runs unattended (openclaw#119629)
  fix(managed-child): honor process groups that vanish before cleanup (openclaw#119614)
  fix(ci): stop label-driven automation churn (openclaw#119610)
  fix(media): keep the ttl sweep out of the managed outgoing tree (openclaw#119127)
  fix(claws): remove owner-qualified skills (openclaw#119606)
  fix(clawrouter): show stable error for malformed usage responses (openclaw#119580)
  fix(gateway): claim malformed plugin icon routes (openclaw#119559)
  fix(telegram): preserve truthful empty-content delivery (openclaw#88810)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant