@redpanda-data/docs-extensions-and-macros 5.37.3 → 5.37.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "5.37.3",
3
+ "version": "5.37.5",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -68,10 +68,16 @@ function previewString (options) {
68
68
 
69
69
  function previewProperty (repo, name, overridesPath, log) {
70
70
  const properties = require('../lint-strings/surfaces/properties')
71
- const handlebars = require('handlebars')
72
- // Requiring the generator registers its Handlebars helpers (eq, ...) as a
73
- // side effect - the same environment a real generation run uses.
74
- require('../property-extractor/generate-handlebars-docs')
71
+ // The generator registers its helpers on whichever handlebars its own
72
+ // require resolves to, and tools/property-extractor/node_modules can hold
73
+ // a second copy - a different instance from this module's, leaving every
74
+ // helper unregistered here. Register them explicitly on an isolated
75
+ // environment instead of relying on that side effect.
76
+ const handlebars = require('handlebars').create()
77
+ const propertyHelpers = require('../property-extractor/helpers')
78
+ for (const [helperName, fn] of Object.entries(propertyHelpers)) {
79
+ handlebars.registerHelper(helperName, fn)
80
+ }
75
81
 
76
82
  const json = properties.runExtractor(repo, log)
77
83
  const prop = (json.properties || {})[name]
@@ -1032,6 +1032,85 @@ def report_phantom_stubs():
1032
1032
  logger.warning("=" * 70)
1033
1033
 
1034
1034
 
1035
+ def infer_topic_property_category(name):
1036
+ """Map a topic property's dotted name to a category, for properties with
1037
+ no explicit category override.
1038
+
1039
+ "other" is the fallback for a name that matches no group. It only renders
1040
+ where a page includes tags=category-other: cloud-docs' topic properties
1041
+ page does (cloud-docs#686); docs' topic-properties.adoc and
1042
+ broker-properties.adoc do not yet, so on docs main a property that falls
1043
+ to "other" is present in the partial but appears on no page. The point of
1044
+ the fallback is that such a property is at least reachable by a known tag,
1045
+ rather than untagged and unreachable by any include.
1046
+ """
1047
+ retention = [
1048
+ "cleanup.policy", "compaction.strategy", "delete.retention.ms", "max.compaction.lag.ms",
1049
+ "min.cleanable.dirty.ratio", "min.compaction.lag.ms", "retention.bytes", "retention.ms"
1050
+ ]
1051
+ segment = [
1052
+ "compression.type", "max.message.bytes", "message.timestamp.type", "segment.bytes", "segment.ms"
1053
+ ]
1054
+ performance = [
1055
+ "flush.bytes", "flush.ms", "redpanda.leaders.preference", "replication.factor", "write.caching"
1056
+ ]
1057
+ tiered = [
1058
+ "initial.retention.local.target.bytes", "initial.retention.local.target.ms", "redpanda.remote.delete",
1059
+ "redpanda.remote.read", "redpanda.remote.recovery", "redpanda.remote.write", "retention.local.target.bytes",
1060
+ "retention.local.target.ms"
1061
+ ]
1062
+ remote_replica = ["redpanda.remote.readreplica"]
1063
+ iceberg = [
1064
+ "redpanda.iceberg.delete", "redpanda.iceberg.invalid.record.action", "redpanda.iceberg.mode",
1065
+ "redpanda.iceberg.partition.spec", "redpanda.iceberg.target.lag.ms"
1066
+ ]
1067
+ schema_registry = [
1068
+ "redpanda.key.schema.id.validation", "redpanda.key.subject.name.strategy", "redpanda.value.schema.id.validation",
1069
+ "redpanda.value.subject.name.strategy", "confluent.key.schema.validation", "confluent.key.subject.name.strategy",
1070
+ "confluent.value.schema.validation", "confluent.value.subject.name.strategy"
1071
+ ]
1072
+ if name in retention:
1073
+ return "retention-compaction"
1074
+ if name in segment:
1075
+ return "segment-message"
1076
+ if name in performance:
1077
+ return "performance-cluster"
1078
+ if name in tiered:
1079
+ return "tiered-storage"
1080
+ if name in remote_replica:
1081
+ return "remote-read-replica"
1082
+ if name in iceberg:
1083
+ return "iceberg-integration"
1084
+ if name in schema_registry:
1085
+ return "schema-registry"
1086
+ return "other"
1087
+
1088
+
1089
+ def _ensure_category_fallback(properties):
1090
+ """Guarantee every property has a category, so the property.hbs/
1091
+ topic-property.hbs templates' `{{#if category}}` always wraps it in a
1092
+ tag::category-X[] region. A property with no category at all gets no
1093
+ tag region and is silently excluded by every page that assembles its
1094
+ content from specific category-tag includes -- present in the raw
1095
+ generated partial, invisible everywhere it's actually read from.
1096
+
1097
+ Runs after overrides are applied (including override-created phantom
1098
+ stub properties, which previously never received a category at all)
1099
+ so this covers every property regardless of where it came from.
1100
+ """
1101
+ for prop_name, property_data in properties.items():
1102
+ if not hasattr(property_data, "get") or property_data.get("category"):
1103
+ continue
1104
+ if property_data.get("config_scope") == "topic" or property_data.get("is_topic_property"):
1105
+ property_data["category"] = infer_topic_property_category(property_data.get("name", prop_name))
1106
+ else:
1107
+ # No per-name taxonomy exists for cluster/broker properties today
1108
+ # (unlike topic properties' infer_topic_property_category) --
1109
+ # "other" at least guarantees a real, included tag region
1110
+ # instead of silent exclusion.
1111
+ property_data["category"] = "other"
1112
+
1113
+
1035
1114
  def apply_property_overrides(properties, overrides, overrides_file_path=None):
1036
1115
  """
1037
1116
  Apply overrides from an overrides mapping to the extracted properties, mutating and returning the properties dictionary.
@@ -1114,6 +1193,8 @@ def apply_property_overrides(properties, overrides, overrides_file_path=None):
1114
1193
  for property_data in properties.values():
1115
1194
  if hasattr(property_data, "get") and property_data.get("description"):
1116
1195
  property_data["description"] = _normalize_config_ref_macros(property_data["description"])
1196
+
1197
+ _ensure_category_fallback(properties)
1117
1198
  return properties
1118
1199
 
1119
1200
 
@@ -2844,49 +2925,6 @@ def extract_topic_properties(source_path, cluster_properties=None):
2844
2925
  if prop_data.get("is_noop", False):
2845
2926
  continue
2846
2927
 
2847
- # Assign category based on property name pattern or mapping
2848
- def infer_category(name):
2849
- retention = [
2850
- "cleanup.policy", "compaction.strategy", "delete.retention.ms", "max.compaction.lag.ms",
2851
- "min.cleanable.dirty.ratio", "min.compaction.lag.ms", "retention.bytes", "retention.ms"
2852
- ]
2853
- segment = [
2854
- "compression.type", "max.message.bytes", "message.timestamp.type", "segment.bytes", "segment.ms"
2855
- ]
2856
- performance = [
2857
- "flush.bytes", "flush.ms", "redpanda.leaders.preference", "replication.factor", "write.caching"
2858
- ]
2859
- tiered = [
2860
- "initial.retention.local.target.bytes", "initial.retention.local.target.ms", "redpanda.remote.delete",
2861
- "redpanda.remote.read", "redpanda.remote.recovery", "redpanda.remote.write", "retention.local.target.bytes",
2862
- "retention.local.target.ms"
2863
- ]
2864
- remote_replica = ["redpanda.remote.readreplica"]
2865
- iceberg = [
2866
- "redpanda.iceberg.delete", "redpanda.iceberg.invalid.record.action", "redpanda.iceberg.mode",
2867
- "redpanda.iceberg.partition.spec", "redpanda.iceberg.target.lag.ms"
2868
- ]
2869
- schema_registry = [
2870
- "redpanda.key.schema.id.validation", "redpanda.key.subject.name.strategy", "redpanda.value.schema.id.validation",
2871
- "redpanda.value.subject.name.strategy", "confluent.key.schema.validation", "confluent.key.subject.name.strategy",
2872
- "confluent.value.schema.validation", "confluent.value.subject.name.strategy"
2873
- ]
2874
- if name in retention:
2875
- return "retention-compaction"
2876
- if name in segment:
2877
- return "segment-message"
2878
- if name in performance:
2879
- return "performance-cluster"
2880
- if name in tiered:
2881
- return "tiered-storage"
2882
- if name in remote_replica:
2883
- return "remote-read-replica"
2884
- if name in iceberg:
2885
- return "iceberg-integration"
2886
- if name in schema_registry:
2887
- return "schema-registry"
2888
- return "other"
2889
-
2890
2928
  converted_properties[prop_name] = {
2891
2929
  "name": prop_name,
2892
2930
  "description": prop_data.get("description", ""),
@@ -2900,7 +2938,7 @@ def extract_topic_properties(source_path, cluster_properties=None):
2900
2938
  "acceptable_values": prop_data.get("acceptable_values", ""),
2901
2939
  "is_deprecated": False,
2902
2940
  "is_topic_property": True,
2903
- "category": infer_category(prop_name)
2941
+ "category": infer_topic_property_category(prop_name)
2904
2942
  }
2905
2943
 
2906
2944
  # Add default values if they exist (inherited from cluster properties)