@1aboveio/skills 1.0.4 → 1.0.6

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.
Files changed (83) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -3
  3. package/skills/app-dev/airflow/SKILL.md +1 -1
  4. package/skills/app-dev/android-foundation/SKILL.md +1 -1
  5. package/skills/app-dev/app-debug/SKILL.md +1 -1
  6. package/skills/app-dev/better-auth/SKILL.md +1 -1
  7. package/skills/app-dev/data-catalog/SKILL.md +1 -1
  8. package/skills/app-dev/data-quality/SKILL.md +1 -1
  9. package/skills/app-dev/ios-foundation/SKILL.md +1 -1
  10. package/skills/app-dev/monorepo/SKILL.md +1 -1
  11. package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
  12. package/skills/app-dev/prisma-setup/SKILL.md +1 -1
  13. package/skills/app-dev/pyspark/SKILL.md +54 -12
  14. package/skills/app-dev/pyspark/references/adaptive-batching.md +294 -0
  15. package/skills/app-dev/pyspark/references/diagnosis-and-profiling.md +24 -3
  16. package/skills/app-dev/pyspark/references/etl-contract.md +27 -0
  17. package/skills/app-dev/pyspark/references/production-validation.md +41 -11
  18. package/skills/app-dev/pyspark/references/reconciliation.md +28 -3
  19. package/skills/app-dev/pyspark/references/transformation-design.md +20 -0
  20. package/skills/app-dev/python-backend/SKILL.md +1 -1
  21. package/skills/app-dev/shadcn/SKILL.md +1 -1
  22. package/skills/app-dev/zod-v4/SKILL.md +1 -1
  23. package/skills/cicd/cloud-build/SKILL.md +1 -1
  24. package/skills/cicd/cloud-debug/SKILL.md +1 -1
  25. package/skills/cicd/cloud-deploy/SKILL.md +1 -1
  26. package/skills/cicd/docker/SKILL.md +1 -1
  27. package/skills/cicd/github-actions/SKILL.md +1 -1
  28. package/skills/cicd/github-flow/SKILL.md +1 -1
  29. package/skills/cicd/google-cloud/SKILL.md +1 -1
  30. package/skills/cicd/mergify/SKILL.md +1 -1
  31. package/skills/cicd/podman/SKILL.md +1 -1
  32. package/skills/content/article-review/SKILL.md +1 -1
  33. package/skills/content/article-to-image/SKILL.md +1 -1
  34. package/skills/content/flowchart-svg/SKILL.md +1 -1
  35. package/skills/content/image-gen/SKILL.md +1 -1
  36. package/skills/content/mermaid/SKILL.md +1 -1
  37. package/skills/content/wechat-article-writer/SKILL.md +1 -1
  38. package/skills/content/wechat-publisher/SKILL.md +1 -1
  39. package/skills/content/wechat-search/SKILL.md +1 -1
  40. package/skills/content/xai-search/SKILL.md +1 -1
  41. package/skills/core/distill-writing/SKILL.md +1 -1
  42. package/skills/core/doc-to-md/SKILL.md +1 -1
  43. package/skills/core/editorial-review/SKILL.md +1 -1
  44. package/skills/core/house-style/SKILL.md +1 -1
  45. package/skills/core/house-style/references/defaults.md +32 -6
  46. package/skills/core/house-style/references/rules.md +7 -0
  47. package/skills/core/house-style/templates/gap-analysis.md +1 -1
  48. package/skills/core/plain-language/SKILL.md +87 -4
  49. package/skills/core/polish-cn/SKILL.md +1 -1
  50. package/skills/core/reg-parser/SKILL.md +2 -2
  51. package/skills/core/reg-parser/scripts/dump_checklist.py +1 -1
  52. package/skills/core/terminology/SKILL.md +1 -1
  53. package/skills/core/write-doc/SKILL.md +19 -8
  54. package/skills/core/write-doc/references/bilingual.md +10 -1
  55. package/skills/core/write-doc/references/compliance-reports.md +163 -0
  56. package/skills/{risk-compliance/report-writing/references → core/write-doc/references/reports}/audit-report-template.md +2 -2
  57. package/skills/{risk-compliance/report-writing/references → core/write-doc/references/reports}/external-assessment-template.md +21 -5
  58. package/skills/{risk-compliance/report-writing/references → core/write-doc/references/reports}/management-report-template.md +7 -2
  59. package/skills/{risk-compliance/report-writing/references → core/write-doc/references/reports}/vars-report-template.md +6 -3
  60. package/skills/engineering/better-review/SKILL.md +1 -1
  61. package/skills/engineering/contributing/SKILL.md +1 -1
  62. package/skills/engineering/e2e-test/SKILL.md +1 -1
  63. package/skills/engineering/engineering-runtime/SKILL.md +1 -1
  64. package/skills/engineering/engineering-runtime/coherence/workflow.json +13 -13
  65. package/skills/engineering/ensure-coverage/SKILL.md +1 -1
  66. package/skills/engineering/golden-path/SKILL.md +1 -1
  67. package/skills/engineering/harness-runtime/SKILL.md +1 -1
  68. package/skills/engineering/resolve-issues/SKILL.md +1 -1
  69. package/skills/engineering/resolve-release/SKILL.md +1 -1
  70. package/skills/engineering/rush-issues/SKILL.md +1 -1
  71. package/skills/engineering/rush-release/SKILL.md +1 -1
  72. package/skills/engineering/test-quality/SKILL.md +1 -1
  73. package/skills/risk-compliance/compliance-audit/SKILL.md +1 -1
  74. package/skills/risk-compliance/contract-compare/SKILL.md +1 -1
  75. package/skills/risk-compliance/contract-review/SKILL.md +1 -1
  76. package/skills/risk-compliance/doc-authenticity/SKILL.md +1 -1
  77. package/skills/risk-compliance/fraud-analysis/SKILL.md +1 -1
  78. package/skills/risk-compliance/payment-analysis/SKILL.md +1 -1
  79. package/skills/risk-compliance/similar-domain/SKILL.md +1 -1
  80. package/skills/risk-compliance/tld-detection/SKILL.md +1 -1
  81. package/skills/risk-compliance/report-writing/LICENSE +0 -3
  82. package/skills/risk-compliance/report-writing/SKILL.md +0 -220
  83. package/skills/risk-compliance/report-writing/release-check.mjs +0 -93
package/README.md CHANGED
@@ -31,7 +31,7 @@ Each package also publishes on its own; install either this bundle or the packag
31
31
  | `engineering` | `@1aboveio/engineering-skills` | better-review, contributing, e2e-test, engineering-runtime, ensure-coverage, golden-path, harness-runtime, resolve-issues, resolve-release, rush-issues, rush-release, test-quality |
32
32
  | `cicd` | `@1aboveio/cicd-skills` | cloud-build, cloud-debug, cloud-deploy, docker, github-actions, github-flow, google-cloud, mergify, podman |
33
33
  | `app-dev` | `@1aboveio/app-dev-skills` | airflow, android-foundation, app-debug, better-auth, data-catalog, data-quality, ios-foundation, monorepo, nextjs-fullstack, prisma-setup, pyspark, python-backend, shadcn, zod-v4 |
34
- | `risk-compliance` | `@1aboveio/risk-compliance-skills` | compliance-audit, contract-compare, contract-review, doc-authenticity, fraud-analysis, payment-analysis, report-writing, similar-domain, tld-detection |
34
+ | `risk-compliance` | `@1aboveio/risk-compliance-skills` | compliance-audit, contract-compare, contract-review, doc-authenticity, fraud-analysis, payment-analysis, similar-domain, tld-detection |
35
35
  | `content` | `@1aboveio/content-skills` | article-review, article-to-image, flowchart-svg, image-gen, mermaid, wechat-article-writer, wechat-publisher, wechat-search, xai-search |
36
36
 
37
37
  ## Third-party sources
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1aboveio/skills",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Every 1aboveio skill package in one: install once, then choose which packages Pi loads with npx @1aboveio/skills select.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -123,7 +123,6 @@
123
123
  "doc-authenticity",
124
124
  "fraud-analysis",
125
125
  "payment-analysis",
126
- "report-writing",
127
126
  "similar-domain",
128
127
  "tld-detection"
129
128
  ]
@@ -252,7 +251,7 @@
252
251
  ]
253
252
  }
254
253
  ],
255
- "digest": "41ecf581db6ac404ebca3cfac75779b62cb19ea98fa5ad8c9791b236fecc639e"
254
+ "digest": "efb93166fdfdb1405f9a596f79d068c34b10a09ff176dc8f51021d64bd80e83d"
256
255
  },
257
256
  "publishConfig": {
258
257
  "registry": "https://registry.npmjs.org/",
@@ -2,7 +2,7 @@
2
2
  name: airflow
3
3
  description: Airflow DAG architecture and conventions. Use when designing, writing, reviewing, testing, or debugging Airflow DAGs and tasks, including TaskGroups, data intervals, timezone-aware date parameters, CLI validation, environment-based scheduling, and pytest integrity tests.
4
4
  user-invocable: true
5
- release-version: 0.41.0
5
+ release-version: 0.42.1
6
6
  ---
7
7
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
8
8
  # Airflow DAG Development Patterns
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: android-foundation
3
3
  description: "Prove an Expo / React Native app on a native Android emulator, and fix it when that proof fails. Use before you fix and re-run or re-dispatch a failed Android CI job (`gh workflow run android.yml`, `gh run rerun`): a re-run is not a debugger, so reproduce the failing journey checkpoint off CI first. Also use when a UiAutomator journey or its Python harness tests fail (a CHECK/FAIL line, a wait that timed out, a control not found, adb offline, a lost Metro bridge, a fixture failing on the runner), to build the debug APK and run the device journey, to set up a fresh Android workspace (SDK/NDK/JDK, Gradle caches, private AVD, disposable PostgreSQL), or to add the emulator job to CI. NOT for workflow YAML, CI speed or runner design (github-actions), browser tests (e2e-test), iOS (ios-foundation), plain Jest component tests, or signing and store release."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Android foundation
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: app-debug
3
3
  description: "Diagnose runtime failures in deployed Cloud Run services — 5xx/422 errors, tracebacks, Next.js SSR/hydration or Server Action failures, DB/Secret Manager connection errors, cold-start timeouts, container OOM. NOT for build or deploy failures (cloud-debug)."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # App Debug
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: better-auth
3
3
  description: "Add or debug Better Auth for Next.js App Router: login, sessions, protected routes, middleware, OAuth (including Feishu/Lark), cookies, Prisma, and Auth.js migration."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Better Auth for Next.js
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: data-catalog
3
3
  description: "Column definitions for warehouse tables, written inside the Spark/PySpark or SQL script that builds each table (CATALOG_TABLE / CATALOG_FIELDS, or a `-- @field` comment block), with a generated markdown catalog in docs/catalog/ and a CI check that fails a PR whose catalog is stale. Use when writing or changing a table script that adds, renames, removes, or changes the meaning of an output column or feature; when asked what a warehouse column or feature means; to set a repo up ('init the data catalog', 'generate the data dictionary', '字段字典', 'add catalog CI'); or to audit existing SQL or Spark scripts for undocumented columns. NOT for implementing or tuning the Spark job itself (pyspark), DAG wiring (airflow), or general workflow YAML (github-actions)."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Data catalog
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: data-quality
3
3
  description: "Check a published warehouse table's data against its data-catalog definitions with read-only SELECTs: columns never filled or stuck at one value, counts below zero, ratios outside 0–1, declared values that never appear and undeclared values that do. Then classify each finding as a wrong definition, wrong code, or wrong data. Use when asked whether a table's data is right, to profile or sanity-check a dwd/ads table, to find dead or constant columns, to check a column's values against its documented list, after a pipeline change ships, or when a data-catalog definition and the data might disagree. NOT for validating a Spark change before it ships (pyspark canary and reconciliation), writing definitions (data-catalog), or monitoring dashboards."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Data quality
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ios-foundation
3
3
  description: "Set up and prove an Expo / React Native native iOS workspace from a clean checkout to a manual Login smoke on an owned iOS Simulator: isolated worktree and private caches, Xcode/runtime/CocoaPods preflight, frozen install with `pod install --deployment`, platform-scoped prebuild, an ad-hoc-signed Debug simulator build, a private simulator by exact UDID, Metro on a free port, a disposable PostgreSQL backend with owned cleanup, and the evidence record (setup proof only; feature work reports the smoke result). Use for 'set up iOS', 'build the iOS app', 'run the app on the iOS simulator', 'add iOS to the React Native app', 'prove the iOS build', or when a pod install, xcodebuild, simulator boot, Metro connection or Keychain session fails. NOT for Android (android-foundation), signing, TestFlight or App Store release, or general workflow YAML (github-actions)."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # iOS foundation
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: monorepo
3
3
  description: Turborepo architecture for shared packages, pnpm workspaces, DAL boundaries, and pipelines.
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Turborepo Monorepo Architecture
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: nextjs-fullstack
3
3
  description: "Build or debug Next.js App Router features with React 19 — pages/layouts/route handlers, Server/Client Components, Server Actions, forms, middleware, DAL, strict TypeScript, Zod — plus our conventions: nuqs URL state, SWR cache, Skeleton/Progress + Sonner feedback, drag-and-drop upload, the portal app shell, list pages as filter/sort/paginate tables. shadcn component mechanics: see the shadcn skill."
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Next.js 16 Fullstack Development
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: prisma-setup
3
3
  description: Use when adding or debugging Prisma with PostgreSQL, Next.js, or Turborepo, including schema.prisma, prisma.config.ts, client generation, migrations, seeds, relations, adapters, and DAL/database-layer setup. Triggers on phrases like "Prisma schema", "prisma migrate", "schema.prisma", "seed the database", "PrismaClient error", "relation issue", or "database layer".
4
- release-version: 0.41.0
4
+ release-version: 0.42.1
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Prisma v7 Setup Guide
@@ -4,15 +4,15 @@ description: >
4
4
  Implement, debug, review, and optimize Apache Spark or PySpark batch jobs,
5
5
  ETL pipelines, feature calculations, and Hudi/warehouse writes. Follow
6
6
  contract → transform → materialize → local test → production validation
7
- (one-month canary, optional profile if that canary exceeds 5 minutes without
8
- resource constraints or any job exceeds 30 minutes, authorized write, cluster
9
- reconciliation). Use whenever
7
+ (small canary, measured adaptive batching for every backfill/rebuild, optional
8
+ profile if that canary exceeds 5 minutes without resource constraints or any
9
+ job exceeds 30 minutes, authorized write, cluster reconciliation). Use whenever
10
10
  the task involves Spark DataFrames or Spark SQL, joins, windows, grouped
11
11
  state, UDFs, shuffle, skew, spill, slow stages, driver/executor OOM, Spark
12
12
  Connect, spark-submit, Hudi commits, backfills, validate-only canaries,
13
13
  cluster reconciliation, or Spark event-log profiling — including warehouse
14
14
  job timeouts, empty Hudi writes, or EMR/Dataproc performance regressions.
15
- release-version: 0.41.0
15
+ release-version: 0.42.1
16
16
  ---
17
17
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
18
18
  # PySpark
@@ -20,6 +20,24 @@ release-version: 0.41.0
20
20
  Use this skill as the workflow and routing index. Read the playbook for the
21
21
  step you are on before editing code or submitting to the cluster.
22
22
 
23
+ ## Companion Skills
24
+
25
+ Read the matching companion skill before doing its work:
26
+
27
+ | When | Skill and handoff |
28
+ |---|---|
29
+ | Adding, renaming, removing, or changing the meaning of an output column/feature; explaining a column; auditing missing definitions | [data-catalog](../data-catalog/SKILL.md): read existing definitions first. When editing output columns, update definitions in the table builder, regenerate the catalog, and run drift checks in the same change. Backfill/rebuild wrappers share the builder's definitions; do not create a second dictionary. |
30
+ | Checking a published table against its definitions, including after a pipeline change ships; investigating empty/constant columns, invalid ranges, missing declared values, or observed undeclared values | [data-quality](../data-quality/SKILL.md): use bounded, aggregate-only, read-only checks. Read the builder and classify findings as definition, code, data, or expected behavior; report rather than automatically repair. |
31
+
32
+ If a published-data check lacks definitions, follow data-catalog first, respecting
33
+ any planning-only or no-repository-change instruction. These handoffs do not
34
+ require catalog setup or warehouse scans for every Spark task. A performance-only
35
+ rewrite that preserves column meaning does not require rewritten definitions.
36
+
37
+ Pre-publication tests, aggregate candidate validation, validate-only canaries,
38
+ and independent write reconciliation remain this skill's responsibility.
39
+ Data-quality checks do not replace those gates or authorize a production write.
40
+
23
41
  ## Workflow
24
42
 
25
43
  ```text
@@ -39,9 +57,18 @@ Follow all five steps in order.
39
57
  - **Conventions:** declare native Spark versus Spark Connect and full rebuild
40
58
  versus incremental processing, including the incremental watermark,
41
59
  lookback/checkpoint, and restart boundary when applicable.
42
-
43
- Read [ETL Contract](references/etl-contract.md). When the repository has no ETL
44
- base module, adapt [`assets/templates/etl.py`](assets/templates/etl.py).
60
+ - **Backfills/rebuilds:** adaptive batching is the default for every run, not
61
+ opt-in. Separate the small canary from the full execution plan. Inventory
62
+ aggregate volume, expansion, hot keys, bytes, runtime, and resources; select
63
+ the largest measured-safe year/quarter/month/smaller interval. Keep batching
64
+ budgets within the applicable performance target. Pin a resumable manifest
65
+ and deterministic half-open split/resume boundaries; never resubmit a split
66
+ parent over its children or reuse incompatible completed receipts.
67
+
68
+ Read [ETL Contract](references/etl-contract.md). For every backfill/rebuild,
69
+ also read [Adaptive Batching](references/adaptive-batching.md). When the
70
+ repository has no ETL base module, adapt
71
+ [`assets/templates/etl.py`](assets/templates/etl.py).
45
72
 
46
73
  ### 2. Transform
47
74
 
@@ -84,11 +111,19 @@ evidence.
84
111
 
85
112
  - Pure state, tiny real-Spark, plan-shape, and focused repository tests.
86
113
  - Cover boundaries, ties, nulls, arithmetic, identity, and precedence.
114
+ - Before widening batches, prove the wider candidate equals the union of
115
+ smaller candidates on identical immutable inputs. Exercise the full call
116
+ path, including shared date guards, and preserve per-Activity-Date cutoffs.
87
117
 
88
118
  ### 5. Production validation
89
119
 
90
120
  Run the production entry point on the cluster against a **small sample**,
91
- typically **one month** of source data. Local tests do not substitute.
121
+ typically **one month** of source data. Local tests do not substitute. This
122
+ sample is not the execution batch size. For backfills/rebuilds, follow the
123
+ required [adaptive plan](references/adaptive-batching.md), including a bounded
124
+ wider validate-only canary before an authorized wider write. The small canary
125
+ need not be published first; the first write may be the separately proven wider
126
+ batch.
92
127
 
93
128
  1. **Canary:** `spark-submit` with `--validate-only` on that sample and the
94
129
  production runtime. Require zero blockers, an explicit publication skip,
@@ -101,9 +136,13 @@ typically **one month** of source data. Local tests do not substitute.
101
136
  Otherwise skip. When required, follow
102
137
  [Diagnosis And Profiling](references/diagnosis-and-profiling.md).
103
138
  3. **Write (authorized):** re-check admission, then publish the same pinned
104
- sample. Do not present canary time as write performance.
105
- 4. **Reconciliation:** independently prove the published sample. Follow
106
- [Reconciliation](references/reconciliation.md).
139
+ sample or wider batch proven by its own canary. Verify complete partition
140
+ population, Hudi identity/keys/locks, and single-writer admission. Do not
141
+ present canary time as write performance.
142
+ 4. **Reconciliation:** independently prove every published scope, retaining
143
+ monthly or finer key/preserved-column checks inside wider writes. Follow
144
+ [Reconciliation](references/reconciliation.md). Record receipts; after an
145
+ interruption inspect Spark and Hudi commits before retrying.
107
146
 
108
147
  ```bash
109
148
  spark-submit <production-options> job.py --validate-only
@@ -119,9 +158,12 @@ canary evidence, and write rules.
119
158
  | Need | Read or run |
120
159
  |---|---|
121
160
  | Define or review an ETL job contract | [ETL Contract](references/etl-contract.md) and `assets/templates/etl.py` |
161
+ | Define or change output-column meaning, explain columns, or audit missing definitions | [data-catalog](../data-catalog/SKILL.md) |
162
+ | Check published data against column definitions | [data-quality](../data-quality/SKILL.md) |
163
+ | Plan any backfill/rebuild, size batches, split/resume, or recover an interruption | [Adaptive Batching](references/adaptive-batching.md) |
122
164
  | Diagnose or profile | [Diagnosis And Profiling](references/diagnosis-and-profiling.md) |
123
165
  | Design transformations | [Transformation Design](references/transformation-design.md) |
124
166
  | Optimize temporal/FIFO state | [Velocity Feature Calculation](references/velocity-feature-calculation.md) |
125
- | Reconcile published sample vs previous path | [Reconciliation](references/reconciliation.md) |
167
+ | Reconcile published scope vs previous path, including finer checks within wider writes | [Reconciliation](references/reconciliation.md) |
126
168
  | Run production validation (canary, optional profile, write, reconciliation) | [Production Validation](references/production-validation.md) |
127
169
  | Summarize an event log | `scripts/spark_eventlog_summary.py` |
@@ -0,0 +1,294 @@
1
+ # Adaptive Batching For Backfills And Rebuilds
2
+
3
+ Use measured adaptive batching by default for **every backfill and rebuild**.
4
+ This is a required planning step, not an optional speed optimization. A small
5
+ scope may need one batch; dense history may still require monthly or smaller
6
+ batches. A typically one-month canary does not imply month-by-month execution.
7
+
8
+ Keep two separate artifacts: small-canary evidence and the full execution plan.
9
+ Follow [Production Validation](production-validation.md) for admission,
10
+ zero-output evidence, profiling gates, authorization, and publication. Batching
11
+ does not authorize writes, concurrent Hudi writers, or shuffle tuning.
12
+
13
+ ## 1. Establish Scope And Publication Semantics
14
+
15
+ Declare output scope as `[start, end)`: start included, end excluded, in the
16
+ contract's timezone and date precision. Separate output dates from required
17
+ source-history dates. Earlier history and boundary state must remain available
18
+ to each smaller batch.
19
+
20
+ Inspect the **whole call path**: controller, CLI, wrapper, shared/base
21
+ constructor, extraction, transformation, validation, and every writer. Look for
22
+ calendar-month checks, shared **31-day constructor guards**, default dates,
23
+ per-day loops, history offsets, and post-transform filters. Changing wrapper
24
+ dates alone does not establish wider-range support. Do not bypass a shared
25
+ guard merely to accept a year. Establish its purpose and test affected callers.
26
+ Route changes requiring a shared-contract design decision to Architect. Until
27
+ resolved, retain supported safe intervals in the adaptive plan.
28
+
29
+ Preserve each **Activity Date's cutoff**, source visibility, lookback, tie order,
30
+ and late-data rules. Never replace per-Activity-Date cutoffs with a batch-end
31
+ cutoff. Record semantic, schema, and source-availability boundaries as hard
32
+ interval boundaries. Unknown coverage is a blocker, not sparse history. Resolve
33
+ missing product semantics with Product Manager and shared design decisions
34
+ with Architect before crossing a boundary.
35
+
36
+ Before widening a Hudi write, verify actual table path/name and identity,
37
+ table type/version, complete record key, key generator, precombine order,
38
+ partition columns, operation, locks, and single-writer admission. Inspect
39
+ initial-load fallbacks too. The candidate must contain the **complete population
40
+ of every partition it replaces**, including unchanged entities and preserved
41
+ columns. An overlay's changed rows alone are not a partition replacement.
42
+ A partial first/last interval cannot overwrite a coarser partition unless its
43
+ complete population is safely assembled and the write scope is authorized.
44
+ Otherwise block; do not silently expand requested or already-reconciled scope.
45
+
46
+ ## 2. Inventory Volume Without Writing
47
+
48
+ Run bounded, aggregate-only, read-only queries against pinned source snapshots.
49
+ Inventory years, quarters, months, and denser subperiods as needed. Include
50
+ partial edges and the heaviest known periods/entities. Record scope and source
51
+ pins with each result. Do not print entity-level rows.
52
+
53
+ | Measurement | What to establish |
54
+ |---|---|
55
+ | Output rows and distinct entities | Complete population, not only changed rows; recompute wider distinct counts rather than summing them |
56
+ | Source-history rows and coverage | Required history including pre-start lookback/state; distinguish known zero from unavailable data |
57
+ | Temporal expansion | Estimated/measured pairs or rows after joins, date expansion, explodes, and groups; record absolute counts and expansion denominator |
58
+ | Maximum rows per entity/key | Largest source and expanded groups, hot-key state bytes, and straggler shape; averages hide risk |
59
+ | Bytes | Source scan, intermediate/state, shuffle, and candidate/write bytes; label estimates and uncertainty |
60
+ | Runtime and resources | Startup, scans, identity preparation, transform/validation, publication, reconciliation, peak JVM/Python memory, spill, GC, max-task time, executor allocation, queue wait, and competing work |
61
+
62
+ Prefer aggregates or bounded probes over materializing an unbounded pair
63
+ relation just to count it. Output-row count alone cannot establish safety.
64
+ Tiny output can require huge history joins or one group exceeding task memory.
65
+ Measure unknown metrics with a bounded candidate before admitting that shape.
66
+ Splitting dates may not shrink a lifetime-history hot key. If the smallest
67
+ supported interval still exceeds budget, stop for a bounded algorithm/design
68
+ rather than retrying ever smaller dates indefinitely.
69
+
70
+ ## 3. Select The Largest Measured-Safe Interval
71
+
72
+ Derive a vector of budgets from comparable successful measurements on the same
73
+ runtime, resources, source pins, validation, and publication semantics. Include
74
+ output rows, distinct entities, history, expanded rows, max-key rows/state bytes,
75
+ scan/shuffle bytes, memory/spill, and runtime limits with explicit headroom.
76
+ These budgets must also satisfy the applicable performance target; fitting a
77
+ batch budget does not waive that target. Record each budget's evidence and
78
+ uncertainty. There is **no universal row cap**. The proposed
79
+ 200,000 customer-day limit from the motivating workload is provisional and
80
+ workload-specific, not skill policy.
81
+
82
+ For each remaining contiguous scope, consider calendar years, then quarters,
83
+ months, and smaller supported intervals. Clip to scope edges and hard
84
+ boundaries. Prefer yearly batches for measured-safe sparse history, quarterly
85
+ for medium volumes, and monthly or smaller for dense/skewed periods. Admit only
86
+ intervals within **all** budgets and covered by local equivalence and a bounded
87
+ wider production canary. Inventory nominates candidates; it does not replace
88
+ runtime proof. Do not extrapolate a sparse-year canary to an unmeasured dense
89
+ quarter or hot key. Reinventory and revise only pending work when observations
90
+ exceed budgets or source/resource assumptions change.
91
+
92
+ ### Worked Example (Illustrative, Not Production Evidence)
93
+
94
+ Suppose immutable-source measurements on one fixed resource profile establish
95
+ these workload-specific budgets, with headroom already reserved: 500,000 output
96
+ rows, 4 million history rows, 8 million expanded rows, 80,000 expanded rows per
97
+ key, 64 MiB max-key state, 6 GiB scan, 3 GiB shuffle, and 4 minutes end-to-end
98
+ per write, within the applicable five-minute complete-job target. Comparable
99
+ probes also bound peak memory and spill; those limits remain part of admission
100
+ although the table omits them.
101
+
102
+ | Candidate | Output rows | Distinct entities | History rows | Expanded rows | Max-key rows/state | Scan/shuffle | Measured write time | Decision |
103
+ |---|---:|---:|---:|---:|---|---|---|---|
104
+ | Sparse year | 120,000 | 900 | 700,000 | 1.4 million | 12,000 / 10 MiB | 1 / 0.5 GiB | 3 min | Year fits |
105
+ | Medium year | 900,000 | 2,400 | 6 million | 12 million | 60,000 / 48 MiB | 8 / 5 GiB | Not admitted | Split to quarters |
106
+ | Heaviest medium quarter | 260,000 | 1,800 | 1.9 million | 3.8 million | 35,000 / 28 MiB | 3 / 1.5 GiB | 4 min | Quarter fits; check other quarters |
107
+ | Dense month | 300,000 | 1,200 | 2 million | 10 million | 150,000 / 120 MiB | 4 / 4 GiB | Not admitted | Output fits, expansion/key budgets fail |
108
+ | Heaviest dense week | 75,000 | 800 | 900,000 | 2.5 million | 40,000 / 32 MiB | 2 / 1 GiB | 2 min | Week fits; check remaining weeks/edges |
109
+
110
+ Use the full metric vector, not rows per calendar unit. These write times
111
+ assume already-authorized, reconciled measurements. A new wider shape still
112
+ needs the proof below before its first write. Validate-only times cannot fill
113
+ the measured-write column. Existing profiling gates still apply.
114
+
115
+ ## 4. Split And Resume Deterministically
116
+
117
+ Persist the policy, timezone, minimum interval, and stable ordering. Split at
118
+ calendar-aligned year -> quarter -> month -> declared smaller boundaries.
119
+ Clip children to their parent's `[start, end)`. For smaller periods, record an
120
+ exact rule such as seven-day boundaries anchored at a named date. Retries must
121
+ not choose new boundaries from the current clock.
122
+
123
+ Verify reconciliation receipts against the active campaign's exact source
124
+ pins, code/module identity, output contract, and destination before subtracting
125
+ completed scopes. A plan revision alone does not make older results compatible.
126
+ Reuse a changed identity only with explicit equivalence evidence covering the
127
+ completed scope. Without that proof, block campaign completion and identify all
128
+ affected published scopes for an explicitly authorized rework plan; do not
129
+ silently mix old and new semantics or relabel old receipts. Split at
130
+ semantic/source boundaries and compatible completed-scope edges before sizing.
131
+ Sort by start date. Prove children are nonempty,
132
+ pairwise disjoint, and their union equals the parent's remaining scope. Across
133
+ the campaign, reconciled plus pending scopes must equal exactly the authorized
134
+ scope, with no gaps or overlaps. Never mark a parent complete because one child
135
+ committed. Retain parent/child IDs and durably make the split parent
136
+ non-runnable before scheduling children (for example, mark it superseded).
137
+ Settle any unresolved parent publication state first. Restart must use the
138
+ persisted child plan, never resubmit the original parent over completed children.
139
+
140
+ For example, `[2021-02-10, 2022-05-07)` with reconciled work
141
+ `[2021-07-01, 2021-10-01)` can split into these quarter-sized pending intervals:
142
+
143
+ ```text
144
+ [2021-02-10, 2021-04-01)
145
+ [2021-04-01, 2021-07-01)
146
+ [2021-10-01, 2022-01-01)
147
+ [2022-01-01, 2022-04-01)
148
+ [2022-04-01, 2022-05-07)
149
+ ```
150
+
151
+ Keep partial first and last periods. Exclude reconciled scope from output
152
+ candidates, though required source history may overlap it. Check partition
153
+ replacement completeness separately from logical interval coverage.
154
+
155
+ ## 5. Prove Wider Equals Smaller Before Writing
156
+
157
+ In focused local tests, build the wider candidate and the union of contiguous
158
+ smaller candidates using **the same immutable inputs**, including history and
159
+ boundary state. Use `unionByName` without deduplication for the smaller results.
160
+ Compare schema, complete keys, duplicate multiplicity, all required values,
161
+ and preserved columns with bidirectional `exceptAll`. Counts
162
+ alone are insufficient. Assert literal per-Activity-Date cutoffs so two paths
163
+ cannot share the same batch-end bug.
164
+
165
+ Cover year/quarter/month edges, partial endpoints, leap days and relevant
166
+ timezone boundaries, hot entities, duplicate identities, missing source
167
+ coverage, and already-reconciled holes. Exercise the actual entry point and
168
+ shared constructor, including any 31-day guard. Transform-only tests cannot
169
+ prove that the wider entry point accepts the interval or uses the right writer
170
+ scope. Test deterministic split/resume and interruption after commit but before
171
+ its receipt. Do not relax production guards to make tests pass.
172
+
173
+ After local proof and the small canary, run a **bounded wider validate-only
174
+ production canary** through the full production path before authorizing its
175
+ wider write. Bound it by declared volume/resource budgets and an exact interval.
176
+ Exercise the proposed width and relevant heavy/key shape; a month cannot prove
177
+ a year. Cover each materially different shape or keep unproven periods at
178
+ verified sizes. Require zero blockers, explicit publication skip, zero Spark
179
+ output records/bytes, and retained logs. The small sample is validate-only;
180
+ there is no mandatory sample write before the wider write. The first authorized
181
+ publication may be the proven wider batch. If the sample was independently
182
+ published, reconcile it and account for its completed scope before planning the
183
+ wider write, including partition-replacement completeness.
184
+
185
+ Keep [profiling gates](diagnosis-and-profiling.md#when-profiling-is-required)
186
+ unchanged: a small-sample canary over 5 minutes when unconstrained, or any job
187
+ over 30 minutes regardless of contention. Explicit write authorization and
188
+ fresh admission follow the wider canary. Publish the same pinned candidate.
189
+ Independently reconcile every monthly or finer scope inside the wider commit
190
+ using [Reconciliation](reconciliation.md), including preserved columns and full
191
+ keys, not only whole-batch totals.
192
+
193
+ ## 6. Keep A Resumable Manifest
194
+
195
+ Persist the plan and append attempt history **before** launching work. This
196
+ illustrative YAML shows one reconciled entry, not a new runner implementation.
197
+ Replace example pins/receipts with exact durable identities and real evidence.
198
+
199
+ ```yaml
200
+ campaign_id: rebuild-2021
201
+ plan_revision: 2
202
+ authorized_scope: {start: '2021-02-10', end_exclusive: '2022-05-07'}
203
+ timezone: UTC
204
+ split_policy: calendar-year-quarter-month-then-7d-from-2021-01-01
205
+ minimum_interval: 1d
206
+ hard_boundaries_receipt: receipts/source-and-semantic-boundaries.json
207
+ source_pins: {activity: 'snapshot:example-a', history: 'snapshot:example-b'}
208
+ code: {commit: 'example-full-sha', module: 'jobs.rebuild', module_sha256: 'example-sha256'}
209
+ runtime_resources_receipt: receipts/runtime-resources.json
210
+ table_contract_receipt: receipts/table-keys-partitions-operation-locks.json
211
+ inventory_receipt: receipts/aggregate-inventory.json
212
+ budgets_receipt: receipts/budget-vector-with-headroom-and-measurements.json
213
+ batches:
214
+ - id: '2021-q2'
215
+ parent_id: '2021'
216
+ interval: {start: '2021-04-01', end_exclusive: '2021-07-01'}
217
+ publication_partitions_receipt: receipts/q2-complete-population.json
218
+ estimates_and_budget_checks: receipts/q2-sizing.json
219
+ local_equivalence_receipt: receipts/q2-local-parity.json
220
+ wider_canary_receipt: receipts/q2-validate-only.json
221
+ write_authorization_receipt: receipts/q2-authorization.json
222
+ status: reconciled
223
+ attempts:
224
+ - attempt: 1
225
+ controller_id: controller-example-1
226
+ application_id: application_example_1
227
+ application_attempt_id: appattempt_example_1
228
+ mode: write
229
+ status: reconciled
230
+ publication_instant: 'example-hudi-instant'
231
+ timeline_inspection_receipt: receipts/q2-timeline.json
232
+ reconciliation_receipts:
233
+ - receipts/2021-04-keys-and-preserved-columns.json
234
+ - receipts/2021-05-keys-and-preserved-columns.json
235
+ - receipts/2021-06-keys-and-preserved-columns.json
236
+ ```
237
+
238
+ Budget receipts hold the full vector, measured/proposed distinction, headroom,
239
+ and expansion/hot-key bounds. Record timings and resources per attempt. Use
240
+ explicit states such as planned, validating, validated, writing,
241
+ publication-unknown, committed-unreconciled, reconciled, blocked, failed, and
242
+ superseded. A committed entry is not complete until finer reconciliation passes.
243
+ Changes to pins, code, resources, or budgets create a plan revision. Recheck
244
+ completed-receipt compatibility under the split/resume rules and invalidate
245
+ affected pending validation or sizing proof. Resource-only changes may require
246
+ new capacity evidence without changing reconciled values; source/code/output
247
+ changes require exact identity or explicit equivalence before old receipts
248
+ count toward completion. Keep original attempt identities and receipts
249
+ append-only. Do not silently reuse canary evidence or overwrite attempt history.
250
+
251
+ ## 7. Recover An Interruption Before Retrying
252
+
253
+ 1. Stop/fence the old controller from launching more intervals. Confirm no
254
+ overlapping controller or scheduler can submit work. Record ownership.
255
+ 2. Inspect the existing Spark application and all attempts, driver logs, and
256
+ Hudi timeline for the exact destination. A stopped client or YARN `KILLED`
257
+ does **not** mean no write occurred. Do not retry while the old application
258
+ can still publish.
259
+ 3. Inspect completed, requested, and inflight instants, including commits that
260
+ completed before interruption but lack a manifest receipt. Map each instant
261
+ to its actual partitions, keys/scope, code, and source pins.
262
+ 4. Independently reconcile any committed scope at monthly or finer granularity.
263
+ Record instants and receipts before subtracting completed work. Mark uncertain
264
+ or mismatched scope blocked/publication-unknown, never unwritten.
265
+ 5. Resolve inflight/failed writes through the repository's supported Hudi
266
+ recovery procedure under the lock owner. Do not delete timeline entries or
267
+ force-unlock an application that might still write.
268
+ 6. Only after publication state is settled, replan the verified remainder,
269
+ preserve pins, increment the attempt, and re-check admission and authorization.
270
+ Resume with one controller and one writer; never blindly retry the parent.
271
+
272
+ ## 8. Estimate Completion From Measured Costs
273
+
274
+ Estimate remaining **reconciled completion** time, not only transform time.
275
+ Separate startup, history scans, identity preparation, validation, publication,
276
+ and finer reconciliation. Include queue wait, contention, failed attempts and
277
+ recovery, and uncertainty. Use comparable measured costs for each remaining
278
+ shape. Do not turn a monthly rate into a promised yearly speedup or treat
279
+ validate-only time as write time.
280
+
281
+ Compare finishing verified remaining intervals against paying for guard/code
282
+ changes, local tests, wider canaries, required profiling, and migration/recovery
283
+ before wider execution. Show a range and assumptions for each plan. For an
284
+ illustrative tight deadline, 12 verified monthly intervals at 3-4 minutes each
285
+ imply 36-48 minutes remaining. If guard changes plus proof need 90-120 minutes
286
+ before any wider write, there is no measured case that migration finishes
287
+ sooner. Keep verified intervals in the adaptive plan unless evidence changes
288
+ that comparison. If neither plan meets the deadline, report that limitation.
289
+ Ask Product Manager about scope/deadline changes and Architect about necessary
290
+ shared-contract changes.
291
+
292
+ Reduce repeated fixed costs only where measured wider batching preserves all
293
+ required work. Do not substitute shuffle tuning, concurrent writers, skipped
294
+ checks, or speculative speedups for this plan.
@@ -42,6 +42,23 @@ Use this default target unless the repository defines a stricter one:
42
42
 
43
43
  Treat the target as failed until comparable evidence proves it passed.
44
44
 
45
+ ## Backfill And Rebuild Batching Evidence
46
+
47
+ Every backfill/rebuild follows [Adaptive Batching](adaptive-batching.md).
48
+ Separate the typically one-month canary from execution sizing. Inventory rows,
49
+ entities, required history, temporal expansion, max-key rows/state, and bytes;
50
+ use comparable runtime/resource measurements to select the largest safe
51
+ contiguous interval. These are workload budgets, not a universal row cap or
52
+ permission to relax the performance target above.
53
+
54
+ Measure repeated startup, scans, identity preparation, validation, Hudi commit,
55
+ and reconciliation overhead separately from volume-dependent work. Report a
56
+ remaining-plan ETA range with queue/contention uncertainty. Compare finishing
57
+ verified pending intervals against code/guard migration, local proof, wider
58
+ canary, profiling, and execution costs. Do not claim wider writes are faster
59
+ without comparable authorized-write evidence. Tight deadlines do not waive
60
+ proof, single-writer admission, or the unchanged profiling gates.
61
+
45
62
  ## Require An Isolated, Comparable Profile
46
63
 
47
64
  Accept a baseline or candidate profile only when all of these are fixed and
@@ -141,9 +158,13 @@ settings merely because the slow work becomes visible at a later action.
141
158
  4. **Validate locally:** prove required behavior, boundary cases, and the
142
159
  intended physical-plan change with focused tests. Do not treat local Spark as
143
160
  cluster parity.
144
- 5. **Production validation:** one-month (typical) sample: canary, optional
145
- profile (5-minute unconstrained canary **or** any job over 30 minutes),
146
- authorized write, then reconciliation.
161
+ 5. **Production validation:** start with a small (typically one-month)
162
+ validate-only canary and applicable profiling (over 5 minutes when that
163
+ sample is unconstrained, or any job over 30 minutes). For backfills/rebuilds,
164
+ use the adaptive execution plan and wider-canary proof before wider writes.
165
+ The small sample need not be written first: the first authorized write may
166
+ be the separately proven wider batch. Reconcile whichever scope was
167
+ published, retaining finer checks within wider writes.
147
168
 
148
169
  Repeat the loop when the target is still missed or the dominant gap moves.
149
170
 
@@ -36,12 +36,39 @@ Hudi metadata default.
36
36
  | Write behavior | Append, overwrite, upsert, bulk insert, or insert overwrite | `hudi_mode`, `hudi_mode_override`, `load_hudi`, `load_spark` |
37
37
  | Spark runtime | Native Spark versus Spark Connect and session owner | `create_spark_session`, `managed_spark_session`, `spark_remote` |
38
38
  | Processing scope | Full versus incremental/per-day | `bulk`, `filter_by`, `offset`, `start_date`, `end_date`, `process` |
39
+ | Backfill/rebuild plan | Required adaptive sizing, exact half-open output/history scopes, hard boundaries, measured budgets, deterministic split/resume, and manifest | controller and all job/base-module date and publication paths; see [Adaptive Batching](adaptive-batching.md) |
39
40
  | Incremental state | Watermark, lookback/checkpoint, restart boundary, and late-data behavior | `filter_by`, `offset`, subclass/checkpoint implementation |
40
41
 
41
42
  Do not design the transformation until every applicable surface has an explicit
42
43
  value. Reject defaults that can silently change data scope, key semantics,
43
44
  concurrency, or publication behavior.
44
45
 
46
+ ## Backfill And Rebuild Contract
47
+
48
+ Adaptive batching is the default for every backfill/rebuild. Declare the small
49
+ canary separately from the full execution plan. Follow
50
+ [Adaptive Batching](adaptive-batching.md) for aggregate inventory, measured
51
+ budgets, interval selection, manifest, and interruption recovery.
52
+
53
+ Inspect controller -> CLI -> wrapper -> shared constructor -> extraction ->
54
+ transformation -> validation -> writer. Check calendar-month restrictions and
55
+ any shared 31-day constructor guard; changing wrapper dates is insufficient.
56
+ Do not bypass guards to admit larger dates. Preserve per-Activity-Date cutoffs
57
+ and required pre-start history. Route unresolved product semantics to Product
58
+ Manager and shared-contract design decisions to Architect.
59
+
60
+ Pin exact `[start, end)` intervals (start included, end excluded), source/code/
61
+ module identities, and semantic/source boundaries. Completed receipts must
62
+ match the active campaign's source/code/output contract, or carry explicit
63
+ equivalence evidence for completed scope, before their exact intervals are
64
+ subtracted. A plan revision alone is not compatibility. Preserve original
65
+ receipts and block incompatible completed scope pending an authorized rework
66
+ plan. Before widening, confirm actual Hudi table identity, full keys,
67
+ precombine, overwrite partitions, complete population,
68
+ locks, and single-writer admission. Partial edges do not authorize incomplete
69
+ partition replacement. Require wider-versus-smaller local proof and a bounded
70
+ wider validate-only production canary before an explicitly authorized write.
71
+
45
72
  ## Adapt Repository-Specific Dependencies
46
73
 
47
74
  The complete module depends on its source warehouse. Resolve each dependency