One of the greatest moments I’ve ever seen involving anything that lasts for only 22 minutes happened on a Thursday night in the spring of 2010. James “Toofer” Spurlock (Keith Powell) bounded into Tracy Jordan’s dressing room with some urgency. On his way into work, a stranger called him a “biggledeeboo.” (It’s a real slur that also sounds like a nasty old man in a children’s book.) “Old-school racism is back,” says Tracy (Tracy Morgan). James can’t believe it: But the president is black. That’s the problem, Tracy says. James remains incredulous nonetheless: “Racism is back because white people no longer feel sorry for us?” And Tracy, who for two seasons of 30 Rock had let us believe in his buffoonery, offers a nugget of insight that turns James’s world upside down: “All you’ve ever known is your affirmative-action job and Queen Latifah Cover Girl commercials.”

With that, James, a writer on the sketch-comedy show TGS, marches into the office of his boss, Liz Lemon (Tina Fey), and asks whether it’s true, that he does owe his employment to a racial quota. Liz demurs, then concedes. He brought the “diverse point of view” mandated by corporate policy (“Toofer” refers to “two for the price of one”; he’s black and went to Harvard), and his salary is paid not from the TGS budget but from a separate quota division of the network. Angered and insulted, he quits rather than stay in a job he feels he didn’t earn.

We’d never seen a black character stand up for himself on such everyday human terms, only to have that moment of self-respect land him more or less where he began — as a token hire and the butt of his coworkers’ jokes. His quitting and ultimate rehiring in a more important position should be a moment of triumph, but no one on 30 Rock stays triumphant for long (there’s a glass ceiling for everybody). The show spent seven seasons as one of the best in the recent history of television. Its last episode airs tonight, at which point its jersey should be retired but its entertainment-industry lessons about how to handle identity should live on. A farce about the pragmatic limits of ambition aimed a lot of its own ambition at the comedy of race.

For nearly all of its run, 30 Rock practiced what’s best called the comedy of Teflon topicality. It had story arcs, but no matter how serious the offense, the show would usually manage to reset itself by the start of the next episode. But it refused to evade race, gender, and their discontents the way dozens of its predecessors had. It wanted to know what kind of fire starts when two different types of black men — uptight Toofer and uncouth Tracy — rub each other the wrong way; when Liz’s sense of propriety clashes with Jenna’s (Jane Krakowski) runaway narcissism; when the self-made executive titan Jack Donaghy (Alec Baldwin) encounters a naïf like Kenneth the NBC page (Jack McBrayer).

The conflicts mixed and matched, like when Tracy and Jenna pulled a “Freaky Friday” stunt in which she put on a suit and Afro and painted her face brown to prove that women were more oppressed than black men, and he tried to make the opposite point by wearing a blond wig and painting his face white. Half the comedy came from the idea of these two stupid-like-a-fox egomaniacs waging “a social experiment.” Half of it came from the way they inhabited their costumes: She looked like a smudge pretending to be Nipsey Russell; he looked like what would happen if science crossbred Paris Hilton and Godzilla.

At the moment, network TV is relatively rich with farce — How I Met Your Mother, Happy Endings, The Big Bang Theory, Suburgatory. But 30 Rock operates at several orders of magnitude higher, much like the The Simpsons and Seinfeld before it. It sidesteps protecting the safe and peaceable and celebrates the mean, pathetic, and ridiculous. Not far into the first season, Jack sets Liz up on a blind date with a lesbian named Gretchen Thomas. They bond over their fear of dying in their apartments alone and undiscovered. When you’re single, Liz says to Thomas (“Thomas” is what Jack calls her), “Everything’s the worst.” This is the rare show daring enough to bring out the best in the worst.

♦♦♦

There’s a way that network television normalizes and sanitizes the dirt of being alive. We can turn on the TV and see our ideal selves — the funnier, faster, braver, more entertaining people we wish ourselves to be. But for most of a decade the dirt of being alive was actually dirty. Norman Lear’s great run of 1970s sitcoms — All in the Family, Maude, Good Times, The Jeffersons — peeled back the surface of American idealism to invite the country to spend most of the decade with the increasingly liberal family of a bigot, with a witheringly stubborn feminist, with a black family subsisting in the Chicago projects, and with a middle-aged black couple that had earned its way to luxury. It was a progressive era, and it was short-lived.

Television in the 1980s tried to pluck the thorns from social issues palatable to a vast audience with far fewer television channels than it currently has. The landscape had been resanitized. Both Lear’s contentious liberalism and the galvanizing perseverance of the Mary Tyler Moore empire were eroding. Activism and righteousness had turned to a kind of pacifism. The “temporary layoffs and easy credit rip-offs” of Good Times had morphed into the insidiously benign paternalism of Benson, Diff’rent Strokes, Webster, and Gimme a Break!, shows that represented a new strain of liberalism in which the needs and concerns of black people were more or less held in check by their proximity to the alleged privilege of whiteness. It was hard to be a poor black male complaining about the man when you were living in his penthouse. Television had lost its nerve when it came to race and social issues.

TV became overwhelmingly white, again. Mostly black shows, like 227 and Amen, were largely stressless havens, free of racial and social upheaval. That comfort continued to swell in the 1990s with shows like Living Single, The Fresh Prince of Bel-Air, and Family Matters. (Fox had the blue-collar black family on Roc, but it might have been too real; it lasted only three seasons.) Most of these shows took the wrong lessons from The Cosby Show and its black-college spin-off, A Different World, the two most important shows about black life in the history of television. The former took lavish pride in blackness and the black middle class. The latter offered an absorbing survey of the many ways to be black. But each show could also be watched, respectively, as a universal half-hour about a large, loving family and as a resonant dramedy about the ups and downs of higher education. Not seeing blackness in either show meant the writing was generous enough to permit you to see past it. But that didn’t mean it wasn’t there. The Fresh Prince of Bel-Air and Family Matters were more insipid shows that nonetheless managed to further normalize a black middle class, while characters like Carlton Banks and Steve Urkel followed the cool nerdiness of A Different World‘s Dwayne Wayne and further expanded the parameters of who else a black male could be.

But the problems of race and racism were shuttled off to cop procedurals and courtroom dramas or were being fought on nascent daytime talk shows and reality stunts like the alarming first two seasons of The Real World. 30 Rock turned a sharp corner on the depiction of those conversations. It’s useful to remember that the show debuted in the fall of 2006, right before the cancellation of Aaron Sorkin’s terrible Studio 60 on the Sunset Strip, whose setting was a sketch comedy show that was too proud of all the positions it took to be funny. That show resulted in nearly two dozen episodes of awkward self-misunderstanding. It was like watching a horse try to ride a man.

At the time, the fear was that 30 Rock would be more lefty righteousness and politically correct self-affirmation, another gassy indulgence from an NBC star. Sorkin’s show was pure Hollywood earnestness and view-from-the–Town Car platitudes. But after half a season, it was clear someone on 30 Rock rode the subway. The show enjoyed the mess of trying to get along. Its approach was Blazing Saddles to Studio 60‘s Crash. Liz breaks up with a geeky black business manager (Wayne Brady) because he’s dull. But he swears it’s because he’s black. This is a man who blithely fulfilled no black stereotypes until he played the race card, which insults her sense of liberal guilt. (Brady also figured in one of the best gags on Chappelle’s Show as a gangsta, giving him the distinction of being an ingenious punch line on the two greatest shows about race that television’s ever seen.)

In one of the all-time best half-hours of television, Liz assumes that Tracy can’t read. But he’s actually just exploiting her white liberal guilt to get time off work. When she tells Pete (Scott Adsit) that Tracy’s either illiterate or slacking, he calls her a racist. But she knows Tracy is working her white guilt, which is only to be used for “tipping and voting for Barack Obama.” Part of the show’s innovation was the way whiteness was as much up for discussion as blackness. Jack Donaghy doesn’t see the color of his skin as a race so much as a class. He grew up Irish-Catholic in the slums of Boston, went to Princeton and Harvard Business School, and arrogantly votes Republican. He’s come into his whiteness just as John Houseman in those old Smith Barney ads would have wanted him to: He’s earned it.

During Tracy and Jenna’s “Freaky Friday” disaster, Jack interrupts their complaining to make the exasperated observation that white men have it hardest of all. Kenneth begins to interrupt him by saying, “As a white man … ” and Jack shuts him down: “Socioeconomically speaking, you are more like an inner-city Latina.” According to Jack, Kenneth, whose sole ambition was to get out of Stone Mountain and into the NBC page program, can’t even afford to be white. (Kenneth’s innocence extended to his positions on race. He was too pure or too dim to have any, which is a real achievement for a poor white man from Georgia.)

Jack’s breathy, leading-man accent and his condescending carriage are as self-constructed as Tracy’s notions of blackness and Jenna’s sense of fame. These are formerly poor people whose insecurities keep them sleeping with one eye open. But the show kept finding new ways to complicate them all. Jack dated that inner-city Latina, his mother’s Puerto Rican nurse (Salma Hayek). He attended a quinceañera for her and convinced his gay Mexican telenovela doppelgänger to try a less villainous approach to his character in order to seduce his girlfriend’s grandmother into respecting Jack. He had an affair with Condoleezza Rice. You wondered whether, without that fancy coating, Jack would just be a version of Dennis Duffy (Dean Winters), the racist, Irish-Catholic moron who had just enough sensitivity and too much innate sexiness for Liz to successfully resist.

You sensed that turning into Dennis was one of Jack’s worst fears. It never happened. But it’s amazing who else Jack turned into. To get Tracy to obey authority, Jack acted out members of Tracy’s family as if Tracy’s family were characters from Sanford and Son and Good Times. Nearly everything Alec Baldwin did on 30 Rock was ingenious, but I remember watching him transform himself from one imaginary member of the Jordan family to another and my mind being blown. Baldwin surpassed caricature and wound up somewhere deeper. This porky white executive was a raunchy black codger. He wasn’t impersonating Redd Foxx. He became him.

30 Rock was always going deeper. It understood the phony limitations of race even as it grasped how much a part of American life it is. This is what separated it from Chappelle’s Show, which grasped how racism was a fact of life — its glass-half-empty gleaning of race in America was the source of its nuclear power. But 30 Rock‘s characters’ ability to live alongside each other is an acceptance that institutional and incidental racism and sexism and homophobia are part of how we live. We can survive by laughing at them. That’s an attitude that might not have been possible before an Obama presidency. Tracy’s right that Obama’s election resurrected old-school racism. But where Chappelle’s satire might have self-destructed over the birthers and Donald Trump, 30 Rock looked the other way and laughed. In the 21st century, old-school racism doesn’t die. It just seems more glib.

It’s been suggested that the longer the show ran, the more about itself it became. But 30 Rock was always about itself, insofar as it generally was a show about the climate of American television and fame and specifically about the cravenness of network television. The episode in which Jack role-plays the Jordan family also features Carrie Fisher as Rosemary Howard, Liz’s comedy-writing hero who worked on a Laugh-In–type show during the liberal-activist era of Norman Lear. Liz brings Rosemary in as a guest writer on TGS and objects when Rosemary wants to try more confrontational stuff, like blackface. (“We would have done that on the Mandrell Sisters!”) Jack tells Liz to fire her. She does, and quits in daughterly solidarity. What follows is actually laugh-out-loud funnier than Jack doing the Jordans: Liz following Rosemary through a New York neighborhood called “Little Chechnya” and realizing that the line dividing iconoclasm and instability is thin. You also realize that TGS is actually a bad show, kept mediocre by Jack’s venal, spineless network.

In Tracy Jordan, 30 Rock invented a character capacious enough to nail down and send up almost everything happening to African Americans in popular culture. His Martin Lawrence–Tyler Perry–ish filmography was one long, flagrant, if lucrative, offense: Fat Bitch; Who Dat Ninja; Black Cop/White Cop (“One does the duty, the other gets the booty”); Sherlock Homie. He was as much an ignorant slut as the equally original Jenna, and like Jenna his erratic idiocy could achieve enlightenment, often around matters of race and, surprisingly, around his curiously strong marriage to the shrewd and savvy Angie (Sherri Shepherd, for most of the series), a woman who connived for herself a priceless reality-show parody called The Queen of Jordan that managed to make a buffoon not of Tracy or the flamboyant queen D’Fwan but of Jack.

Morgan was essentially playing a version of himself, an unstable loon, but the reason he’s a bigger deal on the show than he is an actual movie star is that the show gave his tirades and breakdowns and unruliness superb comedic support. 30 Rock corseted Morgan to brilliance. It also transformed Tracy’s almost wordless entourage, Grizz (Grizz Chapman) and Dot Com (Kevin Brown), from thugs to two men of depth, compassion, sophistication, and long-suffering intelligence. They began as extras and gradually became Huxtables.

The show didn’t get everything right. Jack’s besotted assistant, Jonathan, was always smartly acted by Maulik Pancholy, but only half the time did the character manage to come out on top of the jokes. And I wish there had been more Asian and Latin characters. 30 Rock tended to see the world in black-and-white. But in its defense, that is the binary American television prefers regardless of what the Census says about how this country looks. But 30 Rock pluralized black-and-white so there were suddenly blacknesses and whitenesses.

Indeed, the complexity of some of these episodes is astonishing; so is the ease with which it tossed off a lot of its best lines of dialogue — references to race and racial assumptions as they exist in the world and in popular culture; its casual perceptions about class and sexuality; its grasp of the megalomania of certain performers; its awareness that when it comes to race TV could always do better. In a memorable episode, Queen Latifah plays a congresswoman who threatens to vote down the network’s merger with the Comcast parody KableTown until the programming diversifies. “Why is it,” she asks, “that NBC looks as diverse as a Wilco concert?” She deduces that Toofer’s recent seniority is tokenism and sees Tracy chasing TGS writer Lutz (John Lutz) with a sword and calling him a “cracker.” When a maintenance man removes the recycling bin, the words “white” and “colored” hover beside two bathroom doors. Eventually, she climbs up on a high oratory horse and performs outrage that changes nothing.

A half-hour like that — and there were at least a couple dozen — suggested that 30 Rock at its best could filter the outspoken liberalism of Norman Lear through the pungent randomness of Mel Brooks or Monty Python. One of the cons of the Obama era is that it’s given the culture permission to misrepresent idealism in the form of so-called color-blindness. Shows now have diverse casts whose non-whiteness seems meant to check off a box. On both cable and network TV, most black characters don’t know other black characters. Asians don’t know other Asians. Latinos don’t know Latinos. And if they do their familiarity rarely shows.

The critic Alyssa Rosenberg recently wrote on Think Progress about a conversation she had with the makers of the new serial thriller Deception, in which a black detective goes undercover to investigate the murder of her childhood best friend, who was white. Rosenberg was frustrated by the pride the creators took just from casting a black woman as the lead. She argued that race is precisely the element that would give this preposterous show a note of distinction. She’s right. I’ve watched Deception every week wondering why this detective can’t say more than expository plot advancement to her clearly confused black lover and fellow cop and why he never asks about how on earth she got this mixed up with this crazy white family.

The makers of these shows are often too afraid and too complacent to think outside the box they’ve checked. The argument is that a show like Deception on NBC or Scandal on ABC is trying to move beyond race. A better explanation is Liz’s cop-out when Rosemary says she wants to make TGS more political: “You can’t do race stuff on TV. It’s too sensitive.” The glory of 30 Rock was its awareness that one of the best ways to deal with the problem of race on television is to blithely undermine it.