镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(core): preserve context tiers in peak rates (carries #165) - #193

Merged
pierreraby merged 2 commits into
mainfrom
carry/pr165-peak-tiers
Nov 4, 2026
Merged

pierreraby merged 2 commits into
mainfrom
carry/pr165-peak-tiers

Conversation

@pierreraby

@pierreraby pierreraby commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Carries #165's peak-tier fix (188a344) by @patlux / Patrick Wozniak, credited as co-author. The first carry commit preserves the original source/test change. A separately reviewed integration adaptation now converts readonly catalog costs into independent mutable native-host tables (including a new array and tier objects), and index uses that adapter. The generic selector and generate arithmetic retain their existing contracts.

Keep context tiers and double their rates alongside the base table in peak windows. This guards a synthetic combination: no currently time-priced model has context tiers, so no current model's billed/display rate is asserted to change.

Integration adaptation

An expanded type probe found a new readonly-tier incompatibility with Pi's native Model['cost'] contract. A minimal probe passes against main's original selector and fails with the unadapted generic carry return. The native adapter resolves that specific incompatibility without casts or mutation of the readonly catalog. Its mutable return shape is checked by the normal project typecheck and frozen-catalog mutation tests; index itself remains outside the project tsconfig.

Fresh read-only review of the functional adaptation by an independent DeepSeek V4.1 Flash session: OK with notes, no blocking finding. A later comment/changelog clarification only qualifies coverage; helper and test code are unchanged from the reviewed delta. This is not a claim of exhaustive host typechecking: the 17 inherited index diagnostics remain a separate follow-up.

Validation

  • Original tier regression retained; cost tests now 12/12 PASS.
  • New native-table ownership regression failed before the adapter (runtime and typed assignment), then passed after it.
  • Minimal assignment against already-installed Pi 1.5.0 native cost declarations: PASS after adaptation.
  • Expanded index probe on the corrected combined stack: 17 diagnostics matching baseline codes/columns/source locations after line mapping; no new readonly-tier diagnostic.
  • Full npm test on the rebased PR head: PASS, including project typecheck and required real Pi/OMP integrations against mocks.
  • One local run failed the unchanged 50ms mid-stream-abort timing test before observing data. Five unchanged repeats on preceding main and five on this branch passed, followed by an unchanged full-suite PASS. No assertion or timeout was weakened; the first failure log was preserved.
  • Format and diff checks PASS. CI on this new head must pass before merge.

No live login or billed API tests, no dependency installation, no release/tag/publication. Original #165 remains open; this PR does not close it automatically.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Memory benchmark

Compared base b09283a with PR head d6fc3a7 on the same GitHub-hosted darwin runner. Lower values are better.

Metric Base PR PR − Base Change
Stable RSS 107.8 MiB ± 1.1 MiB 107.6 MiB ± 1.1 MiB +0.4 MiB ± 0.3 MiB +0.4%
Physical footprint 61.4 MiB ± 0.3 MiB 62.0 MiB ± 0.2 MiB +0.2 MiB ± 0.1 MiB +0.3%
Physical peak 73.6 MiB ± 0.7 MiB 74.0 MiB ± 1.1 MiB +1.1 MiB ± 0.4 MiB +1.4%

Interpretation: Differences larger than their measured MAD: Stable RSS +0.4 MiB ± 0.3 MiB, Physical footprint +0.2 MiB ± 0.1 MiB, Physical peak +1.1 MiB ± 0.4 MiB.

Extension overhead above pi baseline

Metric Base overhead PR overhead Difference
Stable RSS +6.3 MiB ± 1.8 MiB +6.0 MiB ± 2.1 MiB +0.4 MiB ± 0.3 MiB
Physical footprint +2.9 MiB ± 0.6 MiB +3.4 MiB ± 0.4 MiB +0.2 MiB ± 0.1 MiB
Physical peak +4.1 MiB ± 1.4 MiB +4.3 MiB ± 1.6 MiB +1.1 MiB ± 0.4 MiB

Values are medians of 6 alternating, paired runs. The value after ± is the median absolute deviation (MAD). Each process was sampled 12 times after a 2500 ms warm-up.

Environment: pi 0.84.4, Bun 1.4.4, darwin arm64. RSS comes from ps; physical footprint and peak come from macOS footprint.

This is a comparative signal, not a pass/fail threshold. GitHub-hosted runner noise can affect absolute values.

pierreraby and others added 2 commits November 4, 2026 14:24
Carries the peak-tier fix from #165 by patlux; source and regression test match 188a344.

Co-authored-by: Patrick Wozniak <email@patwoz.de>
Follow up the #165 peak-tier carry in #193: copy readonly catalog costs into independent mutable tables at the native host boundary. Preserve generic cost selection and generate arithmetic. Add a typed assignment and frozen-catalog mutation regression test. No claim of exhaustive index typecheck coverage.
@pierreraby
pierreraby force-pushed the carry/pr165-peak-tiers branch from 3e5964c to d6fc3a7 Compare November 4, 2026 13:28
@pierreraby
pierreraby merged commit 9b9b00e into main Nov 4, 2026
15 checks passed
@pierreraby
pierreraby deleted the carry/pr165-peak-tiers branch November 4, 2026 13:30
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.

1 participant