{"record":{"id":"362646183380008b","repo":"Hmbown/CodeWhale","slug":"receipt-and-budget-must-resolve-to-distinct-filesystem-paths","errorCode":null,"errorMessage":"receipt and budget must resolve to distinct filesystem paths","messagePattern":"receipt and budget must resolve to distinct filesystem paths","errorType":"validation","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":642,"sourceCode":"        help=\"check an existing measurement JSON instead of compiling\",\n    )\n    parser.add_argument(\n        \"--budget\",\n        type=Path,\n        default=BUDGET_PATH,\n        help=argparse.SUPPRESS,\n    )\n    parser.add_argument(\n        \"--update\",\n        action=\"store_true\",\n        help=\"tighten all ceilings to the current receipt; refuses increases\",\n    )\n    args = parser.parse_args(argv)\n\n    try:\n        check_fragment_caps()\n        if args.receipt is not None and args.receipt.resolve() == args.budget.resolve():\n            raise RuntimeContractError(\n                \"receipt and budget must resolve to distinct filesystem paths\"\n            )\n        budget = load_json(args.budget, \"budget\")\n        receipt = (\n            load_json(args.receipt, \"receipt\")\n            if args.receipt is not None\n            else run_measurement()\n        )\n        increases, decreases = compare(receipt, budget)\n    except RuntimeContractError as error:\n        print(f\"[runtime-contract-budget] ERROR: {error}\", file=sys.stderr)\n        return 2\n\n    if increases:\n        print(\"[runtime-contract-budget] FAIL: runtime contract grew:\", file=sys.stderr)\n        for path, label, current, ceiling in increases:\n            print(\n                f\"  {label}: {current} > {ceiling} (+{current - ceiling}) [{path}]\",","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-runtime-contract-budget.py#L624-L660","documentation":"check-runtime-contract-budget.py validates that runtime contract fragment sizes stay within a recorded budget. This error is thrown when the --receipt and --budget CLI flags point at the same resolved path, which would make the tool both read the budget from and write the receipt to the same file, corrupting the comparison.","triggerScenarios":"Invoking the script with the same path (or paths that resolve to the same file, e.g. via symlink or relative vs absolute spelling) for --receipt and --budget.","commonSituations":"Copy-pasting a single path into both CLI flags; using '.'-style or symlinked paths that resolve to one file; shell scripts passing the same variable to both options.","solutions":["Pass two distinct file paths to --receipt and --budget","Check for symlinks or '..' components that make different-looking paths resolve to one file","If you only have one file, split it: keep the budget file immutable and write the receipt to a new path"],"exampleFix":"// before\npython scripts/check-runtime-contract-budget.py --budget state/budget.json --receipt state/budget.json\n// after\npython scripts/check-runtime-contract-budget.py --budget state/budget.json --receipt state/receipt.json","handlingStrategy":"validation","validationCode":"from pathlib import Path\nreceipt, budget = Path(args.receipt), Path(args.budget)\nassert receipt.exists() and budget.exists()\nassert receipt.resolve() != budget.resolve(), \"receipt and budget must differ\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep budget files immutable and receipts in a separate directory","Use absolute paths in scripts to avoid resolution surprises"],"tags":["python","cli","config"],"backgroundTag":"conflicting-config-options","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}