Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with contracts and missing fields #5482

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Mar 4, 2025

WHY are these changes introduced?

The current implementation strips first-class fields before JSON schema validation, which prevents these fields from being used later in the configuration.

This change ensures that common base properties are still included in the extension config (they'll be stripped before deployment)

WHAT is this pull request doing?

  • Introduces JsonSchemaBaseProperties to define common base properties for all JSON Schema contracts
  • Adds these base properties to the contract's properties during validation
  • Removes the stripping of first-class fields before JSON schema validation
  • Ensures base properties like type, handle, uid, path, and extensions are preserved in the configuration

How to test your changes?

  1. Create an admin_link extension, be sure to have a handle in your toml that is completely different from the name attribute. Example toml:
[[extensions]]
name = "My Extension"
handle = "support-link"
type = "admin_link"

[[extensions.targeting]]
target = "admin.app.support.link"
url = "app://help"
  1. Without this PR, if you run app info you'll see an extension identified as my-extension. Because the handle wasn't loaded properly.
  2. With this PR, running app info you'll see the same extension identified as support-link, because now the handle was loaded correctly.
  3. Make a deploy with this new version to validate that we are still sending the expected attributes.

Measuring impact

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@isaacroldan isaacroldan changed the title Fix bug with contracts schemas Fix bug with contracts and mi Mar 4, 2025
@isaacroldan isaacroldan changed the title Fix bug with contracts and mi Fix bug with contracts and missing fields Mar 4, 2025
Copy link
Contributor

github-actions bot commented Mar 4, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
76.1% (-0.36% 🔻)
9198/12087
🟡 Branches
71.34% (-0.3% 🔻)
4507/6318
🟡 Functions
75.58% (-0.46% 🔻)
2396/3170
🟡 Lines
76.68% (-0.37% 🔻)
8689/11332
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app-event-watcher.ts
96.39% (-1.2% 🔻)
88.57% 95.45% 100%
🔴
... / app-management-client.ts
35.69% (-0.24% 🔻)
27.66% 35.05%
34.68% (-0.26% 🔻)
🟡
... / api.ts
68.18% (-15.47% 🔻)
50.85% (-19.92% 🔻)
88.89% (-11.11% 🔻)
67.06% (-15.94% 🔻)
🟡
... / graphql.ts
66.67% (-25% 🔻)
55.56% (-14.81% 🔻)
66.67% (-16.67% 🔻)
65.71% (-25.71% 🔻)
🟡
... / headers.ts
77.27% (-22.73% 🔻)
87.5%
77.78% (-22.22% 🔻)
76.19% (-23.81% 🔻)
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)
🔴
... / environment.ts
26.67% (-18.33% 🔻)
18.18% (-17.11% 🔻)
50% (-10% 🔻)
28.57% (-18.8% 🔻)
🟡
... / fs.ts
68.89% (-1.11% 🔻)
93.75%
65.91% (-2.27% 🔻)
68.18% (-1.14% 🔻)
🔴
... / http.ts
48.15% (-45.85% 🔻)
10% (-83.55% 🔻)
35.71% (-58.04% 🔻)
50% (-44% 🔻)
🟢
... / graphql.ts
83.33% (-16.67% 🔻)
57.14% (-14.29% 🔻)
88.89% (-11.11% 🔻)
82.86% (-17.14% 🔻)

Test suite run success

2091 tests passing in 926 suites.

Report generated by 🧪jest coverage report action from 4f2bfd5

@isaacroldan isaacroldan marked this pull request as ready for review March 4, 2025 16:27
@isaacroldan isaacroldan requested a review from a team as a code owner March 4, 2025 16:27
Copy link
Contributor

github-actions bot commented Mar 4, 2025

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

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