dsh-data-quality 0.3.9 → 0.3.11

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/src/events.ts CHANGED
@@ -15,6 +15,13 @@
15
15
  * durable copy. On 0.1.2-alpha.3 the envelope field is retained for stored-log
16
16
  * read compatibility only - its Session.append still cannot stamp the marker,
17
17
  * so the gate behavior is unchanged.
18
+ * - On the 0.1.6-alpha.2 line `Session.append<T>(type, data, ...opts)` takes a
19
+ * third argument only for surface-eligible event types, and that argument is
20
+ * a `SurfaceIntent` (an append/replace marker), never an `ignorable`
21
+ * envelope: a non-surface `data-quality/*` type has no third parameter at
22
+ * all, so the source-text probe below still finds no `ignorable` handling and
23
+ * the result stays **skip** - the storage-domain report is the durable copy
24
+ * on alpha.2 exactly as on the earlier lines.
18
25
  * @module dsh-data-quality/events
19
26
  */
20
27
 
@@ -69,7 +76,12 @@ export const DATA_QUALITY_EVENT_TYPES = ['data-quality/profile', 'data-quality/c
69
76
  /** Union of the event types this plugin appends. */
70
77
  export type DataQualityEventType = (typeof DATA_QUALITY_EVENT_TYPES)[number]
71
78
 
72
- /** Loose append shape probed at runtime (rc.6/rc.8/0.1.2-alpha.1 take no options; pre-0.1.2 master builds took `ignorable`). */
79
+ /**
80
+ * Loose append shape probed at runtime (rc.6/rc.8/0.1.2-alpha.1 take no
81
+ * options; pre-0.1.2 master builds took `ignorable`; the 0.1.6-alpha.2 third
82
+ * parameter is a `SurfaceIntent` and exists only for surface-eligible types,
83
+ * so a `data-quality/*` call there has no third argument).
84
+ */
73
85
  type AppendProbe = (type: string, data: unknown, options?: { ignorable: true }) => unknown
74
86
 
75
87
  /**
package/src/index.ts CHANGED
@@ -102,6 +102,14 @@ export async function apply(ctx: Context, config: Config = {}): Promise<void> {
102
102
  let domain: Domain<typeof dataQualityDomainSpec> | undefined
103
103
  if (resolved.storeReports) {
104
104
  domain = await ctx.storageDomain.open(dataQualityDomainSpec)
105
+ // Disposal during the open await: the fiber is gone, so nothing may be
106
+ // registered any more — release the freshly opened handle instead of
107
+ // leaking it (the storage facility is single-open per name, so an
108
+ // unreleased handle also blocks a later remount).
109
+ if (ctx.fiber.uid === null) {
110
+ await domain.close()
111
+ return
112
+ }
105
113
  const reports = domain.table('reports')
106
114
  store = {
107
115
  put: async (record) => {
@@ -118,12 +126,19 @@ export async function apply(ctx: Context, config: Config = {}): Promise<void> {
118
126
  }
119
127
  }
120
128
 
121
- // Service Provider: constructs the local DataQualityService (which publishes ctx.dataQuality) and registers the four model tools below through ctx.tools.register.
129
+ // Service Provider: constructs the local DataQualityService (which publishes ctx.dataQuality) and registers the four model tools below through ctx.tools.register. The registrations live in one effect whose disposer unregisters them in reverse order, so an unmount during apply can neither lose a registration nor leave one behind.
122
130
  const service = new LocalDataQualityService(ctx, resolved, { store, now: Date.now })
123
- ctx.tools.register(defineProfileTool(service))
124
- ctx.tools.register(defineCleanTool(service))
125
- ctx.tools.register(defineVerifyTool(service))
126
- ctx.tools.register(defineReportTool(service))
131
+ ctx.effect(() => {
132
+ const disposers = [
133
+ ctx.tools.register(defineProfileTool(service)),
134
+ ctx.tools.register(defineCleanTool(service)),
135
+ ctx.tools.register(defineVerifyTool(service)),
136
+ ctx.tools.register(defineReportTool(service)),
137
+ ]
138
+ return () => {
139
+ for (const dispose of disposers.reverse()) dispose()
140
+ }
141
+ }, 'dsh-data-quality: tools')
127
142
  logger.info(`dsh-data-quality ${VERSION} mounted: ctx.dataQuality + data_profile/data_clean/data_verify/data_report`)
128
143
 
129
144
  if (domain !== undefined) {
package/src/version.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  /** The package version reported in persisted reports. */
8
- export const VERSION = '0.3.9'
8
+ export const VERSION = '0.3.11'
9
9
 
10
10
  /**
11
11
  * Version of the persisted report schema. Bump it whenever a report's