Skip to content

feat(other)!: add Flags and Repack as typed readings of Other - #82

Open
zze0s wants to merge 1 commit into
feat/dynamic-rangefrom
feat/flags-repack
Open

zze0s wants to merge 1 commit into
feat/dynamic-rangefrom
feat/flags-repack

Conversation

@zze0s

@zze0s zze0s commented Nov 18, 2026

Copy link
Copy Markdown

Description

Stacked on #81. Step 5 of the stack.

Whether a release is a proper, a repack or a remux was four methods that searched Other on every call, and nothing gave the generation of a repack as a number. This PR reads those once, at the parse:

type Flags uint16

const (
    FlagProper Flags = 1 << iota
    FlagReal
    FlagRemux
    FlagHybrid
    FlagInternal
    FlagReRip
)

func (f Flags) Has(flag Flags) bool
func (f Flags) Strings() []string   // in the order of the constants
func (f Flags) String() string
// MarshalJSON and UnmarshalJSON: a list of spellings

type Release struct {
    // ...
    Flags  Flags // what Other holds of PROPER, REAL, REMUX, HYBRiD, INTERNAL, RERiP
    Repack int   // 0 for none, 1 for REPACK, 2 for REREPACK or REPACK2, n for REPACKn
}

Other stays as it is. Nothing is taken out of it.

name Other Flags Repack
Show.S01E02.REAL.PROPER.1080p.WEB.H264-GRP REAL.PROPER FlagProper, FlagReal 0
Show.S01E02.REPACK2.1080p.WEB.H264-GRP REREPACK none 2
Movie.2019.HYBRiD.REMUX.2160p.UHD.BluRay-GRP HYBRiD, REMUX FlagRemux, FlagHybrid 0

What a caller writes instead

removed replacement
r.IsProper() r.Flags.Has(rls.FlagProper)
r.IsRepack() r.Repack != 0
r.IsRemux() r.Flags.Has(rls.FlagRemux)
r.IsHybrid() r.Flags.Has(rls.FlagHybrid)

Two differences from the methods:

  • They do not follow a later edit of Other. The methods searched Other each time. The fields are set by the parse. A caller that edits Other on a copy has to clear the flag too. qui does that in withoutHybrid and stripSeasonPackRepackTags, and reads neither field today.
  • A Release built by hand has the flags it is given.

Both read Other in any case, as the methods did, so a caller's other row spelled remux or Proper still counts.

Readings

No reading changes. Against #81, 0 names differ in any field in any set (71,919 names), and Flags and Repack equal an independent reading of Other on every one.

cmd/rls gains the keys flags and repack. Its is_proper and is_repack keys are computed from them and are identical on every name.

Downstream impact on autobrr and qui

Neither app calls the four methods, so neither needs a change. Both build and pass against this commit with the ports of #81: qui's 11 packages, and autobrr apart from the two tests that fail against master.

Where they could use the fields later, not done here:

  • autobrr reads Proper, Repack, Hybrid and MediaProcessing = "REMUX" from Other with slices.Contains. One caveat: its repack test is REPACK or REREPACK only, and Repack != 0 is also true for REPACK2 and up, so switching would widen what counts as a repack.
  • qui reads HYBRID, REPACK and PROPER from Other in its variant overrides.

For you to decide

  1. Fields or methods. I made them fields, as approved, so that a stored Release carries them and they cost nothing to read. The price is the first difference above. If you would rather keep them following Other, they become methods again and Repack() computes the number.
  2. JSON. Flags marshals as a list of spellings, like DynamicRange in feat(dynamicrange)!: replace HDR with a sorted DynamicRange set #81, and the same open question about other encoders applies.

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

  • A table of every flag and repack spelling, in every case, alone and together, and on the three paths that build a release: a plain parse, a hint, and a name opened by flags in brackets.
  • A check over every name of the sets that the fields equal an independent reading of Other.
  • An independent review. It found that the first version read Other with a fixed case and lost the remux flag for a caller's remux row, and with it the inferred BluRay source. Fixed here.
  • go vet ./..., gofmt -l . with Go 1.26 and 1.27, go test ./... with the corpus present, go test -race ./..., the cmd/rls checks.

Benchmarks, #80 against the last of the three typed PRs (#83), 8 rounds in alternating order: Parse, Build, ParseNyaa, ParseSports and ParseLong are within noise, and allocations are identical on every benchmark. ParseClaims (Web. repeated 4,000 times) reads between +1.4% and +3.3% across runs. A profile gives none of the changed functions a sample there, and the extra time is in lexer code that no step touches, so I read it as code layout and could not pin it further.

Checklist

  • I ran go fmt and the test suite passes locally
  • I added cases to tests.yaml for any parsing change (no reading changes)
  • If this adds or renames a normalized value (source, codec, HDR, etc.), I noted the downstream impact on autobrr/qui
  • I have linked any related issue (none)

AI disclosure

Yes, all of it. Claude Code (Claude Fable 5.2) wrote it and a second model run reviewed it.

BREAKING CHANGE: Release.IsProper, IsRepack, IsRemux and IsHybrid are removed. Use Flags.Has(FlagProper), Repack != 0, Flags.Has(FlagRemux) and Flags.Has(FlagHybrid). The new fields are set by the parse and do not follow a later change to Other.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 798f348a-a860-426c-9ee5-7746388813a4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Release.Flags is the set of release flags Other holds (PROPER, REAL,
REMUX, HYBRiD, INTERNAL, RERiP; REAL.PROPER is both REAL and PROPER) and
Release.Repack the repack generation (1 for REPACK, 2 for REREPACK or
REPACK2, n for REPACKn), the highest when there are several. Other stays
as it is. Both read Other in any case, as the removed methods did, so a
caller's other row spelled 'remux' or 'Proper' still counts, and a
remux of no source is still taken from a BluRay.

Both are read in one place, from the Other that the build leaves, so
they are right on every path: a plain parse, a hint, and a name opened
by flags in brackets, whose flags are merged into Other after the rest
is built.

cmd/rls writes them as flags and repack, and computes is_proper and
is_repack from them.

BREAKING CHANGE: Release.IsProper, IsRepack, IsRemux and IsHybrid are
removed. Use Flags.Has(FlagProper), Repack != 0, Flags.Has(FlagRemux)
and Flags.Has(FlagHybrid). The new fields are set by the parse: unlike
the methods, they do not follow a later change to Other, and a Release
built by hand has the flags it is given.
@zze0s
zze0s force-pushed the feat/dynamic-range branch from 54802f4 to ff0c64c Compare November 18, 2026 16:12
@zze0s
zze0s force-pushed the feat/flags-repack branch from bbe9aa3 to 4b662e1 Compare November 18, 2026 16:12
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