The github-actions pane that fetches for the others writes about 57 MB an hour to its shared store at the default 60 s refresh. Before stealth-factory/opscope#659 the widget wrote nothing. Cut it to what actually changed before stealth-factory/opscope#659 merges.
Context / problem
stealth-factory/opscope#659 (stealth-factory/opscope#633) shares github-actions readings across panes through tc::readings. In its live run with 18 repos, the fetching pane's disk-write counter (write_bytes in /proc/<pid>/io) showed about 57 MB an hour, roughly 1.4 GB a day. It grows with repos and runs. Saving a few kilobytes of API answers per repo should not cost megabytes a minute on disk. Part of stealth-factory/opscope#630.
Likely causes. These are read from the code and need confirming before fixing:
- Two copies of every reading. Core stores each reading's value and a "last good" copy. After a successful fetch the two are the same text.
- Whole rows rewritten. A changed reading rewrites the whole row (up to about 45 KB for a busy repo), and SQLite's rollback journal writes the changed pages a second time.
- Readings that look changed when nothing changed. Core already writes only timestamps when the stored text is identical. 57 MB means most repo readings differ every minute. A time-dependent field in each stored run (for example an elapsed duration for a running job) would do that.
Scope
In:
- Measure first. Record
write_bytesfor the fetching pane over at least 5 minutes, at the same repo count as stealth-factory/opscope#659's run, on the stealth-factory/opscope#659 branch. Then find which readings change on each fetch and why. - github-actions: store only what GitHub returned. Work out time-dependent figures (age, elapsed duration) when drawing, so an unchanged repo is written as timestamps only.
- core (
tc::readings): do not store the "last good" copy when it is the same as the value. Keep reading older rows written with both. Any other cheap cut found while measuring is in scope too. - State the before and after write rates in the PR.
Out:
- Changing the refresh interval or what the pane shows.
- Changing the store format in a way older builds cannot read. Columns stay as they are, and
store::VERSIONstays 1.
Acceptance
- With 18 repos and nothing new on GitHub, the fetching pane writes no more than about 1 MB an hour, measured the same way as stealth-factory/opscope#659.
- A busy hour, with new runs arriving, is measured and stated in the PR.
- A reading stored by the current code still opens, and an older build still reads what the new code writes.
- github-prs, linear and agent-usage benefit from the core change with no change of their own. Their tests pass.
cargo testpasses, includingcheck.rs.
Agent notes
- Stack this on stealth-factory/opscope#659**:** branch from
feature/ops-285-github-actions-share-repo-discovery-and-perand open the PR with that branch as its base. Retarget it tomainafter stealth-factory/opscope#659 merges. - Core write paths:
core/src/readings/store.rsStore::publish(the identical-value branch updates timestamps only; the comparison covers bothvalueandgood_value) andStore::annotate. The cache side issettle()andheld_for()incore/src/readings.rs, which both passgoodalongsidevalue. - For "last good" equal to "value", one compatible option is to write
good_value = NULLwithgood_atset, and haverow()fall back tovaluewhengood_valueis NULL andgood_atis present. Check that older builds reading such a row do not lose their kept reading forkept(). An older build'srow()returnsgood: Nonewhengood_valueis NULL, so decide whether that is acceptable during an upgrade. If it is not, keep writing both and cut elsewhere. - Journal: the store uses
journal_mode=TRUNCATEandsynchronous=OFF. WAL would change what older builds see, so leave the mode alone unless it is shown to be compatible. - github-actions: check what
ingest_runstores per run, and whether the runs reading includes anything that moves between fetches when GitHub's answer has not changed. - Do not use real repo or org names in fixtures or the PR.
Activity
2🔗 Related PRs
-
stealth-factory/opscope#662 - fix(github-actions): write the shared store only what actually changed [open] stealth-factory/opscope#659 - feat(github-actions): share repo discovery and per-repo runs across panes, and stop at the rate limit [closed]
📝 Issue Planner
-
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.- Create Plan
🧪 Issue enrichment is currently in open beta.
-
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:issue_enrichment: auto_enrich: enabled: false
💬 Have feedback or questions? Drop into our discord!
OPS-298