agentleFS
odinfreeodinfree/storm-ecdsa-harness/skills/portable-source-assertions/SKILL.md

portable-source-assertions

Skill4 starsChanged 20 days agoMITView on GitHub

Fix Python AST source-identity assertions that break across interpreter versions while keeping the exact semantic check. Keeps a source review separate from an actual fixture run.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when unchanged Python controller source passes AST-hash checks locally but fails them on another pinned interpreter.

    line 8
  2. Distinctive:

    If the same-source witness fails, or AST fields/values changed, stop the formatter-only repair.

    line 17
  3. Distinctive:

    Update the serializer and every affected expected digest from the bound witness.

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Portable source assertions

Use when unchanged Python controller source passes AST-hash checks locally but fails them on another pinned interpreter. Keep the repair limited to the demonstrated representation difference; this skill does not authorize a rerun, deployment or native workload.

Establish the falsifier

  1. Preserve the failed run, raw assertion values, interpreter identities, source hashes, selected test names, exit statuses and cleanup receipts. A failed fixture remains incomplete until separately resolved; it does not refute the underlying algorithm.
  2. Compare the actual tested source bytes with the frozen source. If they differ, investigate source selection or mutation before considering formatter changes.
  3. Inspect the exact versions' ast.dump implementation or retained primary documentation. Parse the source once and compare both formatters on the same AST object. This isolates serialization from parser/schema differences.
  4. Require the explanation to reproduce the actual failure hash. Comparing two dumps that merely look similar is insufficient. Record every protected node's old and proposed digest, not just the first failing node.

If the same-source witness fails, or AST fields/values changed, stop the formatter-only repair. Do not silently normalize away a genuine source or parser difference.

Use an explicit format

For the demonstrated Python 3.12/3.14 case, retain fields and omit only location attributes:

import ast
import sys

def full_field_ast_dump(node):
    if sys.version_info >= (3, 13):
        return ast.dump(
            node, annotate_fields=True, include_attributes=False,
            show_empty=True,
        )
    return ast.dump(node, annotate_fields=True, include_attributes=False)

Python 3.14's default omitted empty fields; the retained Python 3.12 formatter included them. Explicit full-field dumps matched for all sixteen protected nodes in the incident below. This is a bound compatibility convention, not a universal canonical AST format across future Python releases. Recheck interpreter/schema changes separately.

Hash the UTF-8 dump with the existing digest algorithm. Keep one expected digest per node. Do not accept both old and new hashes, discard fields, skip nodes, remove assertions or catch comparison failures as success.

Make an additive repair

  • Preserve the original frozen package and failed evidence. Create a new revision; keep production controller files unchanged when only the assertion format is defective.
  • Update the serializer and every affected expected digest from the bound witness. In this incident, all sixteen per-node equality checks (seven lifecycle and nine observer nodes), all twenty-four test names and every assertion remained present.
  • Retain an exact reverse diff and source hashes. Check that reversing the test-only edit recovers the original test source; compare assertion bodies and selected names. Where authorized, a deliberate semantic mutation should still fail. Do not claim that check ran when it did not.
  • Regenerate the complete package manifest and archive, then read every member back by SHA, size and mode. An unchanged production code manifest does not imply an unchanged package: test/fixture bytes also need binding.
  • Rebind consumers and transport wrappers to the new package, manifest and fresh once-only namespace. Preserve parent-wait, process-group cleanup, lock, deadline, transfer and raw-evidence requirements. Keep any missing review or grant explicitly closed.

Close the right evidence gate

A source-only repair receipt reports its exact files, derivation, preserved assertions and checks actually performed. It must say whether production modules were imported and whether a suite ran.

An independent source review admits only the inspected revision. A later authorized run must bind that revision and retain actual test names/counts, raw logs, parent/child exit status, source readback and cleanup. Never turn a source diagnosis, local formatting comparison or prepared grant template into an actual Linux pass. Preserve the original failure even after a later success.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.