Skip to content

refactor(core): own the host storage contract - #1866

Merged
houko merged 1 commit into
nsgo-dev:mainfrom
houko:refactor/storage-contract-181
Nov 22, 2026
Merged

houko merged 1 commit into
nsgo-dev:mainfrom
houko:refactor/storage-contract-181

Conversation

@houko

@houko houko commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Give hosts an owned core.StorageBackend contract for core.NewStore, with core.StorageChange, core.StorageOp and operation constants defined in core. A host can implement persistence without depending on the private driver protocol. The engine adapts the owned changes to existing file, browser and mini-program persistence backends.

Remove the two storage protocol records from the public API allowlist and check core.NewStore as an app-facing API. Update public English/Chinese guides, the skill and the storage architecture. The existing app-facing ImageSampling value is also classified in the API guard.

Refs #181. This is independent of #1862 and #1811.

Targets

  • Shared code

Screenshots

None.

Verification

  • go tool nsgo test ./core -- -p 1 -run 'TestStorage|TestAccess.*Storage|Test.*Partition' -count=1: 7 passed, including storage partitions.
  • go tool nsgo test ./internal/engine -- -p 1 -run 'TestStorage|TestFileStorage|TestAppDirs|TestEngineMakesAppDirs' -count=1: 4 passed, including the new platform adapter regression for load, set, remove, clear and in-memory stores.
  • go tool nsgo test ./nsgotest -- -p 1 -count=1: 158 passed, one skipped.
  • Public API guard, all 26 layering variants and skill checks passed on the remote Mac builder.
  • go tool nsgo check -target macos,ios,windows,linux,android_arm64,web -jobs 1 passed on the remote Mac builder, including both desktop architectures, iOS and Android arm64. CI Build and vet also passed.
  • Full CI tests: 3464 passed, one failed, 50 skipped. The sole failure is TestMinimalAppLinks: macOS links net/http, crypto/tls, crypto/x509; Linux links net/http. The same two subtests reproduce with the same package lists on clean main 091984681603d03095e491025b499e3cc11d00df, so this predates the storage contract change.
  • git diff --check passed.

Checklist

  • Conventional Commit title
  • Public guides, skill, architecture and changelog updated

@houko

houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed. The engine adapter maps each core.StorageOp explicitly to the driver op, and every in-tree NewStore caller now passes either nil or a core-typed backend. The ImageSampling allowlist line is ordered differently from #1874, so this needs a rebase after #1874 lands.

@houko
houko enabled auto-merge (rebase) November 22, 2026 04:20
@github-actions github-actions Bot added the conflict Conflicts with the base branch; resolve it first label Nov 22, 2026
@houko
houko force-pushed the refactor/storage-contract-181 branch from 4ec93d6 to ad5693b Compare November 22, 2026 04:34
@github-actions github-actions Bot added size/M conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 22, 2026
@houko
houko force-pushed the refactor/storage-contract-181 branch 2 times, most recently from 5cf34cc to 013d88b Compare November 22, 2026 08:56
@github-actions github-actions Bot removed the conflict Conflicts with the base branch; resolve it first label Nov 22, 2026
@houko
houko force-pushed the refactor/storage-contract-181 branch from 013d88b to bdea123 Compare November 22, 2026 09:39
@github-actions github-actions Bot added the conflict Conflicts with the base branch; resolve it first label Nov 22, 2026
@houko
houko force-pushed the refactor/storage-contract-181 branch from bdea123 to 8993c2a Compare November 22, 2026 23:28
@houko
houko merged commit 99989bb into nsgo-dev:main Nov 22, 2026
14 of 17 checks passed
houko added a commit that referenced this pull request Nov 22, 2026
The App Clip storage test built core.NewStore directly on fileStorage, which writes driver.StorageChange since core took over the host storage contract (#1866), so internal/engine's tests no longer compiled on any target. NewStorage adapts the backend as OpenFileStorage does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant