aight 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {aight-0.2.0 → aight-0.2.1}/PKG-INFO +1 -1
  2. {aight-0.2.0 → aight-0.2.1}/README.md +42 -8
  3. {aight-0.2.0 → aight-0.2.1}/aight/AGENTS.md +4 -0
  4. {aight-0.2.0 → aight-0.2.1}/aight/__init__.py +1 -1
  5. {aight-0.2.0 → aight-0.2.1}/aight/collect/base.py +105 -3
  6. {aight-0.2.0 → aight-0.2.1}/aight/collect/proxy.py +1 -1
  7. {aight-0.2.0 → aight-0.2.1}/aight/remote.py +5 -5
  8. {aight-0.2.0 → aight-0.2.1}/aight.egg-info/PKG-INFO +1 -1
  9. {aight-0.2.0 → aight-0.2.1}/pyproject.toml +1 -1
  10. {aight-0.2.0 → aight-0.2.1}/tests/test_collect_claude_code.py +38 -1
  11. {aight-0.2.0 → aight-0.2.1}/LICENSE +0 -0
  12. {aight-0.2.0 → aight-0.2.1}/aight/auto.py +0 -0
  13. {aight-0.2.0 → aight-0.2.1}/aight/collect/__init__.py +0 -0
  14. {aight-0.2.0 → aight-0.2.1}/aight/collect/aider.py +0 -0
  15. {aight-0.2.0 → aight-0.2.1}/aight/collect/claude_code.py +0 -0
  16. {aight-0.2.0 → aight-0.2.1}/aight/collect/codex.py +0 -0
  17. {aight-0.2.0 → aight-0.2.1}/aight/collect/gemini.py +0 -0
  18. {aight-0.2.0 → aight-0.2.1}/aight/tracing.py +0 -0
  19. {aight-0.2.0 → aight-0.2.1}/aight.egg-info/SOURCES.txt +0 -0
  20. {aight-0.2.0 → aight-0.2.1}/aight.egg-info/dependency_links.txt +0 -0
  21. {aight-0.2.0 → aight-0.2.1}/aight.egg-info/entry_points.txt +0 -0
  22. {aight-0.2.0 → aight-0.2.1}/aight.egg-info/requires.txt +0 -0
  23. {aight-0.2.0 → aight-0.2.1}/aight.egg-info/top_level.txt +0 -0
  24. {aight-0.2.0 → aight-0.2.1}/setup.cfg +0 -0
  25. {aight-0.2.0 → aight-0.2.1}/tests/test_auto_instrument.py +0 -0
  26. {aight-0.2.0 → aight-0.2.1}/tests/test_collect_aider.py +0 -0
  27. {aight-0.2.0 → aight-0.2.1}/tests/test_collect_codex.py +0 -0
  28. {aight-0.2.0 → aight-0.2.1}/tests/test_collect_gemini.py +0 -0
  29. {aight-0.2.0 → aight-0.2.1}/tests/test_collect_proxy.py +0 -0
  30. {aight-0.2.0 → aight-0.2.1}/tests/test_remote.py +0 -0
  31. {aight-0.2.0 → aight-0.2.1}/tests/test_tracing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aight
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Attribute LLM spend to the exact source line, and push it to the AIght Workspace at aight.studio.
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://aight.studio
@@ -15,9 +15,10 @@ time. `traced_llm_call` therefore returns `None`, not a cost.
15
15
  pip install aight
16
16
  ```
17
17
 
18
- That is the whole install, and it also puts `aight-collect` on your path — the
19
- Claude Code collector, which is a separate thing from the SDK and is described
20
- under [External agents](#external-agents-claude-code) below.
18
+ That is the whole install, and it also puts the collectors on your path —
19
+ `aight-collect` for Claude Code, three more for other agents, and `aight-proxy`
20
+ for anything none of them can read. They are a separate thing from the SDK and
21
+ are described under [External agents](#external-agents) below.
21
22
 
22
23
  ## Deploy with your AI coding agent
23
24
 
@@ -44,7 +45,7 @@ traced_llm_call("gpt-4o-mini", input_tokens=180, output_tokens=60)
44
45
  push(COST_PROCESSOR.buckets) # reads AIGHT_API_KEY from the environment
45
46
  ```
46
47
 
47
- Get an API key from the Integrate tab of your AIght Workspace, then:
48
+ Get an API key from Project settings in your AIght Workspace, then:
48
49
 
49
50
  ```bash
50
51
  export AIGHT_API_KEY="aight_..."
@@ -113,6 +114,11 @@ push_value(VALUE_BY_FILE)
113
114
  acknowledged — so calling it every flush sends each earning once, and a failed
114
115
  push keeps the total for the retry instead of losing it.
115
116
 
117
+ It takes that map as an argument rather than reading a global, which makes it
118
+ also the way to report value for an agent you did not write — pass the agent id
119
+ the collector uses as the filepath. See [External
120
+ agents](#external-agents) below.
121
+
116
122
  ## Local-only mode
117
123
 
118
124
  Skip `push()` and call `COST_PROCESSOR.report()` instead — a plain-text
@@ -124,14 +130,24 @@ platform's, so spend only appears in the AIght Workspace once you push.
124
130
  examples/snippet_check.py:19 (plan_step) [gpt-4o-mini] = 3 call(s), 540 in / 180 out
125
131
  ```
126
132
 
127
- ## External agents (Claude Code)
133
+ ## External agents
128
134
 
129
135
  Everything above is for an agent *you wrote*: the SDK walks your call stack to
130
136
  find the line that issued the call. An agent you run but did not write has no
131
137
  line of yours on the stack, so there is nothing to instrument and no library to
132
138
  import. AIght traces those by reading the agent's own transcripts instead.
133
139
 
134
- `pip install aight` also installs `aight-collect`:
140
+ `pip install aight` also installs `aight-collect`. To see what your Claude Code
141
+ history would cost at API list prices, with no account and nothing sent:
142
+
143
+ ```bash
144
+ pip install aight && aight-collect --report --all-projects
145
+ ```
146
+
147
+ That prints a breakdown by token type, step and model. Only the model names go
148
+ out, to fetch their rates from AIght's price table; drop `--all-projects` for
149
+ just this directory, add `--since 2026-10-01` to narrow it. To push to your
150
+ Workspace instead:
135
151
 
136
152
  ```bash
137
153
  export AIGHT_API_KEY="aight_..."
@@ -145,6 +161,24 @@ row per step the agent took, under an external agent called `claude-code`. Cost
145
161
  lands on the step — the tool it called and the file it touched — rather than on
146
162
  a source line, because no source line of yours is involved.
147
163
 
164
+ That is the spend side. **Earnings you report yourself** — a collector reads
165
+ token counts, not what the work was worth, and no SDK can infer it. Push them
166
+ against the agent's id:
167
+
168
+ ```python
169
+ from aight.remote import push_value
170
+
171
+ push_value({"claude-code": 49.0}) # the id the collector roots its rows at
172
+ ```
173
+
174
+ The Workspace shows that on `claude-code` exactly as it shows an agent of your
175
+ own: the earned total, the net, the ratio, and the earning-or-burning status
176
+ that goes with them. What an external agent never gets is a **matched** figure
177
+ — the matching engine's time-window fallback excludes external rows outright,
178
+ because a collector pushes no timestamp and an external row would always be the
179
+ newest thing in the window and win the guess by default. Reported, yes; guessed,
180
+ no.
181
+
148
182
  Leave it running and the spend appears as you work, rather than whenever you
149
183
  next remember to run it:
150
184
 
@@ -170,8 +204,8 @@ Three things are worth knowing before the first run:
170
204
  been pushed.
171
205
  - **The key alone decides the destination.** A run prints the project its rows
172
206
  landed in and stops rather than resuming when that differs from the project
173
- its earlier pushes went to. A key copied out of another project's Integrate
174
- tab otherwise reads exactly like success, and fills a workspace nobody is
207
+ its earlier pushes went to. A key copied out of another project's settings
208
+ otherwise reads exactly like success, and fills a workspace nobody is
175
209
  looking at.
176
210
 
177
211
  Without installing anything:
@@ -32,6 +32,10 @@ from aight.tracing import report_value, VALUE_BY_FILE
32
32
  from aight.remote import push_value
33
33
  report_value(49.0)
34
34
  push_value(VALUE_BY_FILE)
35
+ For an agent the user runs but this project does not contain — Claude Code, Gemini, Codex, traced by aight's collectors — earnings go in by agent id, because there is no calling file of theirs to resolve. push_value takes the map, so pass one directly, on the same rule:
36
+ from aight.remote import push_value
37
+ push_value({"claude-code": 49.0}) # the agent id the collector roots its rows at
38
+ That agent then shows a reported figure in the Workspace like any other. It never shows a matched one: the matching engine excludes external rows from its time-window fallback, so do not try to give it one through push_event.
35
39
  7. Optional: Agnostic business matching, Trace IDs & Labels
36
40
  To link LLM costs explicitly to business events (like a Stripe checkout, a conversion, or custom tiers) without hardcoding any specific business model, use TraceContext or pass parameters directly:
37
41
  Option A — Using TraceContext for an execution scope (recommended for web requests / checkouts):
@@ -23,4 +23,4 @@ Or trace manually, call by call:
23
23
  push(COST_PROCESSOR.buckets)
24
24
  """
25
25
 
26
- __version__ = "0.2.0"
26
+ __version__ = "0.2.1"
@@ -36,6 +36,7 @@ import subprocess
36
36
  import sys
37
37
  import time
38
38
  import urllib.error
39
+ import urllib.parse
39
40
  import urllib.request
40
41
  from collections.abc import Callable
41
42
  from dataclasses import dataclass, field
@@ -284,7 +285,7 @@ def _check_destination(config: Collector, api_key: str, url: str) -> tuple[bool,
284
285
  An ingest key is otherwise write-only: every read endpoint wants the Auth0
285
286
  JWT, so a collector had no way to ask this before pushing. The marker
286
287
  records that calls were *sent*, never where, so a key minted in another
287
- project's Integrate tab would resume this machine's coverage, send only
288
+ project's settings would resume this machine's coverage, send only
288
289
  what is newer than it into the wrong workspace, and leave the project that
289
290
  was meant permanently missing that window — silently, because every one of
290
291
  those pushes succeeds.
@@ -581,6 +582,94 @@ def watch(
581
582
  return 0
582
583
 
583
584
 
585
+ def fetch_prices(rows: list[dict], ingest_url: str) -> dict | None:
586
+ """The server's per-1K rates for the models in `rows`, or None offline.
587
+
588
+ Only model names go up. The SDK ships no price table on purpose (copies
589
+ drifted from the server's and priced new models at zero), so a report
590
+ asks the one table there is, and falls back to tokens when it can't."""
591
+ models = sorted({r["model"] for r in rows if r.get("model")})
592
+ if not models:
593
+ return {}
594
+ base = ingest_url.split("/api/", 1)[0]
595
+ query = urllib.parse.urlencode({"models": ",".join(models)})
596
+ try:
597
+ with urllib.request.urlopen(f"{base}/api/pricing?{query}", timeout=10) as resp:
598
+ return json.load(resp).get("prices") or {}
599
+ except (urllib.error.URLError, OSError, ValueError):
600
+ return None
601
+
602
+
603
+ TOKEN_KINDS = (
604
+ ("cache read", "cache_read_tokens", "cache_read"),
605
+ ("cache write", "cache_creation_tokens", "cache_creation"),
606
+ ("output", "output_tokens", "output"),
607
+ ("fresh input", "input_tokens", "input"),
608
+ )
609
+
610
+
611
+ def report(rows: list[dict], agent: str, prices: dict | None, top: int = 8) -> str:
612
+ """A breakdown worth a screenshot: what the calls in `rows` would cost at
613
+ list price, by token type, by step and by model. With `prices` None (the
614
+ server was unreachable) it reports tokens instead of dollars."""
615
+ priced = prices is not None
616
+ by_kind: dict[str, float] = {}
617
+ by_step: dict[str, list[float]] = {}
618
+ by_model: dict[str, float] = {}
619
+ unpriced: set[str] = set()
620
+ calls = 0
621
+ for r in rows:
622
+ rate = (prices or {}).get(r["model"]) if priced else None
623
+ if priced and rate is None:
624
+ unpriced.add(r["model"])
625
+ # A coding agent's step is the tool, whatever file it touched (and the
626
+ # path would put the user's directories in a shared screenshot); your
627
+ # own agent's step is the line, named by file, not full path.
628
+ frame = r["chain"][-1]
629
+ if r.get("kind") == "external" or not frame.get("filepath"):
630
+ step = frame.get("function") or "?"
631
+ else:
632
+ step = f"{Path(frame['filepath']).name}:{frame['lineno']}"
633
+ row_total = 0.0
634
+ for label, key, rate_key in TOKEN_KINDS:
635
+ n = r.get(key, 0) or 0
636
+ v = (n / 1000) * (rate or {}).get(rate_key, 0.0) if priced else n
637
+ by_kind[label] = by_kind.get(label, 0.0) + v
638
+ row_total += v
639
+ s = by_step.setdefault(step, [0.0, 0])
640
+ s[0] += row_total
641
+ s[1] += r.get("calls", 0)
642
+ by_model[r["model"]] = by_model.get(r["model"], 0.0) + row_total
643
+ calls += r.get("calls", 0)
644
+
645
+ total = sum(by_kind.values())
646
+
647
+ def amount(v: float) -> str:
648
+ return f"${v:,.2f}" if priced else f"{v:,.0f} tok"
649
+
650
+ def line(name: str, v: float, extra: str = "") -> str:
651
+ share = v / total if total else 0
652
+ bar = "█" * round(share * 24)
653
+ name = name if len(name) <= 28 else name[:27] + "…"
654
+ return f" {name:<28} {amount(v):>14} {share:>5.0%} {bar}{extra}"
655
+
656
+ out = [f"{agent} · {calls:,} calls · " + (
657
+ "priced at API list rates" if priced else "tokens only (pricing unreachable)"),
658
+ "", f" {'TOTAL':<28} {amount(total):>14}", "", "By token type"]
659
+ out += [line(k, v) for k, v in sorted(by_kind.items(), key=lambda kv: -kv[1])]
660
+ out += ["", "By step"]
661
+ steps = sorted(by_step.items(), key=lambda kv: -kv[1][0])
662
+ out += [line(k, v[0], f" {int(v[1]):,} calls") for k, v in steps[:top]]
663
+ if len(steps) > top:
664
+ out.append(f" … {len(steps) - top} more steps")
665
+ out += ["", "By model"]
666
+ out += [line(k, v) for k, v in sorted(by_model.items(), key=lambda kv: -kv[1])[:top]]
667
+ if unpriced:
668
+ out += ["", "No list price yet for: " + ", ".join(sorted(unpriced)) + " (counted as $0)"]
669
+ out += ["", "Nothing was sent. Per line of your own agent's code: https://aight.studio"]
670
+ return "\n".join(out)
671
+
672
+
584
673
  def main(config: Collector, argv: list[str] | None = None) -> int:
585
674
  # Not description=__doc__: a module docstring is fifty lines of rationale
586
675
  # for whoever maintains the parser, and `--help` is the first thing a
@@ -603,6 +692,9 @@ def main(config: Collector, argv: list[str] | None = None) -> int:
603
692
  "so running it again over an already-pushed directory doubles it")
604
693
  parser.add_argument("--dry-run", action="store_true",
605
694
  help="print the rows instead of pushing them")
695
+ parser.add_argument("--report", action="store_true",
696
+ help="print a priced breakdown (token type, step, model) and push "
697
+ "nothing; every call unless --since narrows it")
606
698
  parser.add_argument("--watch", action="store_true",
607
699
  help="keep running: re-scan and push on an interval, until interrupted")
608
700
  parser.add_argument("--interval", type=float, default=DEFAULT_INTERVAL_SECONDS,
@@ -611,6 +703,12 @@ def main(config: Collector, argv: list[str] | None = None) -> int:
611
703
  f"(default: {DEFAULT_INTERVAL_SECONDS})")
612
704
  args = parser.parse_args(argv)
613
705
 
706
+ if args.report and args.watch:
707
+ parser.error("--report prints once; it can't be combined with --watch.")
708
+ # A report pushes nothing, so re-reading all history can't double anything.
709
+ if args.report and not args.since:
710
+ args.all_time = True
711
+
614
712
  # --since/--all-time scope every file by hand; a plain run resumes.
615
713
  manual = args.all_time or bool(args.since)
616
714
 
@@ -689,7 +787,7 @@ def main(config: Collector, argv: list[str] | None = None) -> int:
689
787
  if args.watch:
690
788
  api_key = os.environ.get("AIGHT_API_KEY")
691
789
  if not api_key:
692
- print("Set AIGHT_API_KEY (Integrate tab of your AIght Workspace)", file=sys.stderr)
790
+ print("Set AIGHT_API_KEY (Project settings in your AIght Workspace)", file=sys.stderr)
693
791
  return 1
694
792
  url = os.environ.get("AIGHT_INGEST_URL", DEFAULT_INGEST_URL)
695
793
  ok, destination = _check_destination(config, api_key, url)
@@ -718,6 +816,10 @@ def main(config: Collector, argv: list[str] | None = None) -> int:
718
816
  rows = config.rows_for(calls)
719
817
  print(f"{len(paths)} transcript(s), {len(calls)} unique calls, {len(rows)} rows")
720
818
 
819
+ if args.report:
820
+ url = os.environ.get("AIGHT_INGEST_URL", DEFAULT_INGEST_URL)
821
+ print(report(rows, config.agent_id, fetch_prices(rows, url)))
822
+ return 0
721
823
  if args.dry_run:
722
824
  print(json.dumps(rows, indent=2))
723
825
  return 0
@@ -729,7 +831,7 @@ def main(config: Collector, argv: list[str] | None = None) -> int:
729
831
 
730
832
  api_key = os.environ.get("AIGHT_API_KEY")
731
833
  if not api_key:
732
- print("Set AIGHT_API_KEY (Integrate tab of your AIght Workspace)", file=sys.stderr)
834
+ print("Set AIGHT_API_KEY (Project settings in your AIght Workspace)", file=sys.stderr)
733
835
  return 1
734
836
  url = os.environ.get("AIGHT_INGEST_URL", DEFAULT_INGEST_URL)
735
837
 
@@ -434,7 +434,7 @@ def main(argv: list[str] | None = None) -> int:
434
434
 
435
435
  api_key = os.environ.get("AIGHT_API_KEY")
436
436
  if not api_key:
437
- print("Set AIGHT_API_KEY (Integrate tab of your AIght Workspace)", file=sys.stderr)
437
+ print("Set AIGHT_API_KEY (Project settings in your AIght Workspace)", file=sys.stderr)
438
438
  return 1
439
439
  ingest_url = os.environ.get("AIGHT_INGEST_URL", DEFAULT_INGEST_URL)
440
440
  return serve(args.host, args.port, api_key, ingest_url, args.agent)
@@ -1,8 +1,8 @@
1
1
  """Push locally-traced spend data to your hosted AIght Workspace.
2
2
 
3
3
  Stdlib only (urllib) — reporting cost data home shouldn't require pulling in
4
- `requests` on top of the tracing deps. Get an API key from the "Integrate"
5
- tab of your AIght Workspace, then after a traced run:
4
+ `requests` on top of the tracing deps. Get an API key from Project settings
5
+ in your AIght Workspace, then after a traced run:
6
6
 
7
7
  from aight.remote import push
8
8
  from aight.tracing import COST_PROCESSOR
@@ -68,7 +68,7 @@ def push(buckets, api_key: str | None = None, url: str | None = None) -> None:
68
68
  if not api_key:
69
69
  raise RuntimeError(
70
70
  "No API key. Pass api_key=..., or set AIGHT_API_KEY (get one from "
71
- "the Integrate tab of your aight.studio dashboard)."
71
+ "Project settings in your AIght Workspace at aight.studio)."
72
72
  )
73
73
  url = url or os.environ.get("AIGHT_INGEST_URL", DEFAULT_INGEST_URL)
74
74
  rows = [
@@ -141,7 +141,7 @@ def push_event(
141
141
  if not api_key:
142
142
  raise RuntimeError(
143
143
  "No API key. Pass api_key=..., or set AIGHT_API_KEY (get one from "
144
- "the Integrate tab of your aight.studio dashboard)."
144
+ "Project settings in your AIght Workspace at aight.studio)."
145
145
  )
146
146
  url = url or os.environ.get("AIGHT_EVENTS_INGEST_URL", DEFAULT_INGEST_URL.replace("/spans", "/events"))
147
147
  event = {
@@ -173,7 +173,7 @@ def push_value(value_by_file, api_key: str | None = None, url: str | None = None
173
173
  if not api_key:
174
174
  raise RuntimeError(
175
175
  "No API key. Pass api_key=..., or set AIGHT_API_KEY (get one from "
176
- "the Integrate tab of your aight.studio dashboard)."
176
+ "Project settings in your AIght Workspace at aight.studio)."
177
177
  )
178
178
  url = url or os.environ.get("AIGHT_VALUE_INGEST_URL", DEFAULT_INGEST_URL.replace("/spans", "/value"))
179
179
  rows = [{"filepath": filepath, "value_usd": value} for filepath, value in value_by_file.items()]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aight
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Attribute LLM spend to the exact source line, and push it to the AIght Workspace at aight.studio.
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://aight.studio
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aight"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Attribute LLM spend to the exact source line, and push it to the AIght Workspace at aight.studio."
5
5
  # SPDX identifier; the text it refers to is the LICENSE file in this directory.
6
6
  # The bare string is PEP 639, which is why the build floor below is setuptools
@@ -466,7 +466,7 @@ def test_a_key_for_another_project_refuses_instead_of_resuming(tmp_path, monkeyp
466
466
  """The one mistake the marker cannot catch by itself.
467
467
 
468
468
  A marker records that calls were *sent*, never where. So a key minted in a
469
- different project's Integrate tab resumes this machine's coverage, pushes
469
+ different project's settings resumes this machine's coverage, pushes
470
470
  only what is newer than it into the wrong workspace, and leaves the project
471
471
  that was meant permanently missing that window — silently, because every
472
472
  one of those pushes succeeds. Refusing is the only safe direction.
@@ -737,3 +737,40 @@ def test_push_builds_a_request_that_reports_the_installed_version(monkeypatch):
737
737
  assert seen["headers"]["x-aight-sdk-version"] == base.SDK_VERSION
738
738
  assert seen["headers"]["x-aight-sdk-language"] == "a-collector"
739
739
  assert seen["headers"]["authorization"] == "Bearer key"
740
+
741
+
742
+ def _row(step, model, calls, cache_read=0, output=0, filepath="", kind="external"):
743
+ return {
744
+ "chain": [{"filepath": "claude-code", "lineno": 0, "function": "claude-code"},
745
+ {"filepath": filepath, "lineno": 0, "function": step}],
746
+ "kind": kind, "model": model, "calls": calls, "cost_usd": 0.0,
747
+ "input_tokens": 0, "output_tokens": output,
748
+ "cache_read_tokens": cache_read, "cache_creation_tokens": 0, "trace_id": "",
749
+ }
750
+
751
+
752
+ def test_report_prices_with_the_server_rates_and_groups_tools_not_paths():
753
+ rows = [_row("reply", "m", 10, cache_read=1_000_000),
754
+ _row("Read", "m", 2, output=2000, filepath="/Users/someone/secret/notes.md"),
755
+ _row("Read", "unknown", 1, output=1000)]
756
+ out = collector.report(rows, "claude-code", {"m": {"cache_read": 0.0003, "output": 0.015}, "unknown": None})
757
+ assert "$0.30" in out.split("By step")[0] # 1M cache read at 0.0003/1K
758
+ assert "$0.33" in out # + 2K output at 0.015/1K; the unknown model is $0
759
+ assert "/Users/someone" not in out
760
+ assert out.count("Read") == 1
761
+ assert "No list price yet for: unknown" in out
762
+
763
+
764
+ def test_report_falls_back_to_tokens_when_pricing_is_unreachable():
765
+ out = collector.report([_row("reply", "m", 1, cache_read=5000)], "claude-code", None)
766
+ assert "tokens only" in out and "5,000 tok" in out
767
+
768
+
769
+ def test_report_pushes_nothing_and_reads_all_history(tmp_path, monkeypatch, capsys):
770
+ pushed = _recording_push(monkeypatch)
771
+ _recent(tmp_path / "base")
772
+ monkeypatch.setattr(collector, "fetch_prices", lambda rows, url: {})
773
+ assert main(["--root", str(tmp_path / "base"), "--report"]) == 0
774
+ assert pushed == []
775
+ out = capsys.readouterr().out
776
+ assert "Nothing was sent" in out and "go up" not in out
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes