{"record":{"id":"674cb9211c33f2bc","repo":"gastownhall/beads","slug":"touch-dependency-coordination-unsupported-table","errorCode":null,"errorMessage":"touch dependency coordination: unsupported table %q","messagePattern":"touch dependency coordination: unsupported table %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/dependency_coordination.go","lineNumber":38,"sourceCode":"// issue's incoming parent-child edges use these cells to make concurrent Dolt\n// transactions conflict rather than cell-merge.\nfunc touchDependencyCoordinationInTx(ctx context.Context, tx DBTX, parentID string) error {\n\tfor _, tier := range [2]string{dependencyCoordinationDurableTier, dependencyCoordinationEphemeralTier} {\n\t\tif err := TouchDependencyCoordinationTableInTx(ctx, tx, parentID, tier); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// TouchDependencyCoordinationTableInTx rewrites the coordination cell for one\n// dependency table. table must be dependencies or wisp_dependencies.\nfunc TouchDependencyCoordinationTableInTx(ctx context.Context, tx DBTX, parentID, table string) error {\n\tif parentID == \"\" {\n\t\treturn fmt.Errorf(\"touch dependency coordination: parent ID must not be empty\")\n\t}\n\tif table != dependencyCoordinationDurableTier && table != dependencyCoordinationEphemeralTier {\n\t\treturn fmt.Errorf(\"touch dependency coordination: unsupported table %q\", table)\n\t}\n\tkey := dependencyCoordinationKey(parentID, table)\n\tif _, err := tx.ExecContext(ctx,\n\t\t\"REPLACE INTO local_metadata (`key`, value) VALUES (?, ?)\", key, strconv.FormatInt(FreshRowLock(), 10)); err != nil {\n\t\treturn fmt.Errorf(\"touch dependency coordination for %s: %w\", table, err)\n\t}\n\treturn nil\n}\n\nfunc dependencyCoordinationKey(parentID, table string) string {\n\tshard := dependencyCoordinationShard(parentID)\n\t// A tier has 4096 shard rows: enough to keep unrelated writes apart while\n\t// bounding the clone-local coordination state at 8192 rows. Same-parent\n\t// operations always resolve to the same shard; a hash collision only adds a\n\t// safe serialization conflict.\n\treturn fmt.Sprintf(\"%s%s/%s/%03x\", dependencyCoordinationKeyPrefix, dependencyCoordinationKeyVersion, table, shard)\n}\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/dependency_coordination.go#L20-L56","documentation":"TouchDependencyCoordinationTableInTx only accepts exactly two table names — the durable tier (\"dependencies\") and the ephemeral tier (\"wisp_dependencies\") — because the coordination key is derived per table. Passing any other table name is rejected as a programming error. This prevents coordination metadata being written for tables that don't participate in dependency freshness tracking.","triggerScenarios":"Calling TouchDependencyCoordinationTableInTx with a table string other than the two recognized dependency tables (typo, wrong constant, or refactoring left an old table name in place).","commonSituations":"Internal refactors renaming dependency tables without updating touch call sites; writing generic helper code that forwards arbitrary table names; tests exercising the function with placeholder names.","solutions":["Pass exactly \"dependencies\" or \"wisp_dependencies\" (use the dependencyCoordination* tier constants).","Grep for all TouchDependencyCoordinationTableInTx call sites and confirm each table argument.","Centralize table-name selection in a helper that can only return the two valid tiers."],"exampleFix":"// before\ntouchDependencyCoordinationTableInTx(ctx, tx, parentID, \"deps\")\n// after\ntouchDependencyCoordinationTableInTx(ctx, tx, parentID, dependencyCoordinationDurableTier) // \"dependencies\"","handlingStrategy":"validation","validationCode":"var validCoordTables = map[string]bool{\n    \"dependencies\": true,\n    \"wisp_dependencies\": true,\n}\nif !validCoordTables[table] {\n    return fmt.Errorf(\"table %q does not support coordination touch\", table)\n}\nerr := TouchDependencyCoordinationTableInTx(ctx, tx, parentID, table)","typeGuard":"func isCoordinationTable(t string) bool {\n    return t == \"dependencies\" || t == \"wisp_dependencies\"\n}","tryCatchPattern":"if err := TouchDependencyCoordinationTableInTx(ctx, tx, parentID, table); err != nil {\n    return fmt.Errorf(\"unsupported coordination table %q: %w\", table, err)\n}","preventionTips":["Always pass the dependencyCoordination* constants, never string literals.","Centralize dependency table-name selection in one helper.","Grep call sites after any dependency-table rename."],"tags":["storage","dependencies","coordination","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}