Skip to content

Add Token consumption distribution and interval navigation - #236

Merged
SingleMai merged 4 commits into
mainfrom
codex/session-token-activity
Oct 13, 2026
Merged

SingleMai merged 4 commits into
mainfrom
codex/session-token-activity

Conversation

@SingleMai

@SingleMai SingleMai commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Session analysis could show accumulated Tokens but could not locate consumption hotspots or explain which samples support cache ratios. Analytics v5 adds scoped Token distribution, known subtotals with coverage, cache shares from one complete sample cohort, and navigation to contemporaneous original records.

The report uses the existing authorized Canonical snapshot. Thread/model selectors and interval cursors bind the snapshot; Usage-only changes invalidate both evidence and conditional Reader links. Usage intervals span their own stored clocks, including samples outside the Event span. Interval navigation does not infer a response or model attribution. Missing classifications, absent usage, zero denominators and safe-integer overflow remain explicit. Older analytics representations retain their existing wire semantics. Web negotiates v5 through the additive v=5 parameter on the v4 media range, keeping v4/v3/JSON fallback inside the browser's CORS safelist length limit. Pricing remains a separate increment.

Validation:

  • Domain: 159 tests; Application: 518 tests; Web: 108 unit tests.
  • Browser: all 105 Web scenarios passed, including Token/file navigation, the genuine 0.5.9 Server's cross-origin v2 fallback and preflight rejection, and current v5 negotiation. The new cross-origin case runs the production application and Browser Adapter against a GET-only API: one actual GET, no OPTIONS, v5 decoded successfully.
  • Workspace typechecks, Web production build, Go unit suites, Session Analytics race tests, docs/architecture checks and diff check passed.
  • Actual PostgreSQL contract passed for native and publication Usage, interval Reader navigation, independent Usage freshness and authorization, using the repository integration runner's standard Docker settings with explicit container cleanup.
  • Local caller acceptance against untouched archived Server source from published 0.5.12 (02f9d9e) and 0.5.10 (79a8b3e) passed same-origin and split-origin requests with the exact compact header, returning their genuine analytics v4/v3 representations. Each baseline retained its original source files and dependency lock bytes.

ADR-0127 and the current feature/OpenAPI guides document accounting, timestamp and compatibility limits. This PR implements the increment; it does not publish npm packages or deploy the Server.

@SingleMai
SingleMai merged commit 45f3bd8 into main Oct 13, 2026
4 checks passed
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