You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c0e88a6
Browse filesBrowse the repository at this point in the historyBrowse files
fix(docs): address CodeRabbit review comments on PR #451
- project_release_pipeline_gotchas.md: fix "three issues" wording to
match the actual four numbered items, and complete the
shouldPerformUpdateCheck() gate description (was missing the
non-upgrade exclusion).
- PRD: reconcile the contradictory v1 scope statement — TS/JS ship in
v1, Python/Ruby follow per the rollout sequencing section, not both
in v1 as the requirements line previously implied.
- ARCH-022: fix "sandbst" typo; require the interpreter-availability
probe to try platform-appropriate candidate names (python3 is not a
universal PATH alias on Windows) per ARCH-009; clarify that the two
ctx.ast() throw cases (missing interpreter vs. parse failure) must
be distinguishable in the error message text even though they share
exit code 2.
Workflow-file findings (persist-credentials, template-injection, TAG
interpolation) from the same review were already resolved by the
origin/main merge in a prior commit — verified against current file
state, no further changes needed there.
Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Copy file name to clipboardExpand all lines: .archgate/PRDs/ast-aware-rule-context.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ Representative use cases:
40
40
### Functional
41
41
42
42
-`RuleContext` MUST expose the AST capability as a single method taking a file path and a language identifier, returning the parsed tree or throwing (see ARCH-022 for the exact signature and throw semantics).
43
-
- Supported languages for v1: TypeScript, JavaScript, Python, Ruby.
43
+
- Supported languages overall: TypeScript, JavaScript, Python, Ruby. TypeScript/JavaScript ship in v1; Python/Ruby follow in a later release per the rollout sequencing below.
44
44
- The method MUST work against any file within the rule's `scopedFiles`/`changedFiles`, subject to the same sandboxing already applied to `readFile`/`glob`.
Copy file name to clipboardExpand all lines: .archgate/adrs/ARCH-022-ast-aware-rule-context.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,10 +39,10 @@ This method dispatches internally based on `language`, and the dispatch mechanis
39
39
40
40
1.**Path safety** — the requested `path` MUST pass through the same `safePath()` sandboxing already applied to `readFile`/`glob` (no traversal outside `scopedFiles`, no symlink escapes).
41
41
2.**Language plausibility check** — the file's extension and/or leading content MUST be sanity-checked against the requested `language` before any interpreter is invoked on it. A rule calling `ctx.ast("config.json", "python")` MUST fail this check rather than hand arbitrary file content to `python3`.
42
-
3.**Interpreter availability probe** — for `"python"`/`"ruby"`, an availability check (e.g. `Bun.spawn(["python3", "--version"])` wrapped in `try/catch`, following the exact pattern `isClaudeCliAvailable()` uses in ARCH-007) MUST run before the real invocation. This probe result MUST be cached once per `check` invocation, not re-run per file.
42
+
3.**Interpreter availability probe** — for `"python"`/`"ruby"`, an availability check (e.g. `Bun.spawn([candidate, "--version"])` wrapped in `try/catch`, following the exact pattern `isClaudeCliAvailable()` uses in ARCH-007) MUST run before the real invocation. `python3` is not a universal PATH alias on Windows (the common installer exposes `python`, not `python3`); the probe MUST try platform-appropriate candidate executable names in order (e.g. `python3` then `python` on non-Windows, `python` then `python3` on Windows, using [ARCH-009](./ARCH-009-platform-detection-helper.md)'s `isWindows()`) and use the first one that resolves for both the probe and the real invocation. This probe result MUST be cached once per `check` invocation, not re-run per file.
43
43
4.**Guarded invocation** — the actual `Bun.spawn` call MUST use array-based arguments only, per ARCH-007, with no shell interpolation of file contents or paths.
44
44
45
-
**Failure semantics.** `ctx.ast()` MUST throw — it MUST NOT return `null` or any other sentinel — both when the required interpreter is unavailable and when the target file fails to parse. This is a deliberate choice, not an oversight: this ADR does not introduce any new error-boundary or exit-code behavior, and none is needed, because `ctx.ast()`'s failure mode composes directly with contracts `src/engine/runner.ts` and `src/engine/reporter.ts` already implement. Every rule's `check(ctx)` call already runs inside a per-rule `try/catch` (`runner.ts`, the loop over `Object.entries(ruleSet.rules)`) that isolates a thrown error to that single rule — other ADRs and rules in the same `check` run continue and report normally. `reporter.ts`'s `getExitCode()` already reserves exit code `2` specifically for rule execution errors, distinct from exit `1` (ADR violations found) and exit `0` (pass). A thrown `ctx.ast()` error therefore surfaces as a visible, correctly-categorized failure through machinery that already exists; a `null` return would instead let a rule silently no-op and report as a false "0 violations," masking a real capability gap as a pass.
45
+
**Failure semantics.** `ctx.ast()` MUST throw — it MUST NOT return `null` or any other sentinel — both when the required interpreter is unavailable and when the target file fails to parse. This is a deliberate choice, not an oversight: this ADR does not introduce any new error-boundary or exit-code behavior, and none is needed, because `ctx.ast()`'s failure mode composes directly with contracts `src/engine/runner.ts` and `src/engine/reporter.ts` already implement. Every rule's `check(ctx)` call already runs inside a per-rule `try/catch` (`runner.ts`, the loop over `Object.entries(ruleSet.rules)`) that isolates a thrown error to that single rule — other ADRs and rules in the same `check` run continue and report normally. `reporter.ts`'s `getExitCode()` already reserves exit code `2` specifically for rule execution errors, distinct from exit `1` (ADR violations found) and exit `0` (pass). A thrown `ctx.ast()` error therefore surfaces as a visible, correctly-categorized failure through machinery that already exists; a `null` return would instead let a rule silently no-op and report as a false "0 violations," masking a real capability gap as a pass. The exit-code/reporter distinction is coarse by design (exit `2` means "a rule could not complete," full stop) — the two throw cases MUST still be distinguishable from each other in the thrown error's message text (e.g. "Python interpreter not found on PATH" vs. "Failed to parse `<path>`: `<parser error>`"), since a user reading `check` output needs to tell "this environment can't run this rule" apart from "this specific file has a syntax error" even though both land on the same exit code.
46
46
47
47
**Explicit non-goal: cross-language AST shape unification.**`ctx.ast()` unifies the call site and the failure contract across languages. It does NOT unify the shape of the returned tree. TypeScript/JavaScript returns ESTree-shaped nodes (via `meriyah`); Python returns whatever the standard `ast` module's own node schema produces; Ruby returns `Ripper`'s native s-expression shape. A rule author writing a Python check and a rule author writing a Ruby check are working against two different, language-native grammars, and must know the target language's own AST vocabulary. This ADR accepts that trade explicitly in exchange for avoiding the dependency and distribution cost of a unifying parser (see the tree-sitter alternatives above); it is not a limitation to be silently discovered later.
48
48
@@ -89,7 +89,7 @@ This method dispatches internally based on `language`, and the dispatch mechanis
89
89
### Risks
90
90
91
91
-**A future contributor bypasses the guardrail ordering and spawns `python3`/`ruby` directly from inside a `ctx.ast()` code path without the path-safety or language-plausibility checks.**
92
-
-**Mitigation:** the four-step guardrail ordering in the Decision section is mandatory and reviewable; `rule-scanner.ts`'s existing `BLOCKED_BUN_PROPS`sandbst continues to prevent `.rules.ts` files themselves from reaching `Bun.spawn`, so the only code path capable of spawning a subprocess for this feature is `createRuleContext()` itself, which code review MUST verify follows the ordering exactly.
92
+
-**Mitigation:** the four-step guardrail ordering in the Decision section is mandatory and reviewable; `rule-scanner.ts`'s existing `BLOCKED_BUN_PROPS`sandbox continues to prevent `.rules.ts` files themselves from reaching `Bun.spawn`, so the only code path capable of spawning a subprocess for this feature is `createRuleContext()` itself, which code review MUST verify follows the ordering exactly.
93
93
-**Interpreter-version skew between the machine authoring a Python/Ruby rule and machines running `archgate check` produces inconsistent AST shapes for the same source file.**
94
94
-**Mitigation:** this is inherent to shelling out to system-installed interpreters rather than bundling a pinned parser version, and is accepted as part of choosing Option A over tree-sitter. Rule authors targeting Python/Ruby structural checks should keep patterns tolerant of minor version-specific node shape differences, and the interpreter-availability probe surfaces the interpreter's version so this can be logged for diagnosis.
95
95
-**The duplicated inline `parseModule()` calls in `rule-scanner.ts` are not factored out before `ctx.ast()`'s TS/JS branch is implemented, leaving three near-identical parse call sites instead of two.**
Copy file name to clipboardExpand all lines: .claude/agent-memory/archgate-developer/project_release_pipeline_gotchas.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,12 @@ metadata:
5
5
type: project
6
6
---
7
7
8
-
Three distinct issues caused shim/binary publishing failures across v0.45.1–v0.46.1, fixed in `fix/publish-shims-race`:
8
+
Four distinct issues caused shim/binary publishing failures across v0.45.1–v0.46.1, fixed in `fix/publish-shims-race`:
9
9
10
10
1.**Workflow race**: `publish-shims.yml` and `release-binaries.yml` both triggered on `release: published`. If binaries needed a retry, `publish-shims.yml`'s fixed-budget `wait-for-binaries` poll timed out and went `cancelled` (terminal) before the retry finished. Fixed: `publish-shims.yml` is now `workflow_dispatch`-only; `release-binaries.yml`'s `trigger-shim-publish` job dispatches it via `gh workflow run` after binaries + provenance succeed.
11
11
2.**`moonrepo/setup-toolchain` cache bug**: right after a `.prototools` bump, the first macOS/Windows CI run can restore a stale `restore-key` cache fallback instead of an exact hit — the action reports success but `bun` isn't on PATH. Log signature: `Cache hit for restore-key:` (vs. exact `Cache hit for:`). Self-heals on retry (the failing job still saves a fresh exact-key cache in post-job cleanup). No code fix — just don't chase it as flakiness.
12
-
3.**Update-check stdout pollution**: `src/cli.ts` printed a background "update available" notice to stdout after every command, unconditionally. Broke `JSON.parse(stdout)` in CLI-subprocess tests (and would break real `| jq` usage) whenever a newer release existed. Fixed via `shouldPerformUpdateCheck()` in `src/helpers/update-check.ts` — only checks in a genuine TTY, non-CI session.
12
+
3.**Update-check stdout pollution**: `src/cli.ts` printed a background "update available" notice to stdout after every command, unconditionally. Broke `JSON.parse(stdout)` in CLI-subprocess tests (and would break real `| jq` usage) whenever a newer release existed. Fixed via `shouldPerformUpdateCheck()` in `src/helpers/update-check.ts` — only checks in a genuine TTY, non-CI, non-`upgrade` session.
13
13
4.**`publish-go-tag` missing `workflows: write`**: its `git push origin shims/go/$TAG` was rejected — GitHub blocks any ref push reachable through commits touching `.github/workflows/*` without that permission, even for an unrelated tag. Fixed by adding `workflows: write` to the job's `permissions:`. Confirmed on v0.45.7's job log.
14
14
15
15
**Why:** Diagnosed while investigating why v0.46.0/v0.46.1 kept failing to publish despite repeated manual retries.
16
-
**How to apply:** If a release build fails and a retry "just works," check which of these three it was before assuming generic flakiness.
16
+
**How to apply:** If a release build fails and a retry "just works," check which of these four it was before assuming generic flakiness.
0 commit comments