Skip to content

refactor(ios): reuse shared integer conversion - #139581

Merged
steipete merged 1 commit into
mainfrom
codex/refactor-ios-integer-readers
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refactor-ios-integer-readers

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Automation schedules and usage totals had separate copies of numeric-to-integer conversion, despite an existing shared accessor. Both copies also converted finite floating-point values through a non-failable initializer.

Why This Change Was Made

Use AnyCodable.intValue in both model readers and retain their small raw integer-string adapters. Numeric conversion stays with its existing shared owner; automation and usage retain their own model and missing-value handling. The two duplicate numeric switches are removed, reducing production code by nine lines.

User Impact

Ordinary integer values, integer strings and absent optional values keep their existing behavior. The numeric policy change is explicit: fractional numeric values now yield no value instead of being truncated. Current and stable cron schemas require integers, and the usage producer normalizes token counts before aggregation. Historical Gateway versions and arbitrary old caches are not claimed to be exhaustively compatible.

The shared accessor, Gateway schema, configuration and persistence behavior are unchanged. No visual layout changes.

Evidence

  • Full signed iOS app/test build passed with Xcode 26.6, including the normal embedded Watch dependency. Host and test bundle signatures were verified before launch.
  • Fresh test enumeration selected exactly four model methods, and authoritative results show 4 passed, zero failures and zero skips. They cover six decoded schedule rows, four decoded usage rows, and existing update/no-op behavior. The rows are not counted as separate tests.
  • All 13 changed-file checks passed, alongside scoped formatting and strict source lint. The initial test-table wrapping finding was fixed with the pinned formatter; no production or assertion change was needed.
  • Independent peer and both managed source-review passes found no actionable defect. They explicitly considered the accepted numeric-policy narrowing and preserved string handling.

Proof used one new iPhone 17/iOS 26.5 simulator with ad-hoc-signed products. The simulator is deleted; existing simulator and operator state were preserved. Coverage is ordinary model behavior, not a crash or out-of-range reproduction.

Four files: production +3/−12 (−9), tests +43/−9 (+34). Exact-head CI passed: nine jobs succeeded, 24 were skipped, and none failed. The latest exact-head ClawSweeper review has no actionable findings or rank-up requests.

Use the existing exact numeric accessor for automation and usage models,
preserving raw integer strings and missing-value outcomes. Numeric fractions
now remain unavailable instead of truncating, consistent with the inspected
cron and token producer contracts. The shared accessor and wire schema stay
unchanged, and both duplicate numeric switches are removed.

Full signed iOS app/test compilation, four ordinary model tests, thirteen
changed checks, and independent source reviews pass. Production net -9 LOC.
@steipete steipete self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: ios App: ios size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 9:54 PM ET / September 6, 2026, 01:54 UTC.

ClawSweeper review

What this changes

The iOS automation and usage readers reuse shared exact integer conversion, preserve integer strings and missing values, and expand model-decoding coverage.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused refactor: current main retains both duplicate conversions, and no actionable introduced defect was found. The documented rejection of fractional values agrees with the inspected producer contracts.

Priority: P3
Reviewed head: f6ed66eb7fcd2dd233d6bf306d630d3371e918ba

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused refactor with useful model coverage, explicit behavior tradeoffs, and no actionable correctness or security findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Reported signed simulator model tests cover ordinary decoding and update behavior, not a live Gateway flow or overflow reproduction; no authority boundary changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Reported signed simulator model tests cover ordinary decoding and update behavior, not a live Gateway flow or overflow reproduction; no authority boundary changes.
Evidence reviewed 8 items Introduced production changes: The pinned merge-base comparison changes only the two numeric adapters and adds the existing OpenClawKit import; string parsing remains failable and untrimmed.
Existing shared conversion contract: The shared accessor uses Int(exactly:) for binary integers and floating-point values. Existing shared tests cover fractions, integer overflow, infinity, and booleans. This is an OpenClawKit implementation within the target repository; no Codex dependency contract is involved.
Automation producer contract: The inspected protocol schema defines interval, anchor, stagger, next-run, last-run, and duration fields as integers. Caller inspection also covered schedule summaries, automation ordering, and state timestamp display.
Findings None None.
Security None None.

How this fits together

The iOS app decodes Gateway automation schedules, run timestamps, and usage totals into models used by its automation editor and overview screens. Shared integer conversion determines which numeric values those models can safely display or edit.

flowchart LR
  A[Gateway automation data] --> C[iOS model readers]
  B[Gateway usage totals] --> C
  C --> D[Shared exact integer conversion]
  C --> E[Integer string parsing]
  D --> F[Optional integer values]
  E --> F
  F --> G[Automation and usage screens]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other +25. Total +25 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 46 21 +25
Total 4 46 21 +25

Review metrics

None.

Technical review

Best possible solution:

Keep numeric conversion with the shared exact accessor and retain model-local integer-string parsing and missing-value handling.

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

Not applicable to the refactor itself; the conversion difference is clear from source, but no current-main crash was reproduced or claimed.

Is this the best way to solve the issue?

Yes. Reusing the existing exact conversion owner removes duplication while the thin adapters preserve integer strings; inspected callers and producer contracts support the intentional fractional-value rejection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b8731bc88a7c.

Labels

Label justifications:

  • P3: This is bounded internal cleanup with preserved supported integer inputs and no demonstrated urgent user-facing regression.
  • 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: The supplied repository state identifies a MEMBER-authored PR, so the external-contributor proof gate does not apply. Reported signed simulator model tests cover ordinary decoding and update behavior, not a live Gateway flow or overflow reproduction; no authority boundary changes.

Evidence

What I checked:

  • Introduced production changes: The pinned merge-base comparison changes only the two numeric adapters and adds the existing OpenClawKit import; string parsing remains failable and untrimmed. (apps/ios/Sources/Design/AgentAutomationModels.swift:227, f6ed66eb7fcd)
  • Existing shared conversion contract: The shared accessor uses Int(exactly:) for binary integers and floating-point values. Existing shared tests cover fractions, integer overflow, infinity, and booleans. This is an OpenClawKit implementation within the target repository; no Codex dependency contract is involved. (apps/shared/OpenClawKit/Sources/OpenClawKit/AnyCodable+Helpers.swift:12, f6ed66eb7fcd)
  • Automation producer contract: The inspected protocol schema defines interval, anchor, stagger, next-run, last-run, and duration fields as integers. Caller inspection also covered schedule summaries, automation ordering, and state timestamp display. (packages/gateway-protocol/src/schema/cron.ts:174, f6ed66eb7fcd)
  • Usage producer and release contract: Usage normalization truncates token counts and bounds them before aggregation. The same normalization was inspected in v2026.9.2; the aggregation path consumes normalized usage rather than forwarding raw fractional provider counts. (src/agents/usage.ts:155, 3928bad9badf)
  • Current main still needs the refactor: Both current-main model readers still contain the finite-Double conversion through Int(value). The shared helper already exists, but these callers have not adopted it. (apps/ios/Sources/Design/AgentProModels.swift:19, b8731bc88a7c)
  • Model coverage and supplied validation: The introduced tests exercise six decoded schedule cases and four usage cases through production models. The captured PR body reports signed simulator compilation and four passing model methods, explicitly without a crash or out-of-range reproduction. No tests or target code were executed during this read-only review. (apps/ios/Tests/RootTabsPresentationTests.swift:217, f6ed66eb7fcd)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-06T00:59:57.821Z sha f6ed66e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T01:06:09.952Z sha f6ed66e :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 6, 2026 01:02
@steipete
steipete merged commit 4bb95eb into main Sep 6, 2026
121 checks passed
@steipete
steipete deleted the codex/refactor-ios-integer-readers branch September 6, 2026 01:55
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 6, 2026
* origin/main:
  fix(cli): keep note text with Windows and Unicode line endings (#139512)
  fix(agents): keep isolated completion context on its admitted generation (#139607)
  fix: avoid declaration builds during source-server updates (#139392)
  fix(models): keep discovered models after catalog refresh failures (#139357)
  fix(gateway): record a transcript notice when a run fails before replying (#139439)
  refactor(ios): reuse shared integer conversion (#139581)
  fix(sessions): prevent database lock failures during reclamation (#139469)
  perf(test): reuse transforms within owned scheduler slots (#139553)
  test(agents): share sparse transcript input fixtures (#139589)
  chore(ui): refresh control ui locales (#139481)
  fix(slack): keep prototype-named emoji shortcodes intact (#136374)
  fix(gateway): deliver upgrade rejection responses under Bun (#139516)
  refactor(test): simplify catalog guards and fix native report fixture (#139496)
  fix(macos): prevent dashboard fixture loopback timeouts (#139556)
  fix(matrix): preserve selected reply targets inside threads (#139479)
vincentkoc added a commit to ylcn91/openclaw that referenced this pull request Sep 6, 2026
* commit '6c55a99226ed0611ca088004c81b00fb296f1f71': (182 commits)
  test(ui): scope dashboard settings setup to the top frame (openclaw#139618)
  refactor(skills): share pending proposal creation (openclaw#139617)
  fix(release): accept frozen targets before worker bundles (openclaw#136699)
  fix(gateway): preserve percent sequences in media filenames (openclaw#139508)
  fix: preserve current update availability alongside update history (openclaw#139501)
  feat(diagnostics): expose garbage collection duration metrics (openclaw#139592)
  fix(ui): keep Logbook timestamps clear of the activity stripe (openclaw#139539)
  fix(ui): keep Swarm outcomes visible after completion (openclaw#139490)
  test: check file accessibility without runtime-specific return values (openclaw#139590)
  refactor(sdk): keep helper types private (openclaw#139601)
  fix(cron): preserve current-session delivery intent (openclaw#139491)
  fix: prevent browser profile permission hangs in Doctor (openclaw#139612)
  fix(agents): repair storage-failure test fixture after failover owner move (openclaw#139531)
  fix(cli): keep note text with Windows and Unicode line endings (openclaw#139512)
  fix(agents): keep isolated completion context on its admitted generation (openclaw#139607)
  fix: avoid declaration builds during source-server updates (openclaw#139392)
  fix(models): keep discovered models after catalog refresh failures (openclaw#139357)
  fix(gateway): record a transcript notice when a run fails before replying (openclaw#139439)
  refactor(ios): reuse shared integer conversion (openclaw#139581)
  fix(sessions): prevent database lock failures during reclamation (openclaw#139469)
  ...
vincentkoc added a commit that referenced this pull request Sep 6, 2026
* commit 'refs/openclaw/tasks/pr-135167-main': (2467 commits)
  refactor(ios): reuse shared integer conversion (#139581)
  fix(sessions): prevent database lock failures during reclamation (#139469)
  perf(test): reuse transforms within owned scheduler slots (#139553)
  test(agents): share sparse transcript input fixtures (#139589)
  chore(ui): refresh control ui locales (#139481)
  fix(slack): keep prototype-named emoji shortcodes intact (#136374)
  fix(gateway): deliver upgrade rejection responses under Bun (#139516)
  refactor(test): simplify catalog guards and fix native report fixture (#139496)
  fix(macos): prevent dashboard fixture loopback timeouts (#139556)
  fix(matrix): preserve selected reply targets inside threads (#139479)
  test(gateway): preserve held-work close failures (#139593)
  refactor(exec): share package argument scanning (#139560)
  fix(audit): preserve sequence range validation before numeric decoding (#139587)
  fix(transcripts): retain capture ownership through failed cleanup (#139572)
  refactor(models): share selector reference traversal (#139571)
  perf(agents): classify allowlists without intermediate sets (#138392)
  chore(release): update appcast for 2026.9.2 (#139575)
  fix(ci): synchronize cloud retries and board widget input (#139506)
  fix(plugins): explain SDK incompatibilities after core updates (#139458)
  fix(voice-call): retain installed WebSocket behavior under Bun (#139567)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
Use the existing exact numeric accessor for automation and usage models,
preserving raw integer strings and missing-value outcomes. Numeric fractions
now remain unavailable instead of truncating, consistent with the inspected
cron and token producer contracts. The shared accessor and wire schema stay
unchanged, and both duplicate numeric switches are removed.

Full signed iOS app/test compilation, four ordinary model tests, thirteen
changed checks, and independent source reviews pass. Production net -9 LOC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios 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