@soleur/opencode 3.354.27 → 3.354.28

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.
@@ -438,7 +438,7 @@ export function stripComments(text: string): string {
438
438
  }
439
439
 
440
440
  /** The view every declaration parser reads: comments removed AND heredoc bodies blanked. */
441
- function codeView(text: string): string {
441
+ export function codeView(text: string): string {
442
442
  return scanHcl(text, true);
443
443
  }
444
444
 
@@ -515,7 +515,7 @@ function expressionEnd(text: string, start: number, limit: number, stopAtComma =
515
515
  * (`lifecycle {…}`, `validation {…}`, `request_headers {…}`) are skipped whole, so an attribute
516
516
  * inside them is never read as the block's own.
517
517
  */
518
- function topLevelAttributes(body: string): Map<string, string> {
518
+ export function topLevelAttributes(body: string): Map<string, string> {
519
519
  const out = new Map<string, string>();
520
520
  const limit = body.length - 1; // exclude the closing brace
521
521
  const attr = /[ \t\r\n]*([A-Za-z_][A-Za-z0-9_-]*)[ \t]*=(?!=)[ \t]*/y;
@@ -569,7 +569,7 @@ const LABEL = '(?:"([A-Za-z_][A-Za-z0-9_-]*)"|([A-Za-z_][A-Za-z0-9_-]*))';
569
569
  /** A block keyword only at the start of input or after whitespace / a brace (never mid-identifier). */
570
570
  const HEADER_START = "(?<![^\\s{}])";
571
571
 
572
- function resourceBlocks(code: string, type: string): { resourceName: string; body: string }[] {
572
+ export function resourceBlocks(code: string, type: string): { resourceName: string; body: string }[] {
573
573
  const header = new RegExp(`${HEADER_START}resource\\s+(?:"${type}"|${type}(?![A-Za-z0-9_-]))\\s+${LABEL}\\s*\\{`, "g");
574
574
  return labeledBlocks(code, header, (m) => `${type}.${m[1] ?? m[2]}`).map(({ m, body }) => ({ resourceName: m[1] ?? m[2], body }));
575
575
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.354.27",
3
+ "version": "3.354.28",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env bun
2
+ // Discoverability probe for #11068: do all FIVE Inngest-serving Better Stack alert resources
3
+ // declare `push = true` in SOURCE? The flip is the measured-acceptance convention (#9168,
4
+ // #11001): email stays on, push is additive, and a vendor refusal at apply reverts the
5
+ // attribute — a silent source-level revert is exactly what this probe exists to catch.
6
+ //
7
+ // Credential-free and sub-second: it reads apps/web-platform/infra/*.tf only, through the same
8
+ // declaration-grade parser path the drift reconciler uses (codeView + resourceBlocks +
9
+ // topLevelAttributes — comments stripped, heredoc bodies blanked, nested blocks skipped, so
10
+ // only a REAL top-level `push = true` counts). It says nothing about the LIVE resources (a
11
+ // console-side toggle, a vendor refusal) — the merge-triggered apply-web-platform-infra run is
12
+ // that measurement.
13
+ //
14
+ // Standalone file, not a `bun -e` one-liner, because preflight Check 10 (ADR-175) runs the
15
+ // plan's discoverability command inside a sandbox behind a shell-active-token reject —
16
+ // the inngest-luks-alert-armed-probe.ts precedent.
17
+ //
18
+ // Exit 0 + "PUSH_ARMED" when all five declare `push = true`; exit 1 +
19
+ // "PUSH_MISSING <resource>" naming the first one that does not (or is absent).
20
+ import { closeSync, constants, fstatSync, openSync, readFileSync } from "node:fs";
21
+ import { join } from "node:path";
22
+
23
+ import { codeView, listTfFiles, resourceBlocks, topLevelAttributes } from "../lib/heartbeat-live-reconcile";
24
+
25
+ // argv[2] is a TEST seam only (a synthesized root); the plan's discoverability command
26
+ // passes nothing and reads the real root.
27
+ const INFRA_DIR = process.argv[2] ?? "apps/web-platform/infra";
28
+ const TARGETS: readonly (readonly [string, string])[] = [
29
+ ["logtail_exploration_alert", "inngest_luks_wrong_volume"],
30
+ ["logtail_exploration_alert", "inngest_step_524"],
31
+ ["betteruptime_heartbeat", "inngest_server_probe"],
32
+ ["betteruptime_heartbeat", "inngest_prd"],
33
+ ["betteruptime_heartbeat", "inngest_consumer"],
34
+ ];
35
+
36
+ const seen = new Set<string>();
37
+ const missing: string[] = [];
38
+ for (const file of listTfFiles(INFRA_DIR)) {
39
+ const path = join(INFRA_DIR, file);
40
+ // Check-then-read on ONE fd (open + fstat on the descriptor): a path-level
41
+ // lstat→readFileSync pair is the js/file-system-race TOCTOU shape. O_NONBLOCK
42
+ // keeps the open from hanging on a *.tf FIFO before fstat can refuse it.
43
+ const fd = openSync(path, constants.O_RDONLY | constants.O_NONBLOCK);
44
+ let code: string;
45
+ try {
46
+ if (!fstatSync(fd).isFile()) continue;
47
+ code = codeView(readFileSync(fd, "utf8"));
48
+ } finally {
49
+ closeSync(fd);
50
+ }
51
+ for (const [type, name] of TARGETS) {
52
+ if (seen.has(name)) continue;
53
+ const block = resourceBlocks(code, type).find((b) => b.resourceName === name);
54
+ if (block === undefined) continue;
55
+ seen.add(name);
56
+ if (topLevelAttributes(block.body).get("push") !== "true") {
57
+ missing.push(`${type}.${name}`);
58
+ }
59
+ }
60
+ }
61
+ for (const [type, name] of TARGETS) {
62
+ if (!seen.has(name)) missing.push(`${type}.${name}`);
63
+ }
64
+
65
+ console.log(missing.length === 0 ? "PUSH_ARMED" : `PUSH_MISSING ${missing[0]}`);
66
+ process.exit(missing.length === 0 ? 0 : 1);