Skip to content

Add assertion IDs that will be included in production log statements for fail and hardAsserts #8313

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

Merged
merged 21 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
53603f3
Implement solution to replace error messages with error codes, instea…
MarkDuckworth Jun 12, 2024
c7c099a
Try-catch on saveErrorCode
MarkDuckworth Jun 12, 2024
39cf218
Replace string errorCodes with numeric errorIds to make the bundles s…
MarkDuckworth Jun 12, 2024
d441861
Merge branch 'main' of github.com:firebase/firebase-js-sdk into markd…
MarkDuckworth Apr 1, 2025
448257f
Added fixed error code values to source
MarkDuckworth Apr 1, 2025
70dcaa7
Removed 4 characters from each error code
MarkDuckworth Apr 2, 2025
a86219b
Deduplicated an error code
MarkDuckworth Apr 2, 2025
8b7c3f2
Fix tests
MarkDuckworth Apr 2, 2025
26cdf17
Error codes numerically increasing starting at 0 with tools to create…
MarkDuckworth Apr 3, 2025
8e28999
Instructions for using error-code-tool
MarkDuckworth Apr 3, 2025
1733442
Create odd-wolves-sit.md
MarkDuckworth Apr 3, 2025
3a1eaae
Rename error code to assertion id to deter customers from using this …
MarkDuckworth Apr 3, 2025
3803a86
Assertion ID back to 4 digit hex
MarkDuckworth Apr 7, 2025
fef77fb
Updated assertion id tool to use hex string
MarkDuckworth Apr 7, 2025
7416fa2
Merge branch 'markduckworth/error-codes' of github.com:firebase/fireb…
MarkDuckworth Apr 7, 2025
70ebdc3
Update odd-wolves-sit.md
MarkDuckworth Apr 8, 2025
d2ef447
Update odd-wolves-sit.md
MarkDuckworth Apr 8, 2025
4374a98
Address PR feedback
MarkDuckworth Apr 8, 2025
a46a147
Update prettier to run on scripts/ and commit the results of prettier
MarkDuckworth Apr 8, 2025
0607d5b
Merge branch 'markduckworth/error-codes' of github.com:firebase/fireb…
MarkDuckworth Apr 8, 2025
833f972
Fix lint error
MarkDuckworth Apr 11, 2025
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
2 changes: 1 addition & 1 deletion packages/firestore/scripts/build-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/firestore/scripts/extract-api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/firestore/scripts/remove-asserts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/firestore/scripts/remove-asserts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ class RemoveAsserts {
updatedNode = ts.factory.createCallExpression(
declaration.name!,
/*typeArgs*/ undefined,
[node.arguments[0]]
node.arguments.filter(value => !ts.isStringLiteral(value))
);
} else if (method === 'fail') {
// Remove the log message
updatedNode = ts.factory.createCallExpression(
declaration.name!,
/*typeArgs*/ undefined,
[]
node.arguments.filter(value => !ts.isStringLiteral(value))
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/scripts/rename-internals.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/exports.__esModule=true;exports.renameInternals=void 0;var ts=require("typescript");var ignoredIdentifiers=["undefined"];var RenameInternals=function(){function RenameInternals(publicApi,prefix){this.publicApi=publicApi;this.prefix=prefix}RenameInternals.prototype.visitNodeAndChildren=function(node,context){var _this=this;return ts.visitEachChild(this.visitNode(node),(function(childNode){return _this.visitNodeAndChildren(childNode,context)}),context)};RenameInternals.prototype.visitNode=function(node){if(ts.isIdentifier(node)){var name_1=node.escapedText.toString();if(!this.publicApi.has(name_1)&&ignoredIdentifiers.indexOf(node.escapedText.toString())===-1){var newIdentifier=ts.factory.createIdentifier(this.prefix+name_1);ts.setSourceMapRange(newIdentifier,ts.getSourceMapRange(node));return newIdentifier}}return node};return RenameInternals}();var DEFAULT_PREFIX="_";function renameInternals(program,config){var _a;var prefix=(_a=config.prefix)!==null&&_a!==void 0?_a:DEFAULT_PREFIX;var renamer=new RenameInternals(config.publicIdentifiers,prefix);return function(context){return function(file){return renamer.visitNodeAndChildren(file,context)}}}exports.renameInternals=renameInternals;
*/Object.defineProperty(exports,"__esModule",{value:true});exports.renameInternals=renameInternals;var ts=require("typescript");var ignoredIdentifiers=["undefined"];var RenameInternals=function(){function RenameInternals(publicApi,prefix){this.publicApi=publicApi;this.prefix=prefix}RenameInternals.prototype.visitNodeAndChildren=function(node,context){var _this=this;return ts.visitEachChild(this.visitNode(node),(function(childNode){return _this.visitNodeAndChildren(childNode,context)}),context)};RenameInternals.prototype.visitNode=function(node){if(ts.isIdentifier(node)){var name_1=node.escapedText.toString();if(!this.publicApi.has(name_1)&&ignoredIdentifiers.indexOf(node.escapedText.toString())===-1){var newIdentifier=ts.factory.createIdentifier(this.prefix+name_1);ts.setSourceMapRange(newIdentifier,ts.getSourceMapRange(node));return newIdentifier}}return node};return RenameInternals}();var DEFAULT_PREFIX="_";function renameInternals(program,config){var _a;var prefix=(_a=config.prefix)!==null&&_a!==void 0?_a:DEFAULT_PREFIX;var renamer=new RenameInternals(config.publicIdentifiers,prefix);return function(context){return function(file){return renamer.visitNodeAndChildren(file,context)}}}
17 changes: 17 additions & 0 deletions packages/firestore/scripts/run-tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading