Skip to content

Add shared B2 config JSON provider#113

Open
goanpeca wants to merge 8 commits into
mainfrom
feat/issue-103-config-provider
Open

Add shared B2 config JSON provider#113
goanpeca wants to merge 8 commits into
mainfrom
feat/issue-103-config-provider

Conversation

@goanpeca

@goanpeca goanpeca commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a shared b2-config: FileSystemProvider for bucket lifecycle, CORS, notifications, and bucketInfo JSON documents.
  • Register bundled JSON schemas for each config kind and include those schema assets in the release contract.
  • Require an opened b2-config snapshot plus a modal user confirmation before saves can mutate live bucket configuration, rejecting blind URI writes.
  • Persist saves via B2 bucket update/notification APIs with optimistic revision checks, bounded remote timeouts, and indeterminate-timeout messaging.
  • Harden notification handling by masking signing secrets and all custom headers, restoring masks only by stable rule identity, reconciling indeterminate saves, and serializing full-rule replacements through stale checks.
  • Bound provider cache with close/account/TTL/size eviction, sliding expiry on access, minimal secret snapshots, descriptor-based path parsing, and schema/save-validation drift tests.

Linked issue

Fixes #103

Tests run

  • npm run test:unit
  • npm run check
  • npm run compile
  • npm test
  • npm run contract:hash
  • npm run assert:dist-assets

Follow-up notes

Copilot AI review requested due to automatic review settings July 3, 2026 13:48
@goanpeca goanpeca added this to the v0.3.0 milestone Jul 3, 2026
@goanpeca goanpeca added enhancement New feature or request priority: high High priority sdk-parity SDK capability not yet exposed in the extension UI labels Jul 3, 2026
@goanpeca goanpeca self-assigned this Jul 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a shared b2-config: virtual JSON editing surface for B2 bucket configuration (lifecycle, CORS, notifications, bucketInfo) via a VS Code FileSystemProvider, along with bundled JSON schemas for validation/completions and helper logic to mask/merge notification secrets.

Changes:

  • Added B2ConfigFileSystemProvider and supporting JSON helper utilities (path parsing, stable fingerprinting, masking/merge, basic validation).
  • Registered the provider during extension activation and added jsonValidation schema bindings for b2-config: URIs.
  • Added unit tests for the JSON helper functions and introduced new JSON schema resources per config kind.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/test/unit/b2ConfigJson.test.ts Adds unit coverage for path parsing, masking/merge behavior, validation, and stable JSON fingerprinting.
src/providers/b2ConfigJson.ts Implements shared JSON utilities including notification secret masking and merge-on-save support.
src/providers/b2ConfigFileSystemProvider.ts Adds the b2-config: FileSystemProvider with read/write, optimistic concurrency checks, and secret-masking integration.
src/extension.ts Registers the new provider on activation.
resources/schemas/b2-config-notifications.schema.json Adds schema for notification rules (completion/validation on b2-config: docs).
resources/schemas/b2-config-lifecycle.schema.json Adds schema for lifecycle rules.
resources/schemas/b2-config-cors.schema.json Adds schema for CORS rules.
resources/schemas/b2-config-bucketInfo.schema.json Adds schema for bucketInfo metadata.
package.json Adds activation event + jsonValidation bindings for b2-config: JSON docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/providers/b2ConfigJson.ts
Comment thread src/providers/b2ConfigFileSystemProvider.ts Outdated
Comment thread src/providers/b2ConfigFileSystemProvider.ts Outdated
Comment thread package.json
Comment thread package.json
Comment thread src/providers/b2ConfigFileSystemProvider.ts
Copilot AI review requested due to automatic review settings July 3, 2026 14:16
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Extension Build Ready

Download the VSIX from the workflow artifacts above.

Installation

VS Code UI: Extensions > ... > Install from VSIX...

CLI:

code --install-extension b2-vscode-*.vsix

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Comment thread src/providers/b2ConfigJson.ts
Comment thread src/providers/b2ConfigJson.ts
Comment thread src/providers/b2ConfigJson.ts
Comment thread src/providers/b2ConfigJson.ts
Comment thread src/providers/b2ConfigFileSystemProvider.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comment thread src/providers/b2ConfigFileSystemProvider.ts Outdated
Comment thread src/providers/b2ConfigFileSystemProvider.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread src/providers/b2ConfigJson.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread src/providers/b2ConfigFileSystemProvider.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

@goanpeca
goanpeca marked this pull request as ready for review July 3, 2026 15:14
Copilot AI review requested due to automatic review settings July 8, 2026 23:14
@goanpeca
goanpeca force-pushed the feat/issue-103-config-provider branch from 76be4ec to eba7103 Compare July 8, 2026 23:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: high High priority sdk-parity SDK capability not yet exposed in the extension UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared edit-config-as-JSON mechanism (FileSystemProvider) for bucket settings

2 participants