Skip to content

Commit 9414f0e

Browse files
committed
deps: update ata to 0.10.6
1 parent 1d6fce5 commit 9414f0e

6 files changed

Lines changed: 97 additions & 37 deletions

File tree

deps/ata/ata.cpp

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* auto-generated on 2026-04-30 21:36:25 +0300. Do not edit! */
2+
/* begin file src/ata.cpp */
13
#include "ata.h"
24

35
// mimalloc: faster new/delete for small allocations.
@@ -1016,6 +1018,69 @@ static schema_node_ptr find_anchor_in_resource(const compiled_schema& ctx,
10161018
return nullptr;
10171019
}
10181020

1021+
// Returns cap + 1 once the running row minimum exceeds cap (early reject).
1022+
static size_t lev_capped(std::string_view a, std::string_view b, size_t cap) {
1023+
if (a == b) return 0;
1024+
size_t la = a.size();
1025+
size_t lb = b.size();
1026+
if (la > lb) {
1027+
std::swap(a, b);
1028+
std::swap(la, lb);
1029+
}
1030+
if (lb - la > cap) return cap + 1;
1031+
1032+
std::vector<size_t> prev(la + 1);
1033+
std::vector<size_t> curr(la + 1);
1034+
for (size_t i = 0; i <= la; ++i) prev[i] = i;
1035+
1036+
for (size_t j = 1; j <= lb; ++j) {
1037+
curr[0] = j;
1038+
size_t row_min = j;
1039+
for (size_t i = 1; i <= la; ++i) {
1040+
size_t cost = (a[i - 1] == b[j - 1]) ? 0 : 1;
1041+
size_t v = std::min({prev[i] + 1, curr[i - 1] + 1, prev[i - 1] + cost});
1042+
curr[i] = v;
1043+
if (v < row_min) row_min = v;
1044+
}
1045+
if (row_min > cap) return cap + 1;
1046+
std::swap(prev, curr);
1047+
}
1048+
return prev[la];
1049+
}
1050+
1051+
// Edit-distance up to 2 wins; otherwise fall back to a common-prefix match
1052+
// (covers renames like "testRunner" vs "test" where edit distance is large).
1053+
static std::string suggest_property(
1054+
std::string_view rejected,
1055+
const std::unordered_map<std::string, schema_node_ptr>& properties) {
1056+
if (properties.empty() || rejected.empty()) return "";
1057+
1058+
std::string best;
1059+
size_t best_dist = 3;
1060+
size_t best_prefix = 0;
1061+
1062+
for (const auto& [key, _] : properties) {
1063+
if (key.empty()) continue;
1064+
size_t d = lev_capped(rejected, key, 2);
1065+
if (d <= 2 && d < best_dist) {
1066+
best = key;
1067+
best_dist = d;
1068+
continue;
1069+
}
1070+
if (best_dist > 2) {
1071+
size_t maxp = std::min(rejected.size(), key.size());
1072+
size_t pl = 0;
1073+
while (pl < maxp && rejected[pl] == key[pl]) ++pl;
1074+
size_t shorter = std::min(rejected.size(), key.size());
1075+
if (pl >= 3 && pl * 2 >= shorter && pl > best_prefix) {
1076+
best = key;
1077+
best_prefix = pl;
1078+
}
1079+
}
1080+
}
1081+
return best;
1082+
}
1083+
10191084
static void validate_node(const schema_node_ptr& node,
10201085
dom::element value,
10211086
const std::string& path,
@@ -1619,9 +1684,13 @@ static void validate_node(const schema_node_ptr& node,
16191684
if (!matched) {
16201685
if (node->additional_properties_bool.has_value() &&
16211686
!node->additional_properties_bool.value()) {
1687+
std::string msg = "additional property not allowed: " + key_str;
1688+
std::string suggestion = suggest_property(key_str, node->properties);
1689+
if (!suggestion.empty()) {
1690+
msg += ". did you mean \"" + suggestion + "\"?";
1691+
}
16221692
errors.push_back(
1623-
{error_code::additional_property_not_allowed, path,
1624-
"additional property not allowed: " + key_str});
1693+
{error_code::additional_property_not_allowed, path, msg});
16251694
} else if (node->additional_properties_schema) {
16261695
validate_node(node->additional_properties_schema, val,
16271696
path + "/" + key_str, ctx, errors, all_errors, dynamic_scope);
@@ -2815,3 +2884,4 @@ bool is_valid_buf(const schema_ref& schema, const uint8_t* data, size_t length)
28152884
}
28162885

28172886
} // namespace ata
2887+
/* end file src/ata.cpp */

deps/ata/ata.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* auto-generated on 2026-04-30 21:36:25 +0300. Do not edit! */
2+
/* begin file include/ata.h */
13
#pragma once
24

35
#include <cstdint>
@@ -8,16 +10,16 @@
810
#include <variant>
911
#include <vector>
1012

11-
#define ATA_VERSION "0.10.5"
13+
#define ATA_VERSION "0.10.6"
1214

1315
namespace ata {
1416

1517
inline constexpr uint32_t VERSION_MAJOR = 0;
1618
inline constexpr uint32_t VERSION_MINOR = 10;
17-
inline constexpr uint32_t VERSION_REVISION = 5;
19+
inline constexpr uint32_t VERSION_REVISION = 6;
1820

1921
inline constexpr std::string_view version() noexcept {
20-
return "0.10.5";
22+
return "0.10.6";
2123
}
2224

2325
enum class error_code : uint8_t {
@@ -112,3 +114,4 @@ bool is_valid_buf(const schema_ref& schema, const uint8_t* data, size_t length);
112114
inline constexpr size_t REQUIRED_PADDING = 64;
113115

114116
} // namespace ata
117+
/* end file include/ata.h */

src/node_config_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ ParseResult ConfigReader::ParseConfig(const std::string_view& config_path) {
239239

240240
{
241241
static const ata::schema_ref compiled_schema =
242-
ata::compile(options_parser::GenerateConfigJsonSchema(false));
242+
ata::compile(options_parser::GenerateConfigJsonSchema());
243243
CHECK(compiled_schema);
244244
auto result = ata::validate(compiled_schema, file_content);
245245
if (!result.valid) {

src/node_options.cc

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,13 +1766,9 @@ std::vector<std::pair<std::string, OptionMappingDetails>> SortedOptionEntries(
17661766

17671767
void AppendNodeOptionsObject(
17681768
std::string* out,
1769-
const std::vector<std::pair<std::string, OptionMappingDetails>>& sorted_env,
1770-
bool include_additional_properties) {
1771-
*out += '{';
1772-
if (include_additional_properties) {
1773-
*out += R"("additionalProperties":false,)";
1774-
}
1775-
*out += R"("required":[],"properties":{)";
1769+
const std::vector<std::pair<std::string, OptionMappingDetails>>&
1770+
sorted_env) {
1771+
*out += R"({"additionalProperties":false,"required":[],"properties":{)";
17761772
bool first = true;
17771773
for (const auto& entry : sorted_env) {
17781774
if (!first) *out += ',';
@@ -1786,13 +1782,9 @@ void AppendNodeOptionsObject(
17861782

17871783
void AppendNamespaceObject(
17881784
std::string* out,
1789-
const std::unordered_map<std::string, OptionMappingDetails>& options,
1790-
bool include_additional_properties) {
1785+
const std::unordered_map<std::string, OptionMappingDetails>& options) {
17911786
auto sorted = SortedOptionEntries(options);
1792-
*out += R"({"type":"object",)";
1793-
if (include_additional_properties) {
1794-
*out += R"("additionalProperties":false,)";
1795-
}
1787+
*out += R"({"type":"object","additionalProperties":false,)";
17961788
*out += R"("required":[],"properties":{)";
17971789
bool first = true;
17981790
for (const auto& entry : sorted) {
@@ -1807,7 +1799,7 @@ void AppendNamespaceObject(
18071799

18081800
} // namespace
18091801

1810-
std::string GenerateConfigJsonSchema(bool include_additional_properties) {
1802+
std::string GenerateConfigJsonSchema() {
18111803
Mutex::ScopedLock lock(per_process::cli_options_mutex);
18121804

18131805
auto env_options = MapEnvOptionsFlagInputType();
@@ -1826,9 +1818,7 @@ std::string GenerateConfigJsonSchema(bool include_additional_properties) {
18261818

18271819
out += '{';
18281820
out += R"("$schema":"https://json-schema.org/draft/2020-12/schema",)";
1829-
if (include_additional_properties) {
1830-
out += R"("additionalProperties":false,)";
1831-
}
1821+
out += R"("additionalProperties":false,)";
18321822
out += R"("required":[],"properties":{)";
18331823

18341824
bool first_prop = true;
@@ -1841,10 +1831,9 @@ std::string GenerateConfigJsonSchema(bool include_additional_properties) {
18411831
if (prop == "$schema") {
18421832
out += R"({"type":"string"})";
18431833
} else if (prop == "nodeOptions") {
1844-
AppendNodeOptionsObject(&out, sorted_env, include_additional_properties);
1834+
AppendNodeOptionsObject(&out, sorted_env);
18451835
} else {
1846-
AppendNamespaceObject(
1847-
&out, namespace_options.at(prop), include_additional_properties);
1836+
AppendNamespaceObject(&out, namespace_options.at(prop));
18481837
}
18491838
}
18501839

@@ -2313,7 +2302,7 @@ void GetOptionsAsFlags(const FunctionCallbackInfo<Value>& args) {
23132302
void GetConfigJsonSchema(const FunctionCallbackInfo<Value>& args) {
23142303
Local<Context> context = args.GetIsolate()->GetCurrentContext();
23152304
Local<Value> result;
2316-
if (!ToV8Value(context, options_parser::GenerateConfigJsonSchema(true))
2305+
if (!ToV8Value(context, options_parser::GenerateConfigJsonSchema())
23172306
.ToLocal(&result)) {
23182307
return;
23192308
}

src/node_options.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,7 @@ MapNamespaceOptionsAssociations();
427427
std::vector<std::string> MapAvailableNamespaces();
428428

429429
// Builds the `node.config.json` JSON Schema from option metadata.
430-
// `include_additional_properties = false` drops `additionalProperties: false`
431-
// for forward-compat with older Node reading newer configs.
432-
std::string GenerateConfigJsonSchema(bool include_additional_properties);
430+
std::string GenerateConfigJsonSchema();
433431

434432
// Define all namespace entries
435433
#define OPTION_NAMESPACE_LIST(V) \

test/parallel/test-config-file.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ test('should throw at unknown flag', async () => {
165165
`--experimental-config-file=${fixtures.path('rc/unknown-flag.json')}`,
166166
'-p', '"Hello, World!"',
167167
]);
168-
assert.match(result.stderr, /Unknown or not allowed option some-unknown-flag for namespace nodeOptions/);
168+
assert.match(result.stderr, /\/nodeOptions additional property not allowed: some-unknown-flag/);
169169
assert.strictEqual(result.stdout, '');
170170
assert.strictEqual(result.code, 9);
171171
});
@@ -176,7 +176,7 @@ test('should throw at flag not available in NODE_OPTIONS', async () => {
176176
`--experimental-config-file=${fixtures.path('rc/not-node-options-flag.json')}`,
177177
'-p', '"Hello, World!"',
178178
]);
179-
assert.match(result.stderr, /Unknown or not allowed option test for namespace nodeOptions/);
179+
assert.match(result.stderr, /\/nodeOptions additional property not allowed: test/);
180180
assert.strictEqual(result.stdout, '');
181181
assert.strictEqual(result.code, 9);
182182
});
@@ -210,7 +210,7 @@ test('v8 flag should not be allowed in config file', async () => {
210210
`--experimental-config-file=${fixtures.path('rc/v8-flag.json')}`,
211211
'-p', '"Hello, World!"',
212212
]);
213-
assert.match(result.stderr, /V8 flag --abort-on-uncaught-exception is currently not supported/);
213+
assert.match(result.stderr, /\/nodeOptions additional property not allowed: abort-on-uncaught-exception/);
214214
assert.strictEqual(result.stdout, '');
215215
assert.strictEqual(result.code, 9);
216216
});
@@ -268,7 +268,7 @@ test('no op flag should throw', async () => {
268268
`--experimental-config-file=${fixtures.path('rc/no-op.json')}`,
269269
'-p', '"Hello, World!"',
270270
]);
271-
assert.match(result.stderr, /No-op flag --http-parser is currently not supported/);
271+
assert.match(result.stderr, /\/nodeOptions additional property not allowed: http-parser/);
272272
assert.match(result.stderr, /no-op\.json: invalid content/);
273273
assert.strictEqual(result.stdout, '');
274274
assert.strictEqual(result.code, 9);
@@ -512,7 +512,7 @@ describe('namespace-scoped options', () => {
512512
`--experimental-config-file=${fixtures.path('rc/unknown-flag-namespace.json')}`,
513513
'-p', '"Hello, World!"',
514514
]);
515-
assert.match(result.stderr, /Unknown or not allowed option unknown-flag for namespace test/);
515+
assert.match(result.stderr, /\/test additional property not allowed: unknown-flag/);
516516
assert.strictEqual(result.stdout, '');
517517
assert.strictEqual(result.code, 9);
518518
});
@@ -523,7 +523,7 @@ describe('namespace-scoped options', () => {
523523
`--experimental-config-file=${fixtures.path('rc/unknown-namespace.json')}`,
524524
'-p', '"Hello, World!"',
525525
]);
526-
assert.match(result.stderr, /Unknown namespace an-invalid-namespace/);
526+
assert.match(result.stderr, /additional property not allowed: an-invalid-namespace/);
527527
assert.match(result.stderr, /unknown-namespace\.json: invalid content/);
528528
assert.strictEqual(result.stdout, '');
529529
assert.strictEqual(result.code, 9);
@@ -648,7 +648,7 @@ describe('namespace-scoped options', () => {
648648
`--experimental-config-file=${fixtures.path('rc/deprecated-testrunner-namespace.json')}`,
649649
'-p', '"Hello, World!"',
650650
]);
651-
assert.match(result.stderr, /the "testRunner" namespace has been removed\. Use "test" instead\./);
651+
assert.match(result.stderr, /additional property not allowed: testRunner\. did you mean "test"\?/);
652652
assert.strictEqual(result.stdout, '');
653653
assert.strictEqual(result.code, 9);
654654
});

0 commit comments

Comments
 (0)