Skip to content

ci: enforce bundle byte budgets and record persistence sizes - #387

Merged
chhoumann merged 5 commits into
masterfrom
ci/size-budgets
Oct 11, 2026
Merged

chhoumann merged 5 commits into
masterfrom
ci/size-budgets

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

PRs now enforce 330,000 raw bytes and 100,000 gzip bytes for the production plugin in the existing Test job. Both size reports appear in the job summary. The persistence report and temporary Obsidian write recorder give later persistence work a repeatable baseline.

The bundle measures 307,131 raw bytes and 97,161 gzip bytes with Node 22 gzip level 9. The v2 stress fixture has 50 feeds, 2,000 history entries, 200 saved episodes, and 721 episode copies. It measures 5,593,476 compact bytes and 5,813,212 bytes in Obsidian's two-space JSON format. Persistence has no gate yet. The collection breakdown, repeated-snapshot accounting, GUID overhead, and method are in the baseline.

Verification

Production npm run size passes. A valid JavaScript copy with an added random-data comment fails through the same CLI without changing root main.js.

.audit/inflated-main.js raw: 440473 bytes; budget 330000 bytes; OVER by 110473 bytes
.audit/inflated-main.js gzip (level 9): 198189 bytes; budget 100000 bytes; OVER by 98189 bytes
Exit status: 1

All six local checks passed with Node 22.23.2 and npm 10.9.8.

npm run lint          PASS (exit 0)
npm run format:check  PASS (exit 0)
npm run typecheck     PASS (exit 0)
npm run build         PASS (exit 0)
npm run test          PASS (exit 0)
npm run docs:build    PASS (exit 0)

Tests verify boundary and independent gzip failures, exact UTF-8 accounting, the frozen NPR feed against the production parser, a lossless v2 codec round-trip, and recorder success/failure/restoration. Five size measurements produced identical results with zero errors. No timing claims.

Real Obsidian 1.13.7 on Linux/Xvfb used this worktree's isolated vault. count:writes -- start|report|stop recorded zero writes in one 60-second idle window. Saving the large fixture through saveSettingsStrict recorded one completed write, zero failures, and 5,813,212 bytes, equal to the persisted file size. An unrelated vault write counted zero. Original settings and disk data were restored, the recorder removed, dev:errors was empty, and the instance stopped. After the master merge, plugin-disable verification confirmed incomplete counts with successful recorder removal and adapter restoration. Feed metadata came from https://feeds.npr.org/510289/podcast.xml; no media was downloaded.

Release impact

None. No production source, schema, API, dependencies, versions, or required check names change. Obsidian discards adapter failures inside writeJson; the recorder observes adapter rejection directly. Failure propagation is tracked for PERS1 in #385.

Note

Add CI bundle byte budgets, persistence size reporting, and data.json write recording

  • Adds npm run size (size.mjs) which checks main.js against fixed budgets of 330,000 raw bytes and 100,000 level-9 gzip bytes, exiting nonzero on overage or bad artifacts
  • Adds npm run size:data (persistence-size.mjs) which reports compact/pretty persistence sizes from a synthetic 50-feed v2 fixture and validates optional-field candidates are additive only
  • Adds npm run count:writes (write-counts.mjs) to start, report, and stop an exact PodNotes data.json write recorder in the Obsidian E2E process
  • CI (test.yml) now runs size and size:data after the build, failing the job on a nonzero result
  • Records baselines and budgets in size-baseline.md; persistence sizes are advisory only and not budget-enforced

Macroscope summarized cb246e3.

@chhoumann
chhoumann merged commit 0b9f605 into master Oct 11, 2026
12 checks passed
@chhoumann
chhoumann deleted the ci/size-budgets branch October 11, 2026 05:03
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