Barring a last-minute compromise, congressional authorization for the program the government uses to sweep up Americans’ phone records in bulk will lapse on Sunday. That would be perfectly fine.

The looming expiration of a handful of provisions of the Patriot Act, which gave federal authorities vast surveillance powers, has stirred a long-overdue debate over the proper balance between investigative tactics in national security cases and civil liberties. That debate should be allowed to continue, with the goal of reaching a compromise that ensures that surveillance programs are subject to substantive judicial oversight and that Americans have a clear understanding of the data the government is allowed to collect.

The National Security Agency started collecting bulk phone data under the authority of the Patriot Act, which lawmakers passed shortly after the Sept. 11 attacks, amid widespread concern that new attacks could be imminent. There was virtually no meaningful debate then about privacy concerns or civil liberties.

For years, privacy activists were uneasy about the provisions that are about to expire, although the exact way the highly-secretive surveillance programs were being run was known to very few people outside of government. In 2013, the N.S.A. whistle-blower Edward Snowden disclosed that intelligence personnel were gathering up the phone records of millions of Americans who were not under investigation on a routine, systematic basis. His revelations prompted the Obama administration to start a review of intelligence gathering techniques and vow to reform the program. They also led lawmakers, for the first time, to have a meaningful exchange of views about domestic surveillance.