Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to Supernote Cloud Sync are documented here.

The project uses Semantic Versioning.

## 1.0.4 - 2026-07-28

- Let large notebooks open beyond benchmark targets and add privacy-safe
performance diagnostics and retry guidance.
- Improve mobile and desktop Cloud browsing with safe-area-aware layouts,
animated transitions, and loading feedback.
- Suspend inactive readers, refine notebook controls, and add desktop toolbar
zoom actions while preserving mobile gestures.
- Restore complete embedded fonts so Markdown PDFs render correctly in Supernote
Partner and other PDF viewers.

## 1.0.3 - 2026-07-28

- Add Ko-fi support links to the README and Obsidian plugin metadata.
Expand Down
37 changes: 32 additions & 5 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Performance and quality harness

The harness gives each performance ticket a stable workload, JSON schema, and
budget result before optimization begins. Run commands from `plugin/`.
Performance budget result before optimization begins. These budgets are
benchmark and CI regression evidence; they never authorize production code to
reject a user operation. Run commands from `plugin/`.

## Quality gate

Expand All @@ -24,9 +26,11 @@ pnpm run build:bundle
pnpm perf -- --record --output benchmarks/results/local.json
```

Without `--record`, a failed budget makes the command exit nonzero. A recorded
run still writes every pass/fail result but exits successfully so an existing
baseline can be captured. Check the failure path independently:
Legacy absolute targets remain visible as informational migration evidence, but
they do not fail the command or control production behavior. A command fails
only for the harness self-test or a matching-baseline regression beyond the
explicit tolerance. A recorded run writes the evidence and exits successfully so
a baseline can be reviewed. Check the harness failure path independently:

```sh
pnpm perf -- --profile smoke --scenario run-log-streaming --force-budget-failure
Expand All @@ -37,6 +41,7 @@ Run one or more scenarios with `--scenario`:
```sh
pnpm perf -- --record --scenario cold-activation
pnpm perf -- --record --scenario page-rendering,viewer-interaction
pnpm perf -- --record --scenario notebook-opening,settled-viewing,page-navigation,page-grid,concurrent-notebooks,notebook-cleanup
pnpm perf -- --record --scenario run-log-streaming
pnpm perf -- --record --scenario writable-sync-memory
pnpm perf -- --record --scenario export-preparation
Expand All @@ -58,10 +63,32 @@ Label mobile evidence explicitly:
pnpm perf -- --record --platform mobile --device iphone-15-pro
```

The Node runner labels `--platform mobile` as a `desktop-mobile-simulation`. It
is useful for checking the mobile concurrency and workload contract, but it is
not physical-device evidence. Record actual iOS or Android Obsidian measurements
separately rather than relabelling a desktop run.

The runner identifies the selected desktop/mobile contract, device label, OS,
architecture, CPU, memory, Node version, plugin/Obsidian versions, Git commit,
and dirty state. Each scenario reports workload details, timing summaries, long
tasks over 50 ms, memory deltas, counters, and individual budget decisions.
tasks over 50 ms, memory deltas, counters, informational legacy target
comparisons, and a normalized evidence summary with peak, settled,
responsiveness, and cleanup values. Page rendering reports opening burst,
settled viewing, and three-visible-notebook workloads separately.

Compare a run only with a reviewed result from the same device, platform
contract, and workload profile:

```sh
pnpm perf -- --device local-reference --profile standard \
--baseline benchmarks/baselines/reviewed-local-standard.json \
--tolerance 0.20
```

The runner rejects mismatched baseline identities. A matching metric that
regresses beyond the explicit tolerance fails the benchmark command unless
`--record` is present. `--record` is for collecting evidence, not waiving a CI
regression.

## Fixtures and privacy

Expand Down
58 changes: 58 additions & 0 deletions benchmarks/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,64 @@ export interface ScenarioResult
passed: boolean;
}

export interface ScenarioBaseline {
readonly name: string;
readonly metrics: Readonly<Record<string, number>>;
}

export interface RegressionResult {
readonly metric: string;
readonly baseline: number;
readonly actual: number;
readonly toleranceFraction: number;
readonly limit: number;
readonly passed: boolean;
}

export const regressionGatePassed = (
baselineProvided: boolean,
comparisons: readonly RegressionResult[],
forceFailure = false,
): boolean =>
!forceFailure &&
(!baselineProvided || comparisons.every((comparison) => comparison.passed));

export const compareScenarioToBaseline = (
scenario: Pick<ScenarioResult, "name" | "metrics">,
baseline: ScenarioBaseline,
toleranceFraction: number,
): RegressionResult[] => {
if (scenario.name !== baseline.name) {
throw new Error(
`Cannot compare scenario ${scenario.name} with baseline ${baseline.name}`,
);
}
if (!Number.isFinite(toleranceFraction) || toleranceFraction < 0) {
throw new Error("Regression tolerance must be a nonnegative number");
}
return Object.entries(baseline.metrics).flatMap(
([metric, baselineValue]): RegressionResult[] => {
const actual = scenario.metrics[metric];
if (actual === undefined) {
throw new Error(
`Scenario ${scenario.name} did not report baseline metric ${metric}`,
);
}
const limit = baselineValue * (1 + toleranceFraction);
return [
{
metric,
baseline: baselineValue,
actual,
toleranceFraction,
limit,
passed: actual <= limit,
},
Comment on lines +93 to +102

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve exact-count checks in baseline comparisons

The comparator treats every metric as lower-is-better, but scenarios also publish correctness invariants such as documentRequests, pageModeRequests, and manifestWrites. If a regression causes one of those operations not to run, an actual count of 0 is considered an improvement over a baseline of 1 and passes; because this change makes the absolute budget results informational, no benchmark gate catches that broken workload. Exact-count or minimum-valued metrics need direction/equality semantics rather than the universal actual <= limit test.

Useful? React with 👍 / 👎.

];
},
);
};

export const percentile = (
samples: readonly number[],
percentileValue: number,
Expand Down
Loading
Loading