Skip to content

fix(phronesis-ast): move stranded #![forbid(unsafe_code)] to crate top (crate now compiles) - #49

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/phronesis-ast-forbid-attr
Jun 15, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/phronesis-ast-forbid-attr

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Problem

compiler/phronesis-ast/src/lib.rs did not compile. #![forbid(unsafe_code)] — a crate-level inner attribute — was stranded at line 34, in the middle of the file between the Span doc comment and struct Span:

error: an inner attribute is not permitted in this context
  --> src/lib.rs:34
   = note: inner attributes ... are usually found at the beginning of source files
   = the inner attribute doesn't annotate this struct

This is the residue of a botched merge resolution (the attribute belongs at the top of the file). Because the crate failed to build, its unit tests never ran.

Fix

Moved #![forbid(unsafe_code)] to the top of the file — after the SPDX header, before the module docs (its valid crate-level position). One line moved; no other changes; SPDX header untouched.

Verification

$ cargo build   # Finished `dev` profile … (exit 0)
$ cargo test    # test result: ok. 21 passed; 0 failed

🤖 Generated with Claude Code

… crate top

`#![forbid(unsafe_code)]` is a crate-level *inner* attribute but was left
mid-file (line 34, between a doc comment and `struct Span`) — the residue of a
botched merge resolution. Rust rejects an inner attribute there ("the inner
attribute doesn't annotate this struct"), so `phronesis-ast` failed to compile
and its unit tests never ran.

Moved the attribute to the top of the file (after the SPDX header, before the
module docs). `cargo build` succeeds and `cargo test` passes 21/21. SPDX header
left unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 30 issues detected

Severity Count
🔴 Critical 0
🟠 High 7
🟡 Medium 23
View findings
[
  {
    "reason": "Action trufflesecurity/trufflehog@main needs attention",
    "type": "unpinned_action",
    "file": "secret-scanner.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in secret-scanner.yml",
    "type": "missing_timeout_minutes",
    "file": "secret-scanner.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in scorecard-enforcer.yml",
    "type": "scorecard_publish_with_run_step",
    "file": "scorecard-enforcer.yml",
    "action": "split_scorecard_publish_job",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "binary_to_term without :safe option -- deserialization attack (1 occurrences, CWE-502)",
    "type": "elixir_send_unsanitised",
    "file": "/home/runner/work/phronesis/phronesis/lib/phronesis/compiler.ex",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "Nominal-only SAST in phronesis: codeql.yml language matrix contains no language present in the repo and lacks `actions`, so CodeQL records zero results on every commit. Remediation: set the CodeQL matrix to `language: actions`.",
    "type": "StaticAnalysis",
    "file": "/home/runner/work/phronesis/phronesis",
    "action": "auto_fix",
    "rule_module": "scorecard",
    "severity": "medium",
    "remediation": "Add CodeQL or equivalent SAST workflow.",
    "scorecard_check": "SAST"
  },
  {
    "reason": "Repository has 4 non-main remote branch(es). Policy: single main branch only.",
    "type": "GS007",
    "file": ".",
    "action": "delete_remote_branches",
    "rule_module": "git_state",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD007 -- Hypatia structural_drift: SD007 -- 3 day(s) old",
    "type": "CSA001",
    "file": ".claude/CLAUDE.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD007 -- Hypatia structural_drift: SD007 -- 3 day(s) old",
    "type": "CSA001",
    "file": ".claude/CLAUDE.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD007 -- Hypatia structural_drift: SD007 -- 3 day(s) old",
    "type": "CSA001",
    "file": ".claude/CLAUDE.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD007 -- Hypatia structural_drift: SD007 -- 3 day(s) old",
    "type": "CSA001",
    "file": ".claude/CLAUDE.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath merged commit 238af47 into main Jun 15, 2026
8 checks passed
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.

1 participant