Skip to content

Fix nested import resolution in workflow lock hashes - #75226

Merged
pelikhan merged 5 commits into
mainfrom
pelikhan/moderator-import-verification
Nov 6, 2026
Merged

pelikhan merged 5 commits into
mainfrom
pelikhan/moderator-import-verification

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Why

AI Moderator run 42080745147 failed activation lock verification after the hash reader requested nonexistent shared/shared/graders/... paths. A transient HTTP 500 then prevented verification, and the local fallback encountered ENOENT. The later matching debug hash was misleading: both existing hash implementations omitted the same nested grader imports.

Approach

Align Go and JavaScript frontmatter/body hash traversal with compiler import resolution: qualified nested paths resolve from the root workflow directory, while bare names and ./ paths remain relative to the importing file. Preserve cycle detection and genuine read-error propagation; do not accept legacy hashes or suppress reader failures.

Shared regression fixtures cover qualified paths, sibling imports, deeper chains, cycles, nested configuration, template expressions, and body changes. Resolve eight existing slice-index lint findings only in the already-touched hash implementation using semantics-preserving iteration and length-checked capture access. Document the resolution rules and upgrade migration.

Migration and review notes

Regenerated 110 affected locks through make recompile. Verified that their only changes are frontmatter/body hash metadata and matching admission/harness hash identities; workflow scripts, permissions, dependencies, and credential destinations are unchanged. No authored workflow sources or source-managed workflows changed. Affected workflows must be recompiled when upgrading because previously omitted nested content now contributes to their hashes.

This does not change the separately investigated merge-ref lifecycle behavior.

Validation

  • Full pkg/parser suite and 188 JavaScript hash/activation tests passed; typecheck, formatting, lint, and build passed.
  • The regression fails against the original implementation at the doubled shared/shared path and passes with this fix.
  • All 357 workflows compiled successfully, workflow drift checks passed, and the final make agent-report-progress gate passed. Existing nonblocking warnings remain.
  • Strict mocked-API and local filesystem readers for the actual Moderator source read all three grader files and produce hashes matching the regenerated lock, with no missing imports.
  • Same-reviewer security review passed for the final source and generated-lock snapshot, with no confirmed vulnerabilities.

No hosted workflow was dispatched or rerun, and no credentials were changed. Live Actions verification remains unperformed.

pelikhan and others added 2 commits November 5, 2026 10:38
Resolve qualified nested imports from the root workflow directory while preserving importer-relative sibling paths. Cover Go and JavaScript hashing with shared regression fixtures and refresh affected generated hash identities.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Compare actual frontmatter and body hashes plus complete import read sets across nested-import mutations, reader modes, root paths, CRLF and inlined imports. Fail on missing Node or JavaScript runner errors rather than silently skipping cross-language checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 5, 2026 19:20
Copilot AI adaptive review requested due to automatic review settings November 5, 2026 19:20
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #75226

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: gpt56 max · ~1 AIC · ⌖ ~1 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

❌ Design Decision Gate 🏗️ failed to deliver outputs during design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR Specification Reviewer failed to deliver outputs. Please review the logs for details.

Generated by PR Specification Reviewer for #75226

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

No actionable issues found in the changed lines. The specialist pass was unavailable because its file-read tool calls were rejected; I independently reviewed the capped diff and up to five relevant source ranges. Static review only; tests were not run.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this change does: It makes nested frontmatter and body hash traversal follow the compiler root-relative import rule, and adds shared regression coverage across the Go and JavaScript implementations. The generated lock updates are excluded from this review.

Should fix:

  1. The capture arrays are unnecessary (pkg/parser/frontmatter_hash.go:L633-L643)

    • What this is: The new fixed-array conversions exist only to work around uncheckedsliceindex.
    • Problem: The len guards immediately above already prove these capture indexes are in bounds, so the conversions add ceremony and hide the direct regex access.
    • Fix: Use match[1] and rangeMatch[1], [2], and [3] directly with the narrow (nolint/redacted):uncheckedsliceindex comments already used in pkg/parser/json_path_locator.go.
    • If we skip it: This small parser remains harder to read for no behavior gain.

Not checked: generated lock files, correctness, security, and performance issues, per the review scope.

Verdict: fix 1 first.
Lean: -2 lines possible.

Generated by ✂️ Ponytail Reviewer for #75226 · codex · routed: gpt56 max · ~7 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again

Comment thread pkg/parser/frontmatter_hash.go Resolved
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Warning

The push_to_pull_request_branch operation failed: Cannot push to branch "pelikhan/moderator-import-verification": this branch has protection rules. Agents must not push directly to protected branches.. The code changes were not applied.

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/75226-resolve-nested-imports-in-lock-hashes.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff

  2. Complete the missing sections — add context the AI could not infer, refine the decision rationale, and list real alternatives you considered

  3. Commit the finalized ADR to docs/adr/ on your branch

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-75226: Resolve Nested Imports Consistently in Lock Hashes (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

🔎 Gate evidence
  • Prefetched gate summary: default_business_additions: 331, above the 100-line threshold; no implementation label was present.
  • The PR changes hash/import resolution in pkg/parser/frontmatter_hash.go, pkg/parser/import_bfs.go, and actions/setup/js/frontmatter_hash_pure.cjs, with Go/JavaScript regression coverage.
  • The PR body describes aligning qualified nested paths with compiler resolution while preserving local and GitHub API reader behavior.
  • No ADR link or complete Michael Nygard section set was present in the PR body or branch before this draft.
❓ Why ADRs Matter

AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say: I will deal with this later. Deferring decisions corroded my ability to think clearly.

ADRs create a searchable, permanent record of why the codebase looks the way it does.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs, both positive and negative?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: gpt56 max · ~5 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed captured PR head 7b71af1485908d0aabf4e4e3a4ec2107eb769829 against docs/src/content/docs/specs/frontmatter-hash-specification.md v1.0.0 and the changed Go/JavaScript hash walkers, tests, and import documentation.

Applicable contract: frontmatter-hash specification v1.0.0, BFS/import traversal and cross-language requirements (including R-XLANG-001 through R-XLANG-003). The implementation preserves cycle/deduplication and read-error behavior, and the added fixtures exercise multi-level qualified, bare, and dot-relative imports plus Go/JavaScript parity.

No blocking conformance violation found. The formal specification previously omitted the newly intentional qualified-path resolution rule, so I synchronized it to v1.0.1 with normative root-directory versus importer-relative rules and a change log. The specification-only commit was published to the same PR branch. No tests were run by this static review; PR-reported validation was treated as evidence only. Coverage limit: GitHub base objects were unavailable locally, so the prefetched diff and checked-in contract were used.

Generated by PR Specification Reviewer for #75226 · copilot · gpt50 · ~6 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd. Requesting changes because the PR states it preserves genuine read-error propagation, but the Go hash walkers still drop every reader error.

📋 Key Themes & Highlights

Key Themes

  • Error propagation gap: processImportsTextBased and collectImportedBodies in pkg/parser/frontmatter_hash.go skip all fileReader errors. The JS side rethrows anything that is not a not-found error. The skip predates this PR, but the PR is meant to guarantee this behavior, and a transient failure can silently produce an incomplete hash.
  • Test coverage: the Go/JS parity test covers the nested-path cases but not reader failures, so it cannot catch this.

Positive Highlights

  • ✅ The qualified-path rule (resolve from root, bare and ./ paths relative to the importer) matches determineNestedBaseDir / isFileRelativeImportPath in import_bfs.go.
  • ✅ The shared fixture covers cycles, deep chains, sibling imports, and template expressions.
  • ✅ Docs and the changeset describe the resolution rules and the upgrade path clearly.

Verification was read-only. I did not run the Go or JS test suites, so the findings come from reading the diff and the base code.

@copilot please address the review comments above.

Comments that could not be inline-anchored

pkg/parser/frontmatter_hash.go:555

**[/diagnosing-bugs]** The body-hash walker has the same issue: every `fileReader` error is skipped with a bare `continue`. The JS counterpart at `actions/setup/js/frontmatter_hash_pure.cjs` (line 691) rethrows non-not-found errors. A failed read here would silently drop the imported body from the body hash. <details> <summary>💡 Suggested fix</summary> Use the same not-found classification as the frontmatter walker and return other errors. Cover this path with a test where the reader fails wi...

pkg/parser/frontmatter_hash_parity_test.go:36

**[/tdd]** Nit: `require.NoError` on the Node lookup fails the whole test when Node is absent. Other Node-dependent tests in `pkg/parser` (for example `runtime_import_test.go`) call `t.Skipf` instead, so this would be the only exception. <details> <summary>💡 Suggested change</summary> ```go node, err := exec.LookPath("node") if err != nil { t.Skipf("Node.js is required for the parity check: %v", err) } ``` </details> @copilot please address this.

pkg/parser/frontmatter_hash.go:493

**[/diagnosing-bugs]** This walker drops every `fileReader` error, not only not-found errors. The JS walker in `actions/setup/js/frontmatter_hash_pure.cjs` (line 251) rethrows anything where `!isFileNotFound(err)`, so Go and JS diverge. The PR body says the change must preserve genuine read-error propagation and must not suppress reader failures, but this path still does. A transient HTTP 500, which is the failure in the linked run, would silently produce a hash that omits imports. This predates...

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The imports documentation incorrectly implies that nested .github/... and /... imports invalidate the lock, although they resolve from the repository root and remain omitted by hash readers.

1 open issue
What changed in this PR

This PR aligns nested-import hashing with the compiler’s resolution rules, preventing doubled paths and ensuring nested content contributes to workflow lock verification.

Changes:

  • Distinguishes workflow-root-qualified imports from file-relative imports during hash traversal.
  • Adds shared Go and JavaScript regression fixtures covering nested chains, cycles, and content changes.
  • Refreshes affected lock hashes and documents resolution rules and upgrade recompilation.
File Description
pkg/​parser/​testdata/​nested_import_hash.json Adds a shared nested-import fixture.
pkg/​parser/​import_bfs.go Extracts the file-relative path predicate for reuse.
pkg/​parser/​frontmatter_hash_nested_test.go Adds Go hash and content-change regression tests.
docs/​src/​content/​docs/​reference/​imports.md Documents nested resolution and hash behavior.
actions/​setup/​js/​frontmatter_hash_pure.test.cjs Tests nested hashes with API and filesystem readers.
actions/​setup/​js/​frontmatter_hash_pure.cjs Retains the workflow root through nested hash traversal.
.github/​workflows/​unbloat-docs.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​uk-ai-operational-resilience.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​terminal-stylist.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​smoke-kiro.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​smoke-cursor.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​smoke-crush.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​smoke-agy.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​refiner.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​refactoring-cadence.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​pr-nitpick-reviewer.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​ponytail-reviewer.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​lockfile-stats.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​impeccable-skills-reviewer.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​grumpy-reviewer.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​github-remote-mcp-auth-test.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​github-mcp-tools-report.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​engine-conformance-agy.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​docs-noob-tester.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​daily-team-evolution-insights.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​daily-safe-outputs-conformance.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​daily-multi-device-docs-tester.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​daily-malicious-code-scan.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​daily-elixir-credo-snippet-audit.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​daily-cli-performance.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​copilot-session-insights.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​copilot-pr-merged-report.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​codex-github-remote-mcp-test.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​code-simplifier.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​code-scanning-fixer.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​cli-consistency-checker.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​claude-code-user-docs-review.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​changeset.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​bot-detection.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​avenger.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​auto-triage-issues.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​artifacts-summary.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​architecture-guardian.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​approach-validator.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​agy-conformance-reusable.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​agent-job-health.lock.yml Refreshes lock metadata and admission hashes.
.github/​workflows/​ace-editor.lock.yml Refreshes lock metadata and admission hashes.
.changeset/​fix-nested-import-hashes.md Records the patch and recompilation migration.

Review effort: Max (auto)

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/parser/frontmatter_hash.go:633): What this is: The fixed-array conversions at lines 633 and 640 are only a workaround for uncheckedsliceindex. Problem: The len guards immediately above already prove these capture indexes are in bounds, so this adds ceremony and hides the straightforward regex access. Fix: Use match[1] and rangeMatch[1], [2], and [3] directly with the same narrow (nolint/redacted):uncheckedsliceindex comments already used in pkg/parser/json_path_locator.go. If we skip it: This small parser remains harder to read for no runtime behavior. - Fix nested import resolution in workflow lock hashes #75226 (comment)
  3. Fix failing check safe_outputs (FAILURE): https://github.com/github/gh-aw/actions/runs/42092919063/job/127480523302.
  4. Fix failing check safe_outputs (FAILURE): https://github.com/github/gh-aw/actions/runs/42092918898/job/127480149129.

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: 7b71af1
Sous-chef requested-work: 3a1d5d8be50e92c679ccf7b5976af5c7de62ae315728a7b612188993fed90461 c7cf93e497befdd5e698d00101b0703e4101fe4133d86d433f7c170d07402b7e
Sous-chef requested-state: 4cc3ced36d8096a5c2a2e3bd6ff6444b7ccf570d6c8ad0f4f7995a8c917fc78e

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~5 AIC · ⌖ ~10 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits November 5, 2026 20:16
…port-verification

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Regenerate workflow lock conflicts from merged sources. Scope nested import hash documentation to relative-form imports and link Path Resolution.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit 167438f into main Nov 6, 2026
72 checks passed
@pelikhan
pelikhan deleted the pelikhan/moderator-import-verification branch November 6, 2026 05:47
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants